add post install script

This commit is contained in:
Inhji 2024-09-02 22:30:08 +02:00
parent 03fd40d997
commit 691e8b4652

108
postinstall.sh Executable file
View file

@ -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