From 691e8b4652a228e4995b5bfc3834ba2d9d0828e8 Mon Sep 17 00:00:00 2001 From: Inhji Date: Mon, 2 Sep 2024 22:30:08 +0200 Subject: [PATCH] add post install script --- postinstall.sh | 108 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100755 postinstall.sh diff --git a/postinstall.sh b/postinstall.sh new file mode 100755 index 0000000..d847d33 --- /dev/null +++ b/postinstall.sh @@ -0,0 +1,108 @@ +#! /bin/bash + +# COLORS {{{ +Bold=$(tput bold) +Underline=$(tput sgr 0 1) +Reset=$(tput sgr0) +# Regular Colors +Red=$(tput setaf 1) +Green=$(tput setaf 2) +Yellow=$(tput setaf 3) +Blue=$(tput setaf 4) +Purple=$(tput setaf 5) +Cyan=$(tput setaf 6) +White=$(tput setaf 7) +# Bold +BRed=${Bold}$(tput setaf 1) +BGreen=${Bold}$(tput setaf 2) +BYellow=${Bold}$(tput setaf 3) +BBlue=${Bold}$(tput setaf 4) +BPurple=${Bold}$(tput setaf 5) +BCyan=${Bold}$(tput setaf 6) +BWhite=${Bold}$(tput setaf 7) + +print_line() { + printf "%$(tput cols)s\n"|tr ' ' '-' +} + +print_title() { + #clear + print_line + echo -e "# ${BPurple}$1${Reset}" + print_line + echo "" +} + +print_question(){ + T_COLS=`tput cols` + echo -n "${BBlue}$1${Reset}" +} + +print_msg(){ + T_COLS=`tput cols` + echo -e "${BGreen}$1${Reset}" + sleep 1 +} + +print_info() { + #Console width number + T_COLS=`tput cols` + echo -e "${Bold}$1${Reset}\n" | fold -sw $(( $T_COLS - 18 )) | sed 's/^/\t /' +} + +print_warning() { + T_COLS=`tput cols` + echo -e "${BYellow}$1${Reset}\n" | fold -sw $(( $T_COLS - 1 )) + sleep 4 +} + +install_fisher() { + if ! command -v fisher &> /dev/null + then + print_msg "Installing fisher" + curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher update + fi +} + +install_paru() { + if ! command -v paru &> /dev/null + then + print_msg "Installing Paru AUR Helper" + git clone https://aur.archlinux.org/paru.git /tmp/paru + cd /tmp/paru + makepkg -si + fi +} + +update_packages() { + print_msg "Updating System" + sudo pacman -Syu +} + +install_base_packages() { + print_msg "Installing Base Packages" + sudo pacman -S --needed base-devel fish git curl +} + +install_packages() { + print_msg "Installing Packages" + paru -S --needed tofi foot aerc gitui beets offlineimap +} + +main() { + print_title "Post Install Script" + print_question "Shall we begin?" + read yn + yn=${yn:-y} + if [ "$yn" == "y" ]; then + update_packages + install_base_packages + install_paru + install_packages + + # TODO - does not work in bash + # install_fisher + fi +} + +main \ No newline at end of file