refactor(script/bootstrap): Split package list

This commit is contained in:
Ahmad Ansori Palembani 2024-07-20 05:33:14 +07:00
parent 94e8b20ac6
commit 1abd970524
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
2 changed files with 48 additions and 25 deletions

View file

@ -3,24 +3,7 @@
[ $ZI_DOTFILES ] || { >&2 echo "Please run pre-bootstrap first!"; exit 1; } [ $ZI_DOTFILES ] || { >&2 echo "Please run pre-bootstrap first!"; exit 1; }
[ -d $ZI_DOTFILES ] || { >&2 echo "Invalid dotfiles path, please re-run pre-bootstrap!"; exit 1; } [ -d $ZI_DOTFILES ] || { >&2 echo "Invalid dotfiles path, please re-run pre-bootstrap!"; exit 1; }
packages_arch=( . $ZI_DOTFILES/bootstrap-pkgs
git
opendoas
zsh
# >> for shell scripts
jo
bc
socat
jq
# << for shell scripts
ffmpeg
# required by firefox, without it firefox-based browser can't play video from certain website
ffmpeg4.4
)
packages_arch_aur=(
floorp-bin
)
# === Function and Variable === # === Function and Variable ===
@ -30,7 +13,12 @@ is_package_exists() {
DISTRO="$(cat /etc/*-release | grep ^ID | head -n1 | cut -d '=' -f2 | cut -d '"' -f2)" DISTRO="$(cat /etc/*-release | grep ^ID | head -n1 | cut -d '=' -f2 | cut -d '"' -f2)"
[ "$SUDO" = "" ] && { [ $(is_package_exists doas) = 1 ] && SUDO="doas" || SUDO="sudo"; } [ "$SUDO" = "" ] && { [ $(is_package_exists doas) = 1 ] && SUDO="doas" || SUDO="sudo"; }
PACMAN="${PACMAN:-pacman}" [ "$PACMAN" = "" ] && {
case $DISTRO in
"arch" ) PACMAN="pacman" ;;
"ubuntu" ) PACMAN="apt" ;;
esac
}
AUR="${AUR:-paru}" AUR="${AUR:-paru}"
update_package_db() { update_package_db() {
@ -81,12 +69,15 @@ echo "Updating package database..."
update_package_db update_package_db
echo "Installing packages..." echo "Installing packages..."
install_package $packages_arch install_package $packages
case $DISTRO in
[ $DISTRO = "arch" ] && { "arch" )
echo "Installing AUR packages..." install_package $packages_arch
install_aur_package $packages_arch_aur echo "Installing AUR packages..."
} install_aur_package $packages_arch_aur
;;
"ubuntu" ) install_package $packages_ubuntu ;;
esac
echo "Changing default shell to zsh..." echo "Changing default shell to zsh..."
$SUDO chsh -s $(which zsh) $SUDO chsh -s $(which zsh)

32
bootstrap-pkgs Normal file
View file

@ -0,0 +1,32 @@
#!/bin/sh
packages=(
git
zsh
# signing tools for Secure Boot
efitools
)
packages_ubuntu=(
# signing tools for Secure Boot
sbsigntool
)
packages_arch=(
opendoas
# >> for shell scripts
jo
bc
socat
jq
# << for shell scripts
ffmpeg
# required by firefox, without it firefox-based browser can't play video from certain website
ffmpeg4.4
# signing tools for Secure Boot
sbsigntools
)
packages_arch_aur=(
floorp-bin
)