Merge pull request #422 from jeevithakannan2/nala

refactor: apt-get with nala and hardcoded package managers
This commit is contained in:
Chris Titus 2024-09-18 13:26:36 -05:00 committed by GitHub
commit 88468b112a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 69 additions and 65 deletions

View File

@ -5,12 +5,12 @@
installAlacritty() { installAlacritty() {
echo "Installing Alacritty..." echo "Installing Alacritty..."
if ! command_exists alacritty; then if ! command_exists alacritty; then
case ${PACKAGER} in case "$PACKAGER" in
pacman) pacman)
$ESCALATION_TOOL ${PACKAGER} -S --needed --noconfirm alacritty $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm alacritty
;; ;;
*) *)
$ESCALATION_TOOL ${PACKAGER} install -y alacritty $ESCALATION_TOOL "$PACKAGER" install -y alacritty
;; ;;
esac esac
else else

View File

@ -6,12 +6,12 @@ installFastfetch() {
printf "%b\n" "${YELLOW}Installing Fastfetch if not already installed...${RC}" printf "%b\n" "${YELLOW}Installing Fastfetch if not already installed...${RC}"
if ! command_exists fastfetch; then if ! command_exists fastfetch; then
case ${PACKAGER} in case "$PACKAGER" in
pacman) pacman)
$ESCALATION_TOOL "${PACKAGER}" -S --needed --noconfirm fastfetch $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm fastfetch
;; ;;
*) *)
$ESCALATION_TOOL "${PACKAGER}" install -y fastfetch $ESCALATION_TOOL "$PACKAGER" install -y fastfetch
;; ;;
esac esac
else else

View File

@ -5,12 +5,12 @@
installKitty() { installKitty() {
printf "%b\n" "${YELLOW}Install Kitty if not already installed...${RC}" printf "%b\n" "${YELLOW}Install Kitty if not already installed...${RC}"
if ! command_exists kitty; then if ! command_exists kitty; then
case ${PACKAGER} in case "$PACKAGER" in
pacman) pacman)
$ESCALATION_TOOL "${PACKAGER}" -S --needed --noconfirm kitty $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm kitty
;; ;;
*) *)
$ESCALATION_TOOL "${PACKAGER}" install -y kitty $ESCALATION_TOOL "$PACKAGER" install -y kitty
;; ;;
esac esac
else else

View File

@ -82,7 +82,7 @@ checkPackageManager() {
fi fi
done done
if [ -z "${PACKAGER}" ]; then if [ -z "$PACKAGER" ]; then
printf "%b\n" "${RED}Can't find a supported package manager${RC}" printf "%b\n" "${RED}Can't find a supported package manager${RC}"
exit 1 exit 1
fi fi
@ -126,7 +126,7 @@ checkDistro() {
checkEnv() { checkEnv() {
checkCommandRequirements 'curl groups sudo' checkCommandRequirements 'curl groups sudo'
checkPackageManager 'apt-get nala dnf pacman zypper yum xbps-install nix-env' checkPackageManager 'nala apt-get dnf pacman zypper yum xbps-install nix-env'
checkCurrentDirectoryWritable checkCurrentDirectoryWritable
checkSuperUser checkSuperUser
checkDistro checkDistro

View File

@ -5,12 +5,12 @@
installPkg() { installPkg() {
echo "Installing UFW..." echo "Installing UFW..."
if ! command_exists ufw; then if ! command_exists ufw; then
case ${PACKAGER} in case "$PACKAGER" in
pacman) pacman)
$ESCALATION_TOOL "${PACKAGER}" -S --needed --noconfirm ufw $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm ufw
;; ;;
*) *)
$ESCALATION_TOOL "${PACKAGER}" install -y ufw $ESCALATION_TOOL "$PACKAGER" install -y ufw
;; ;;
esac esac
else else

View File

@ -6,7 +6,7 @@ installDepend() {
## Check for dependencies. ## Check for dependencies.
DEPENDENCIES='tar tree multitail tldr trash-cli unzip cmake make jq' DEPENDENCIES='tar tree multitail tldr trash-cli unzip cmake make jq'
printf "%b\n" "${YELLOW}Installing dependencies...${RC}" printf "%b\n" "${YELLOW}Installing dependencies...${RC}"
case $PACKAGER in case "$PACKAGER" in
pacman) pacman)
if ! grep -q "^\s*\[multilib\]" /etc/pacman.conf; then if ! grep -q "^\s*\[multilib\]" /etc/pacman.conf; then
echo "[multilib]" | $ESCALATION_TOOL tee -a /etc/pacman.conf echo "[multilib]" | $ESCALATION_TOOL tee -a /etc/pacman.conf

View File

@ -4,21 +4,21 @@
install_theme_tools() { install_theme_tools() {
printf "%b\n" "${YELLOW}Installing theme tools (qt6ct and kvantum)...${RC}\n" printf "%b\n" "${YELLOW}Installing theme tools (qt6ct and kvantum)...${RC}\n"
case $PACKAGER in case "$PACKAGER" in
apt-get) apt-get|nala)
$ESCALATION_TOOL apt-get update $ESCALATION_TOOL "$PACKAGER" update
$ESCALATION_TOOL apt-get install -y qt6ct kvantum $ESCALATION_TOOL "$PACKAGER" install -y qt6ct kvantum
;; ;;
zypper) zypper)
$ESCALATION_TOOL zypper refresh $ESCALATION_TOOL "$PACKAGER" refresh
$ESCALATION_TOOL zypper --non-interactive install qt6ct kvantum $ESCALATION_TOOL "$PACKAGER" --non-interactive install qt6ct kvantum
;; ;;
dnf) dnf)
$ESCALATION_TOOL dnf update $ESCALATION_TOOL "$PACKAGER" update
$ESCALATION_TOOL dnf install -y qt6ct kvantum $ESCALATION_TOOL "$PACKAGER" install -y qt6ct kvantum
;; ;;
pacman) pacman)
$ESCALATION_TOOL pacman -S --needed --noconfirm qt6ct kvantum $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm qt6ct kvantum
;; ;;
*) *)
printf "%b\n" "${RED}Unsupported package manager. Please install qt6ct and kvantum manually.${RC}\n" printf "%b\n" "${RED}Unsupported package manager. Please install qt6ct and kvantum manually.${RC}\n"

View File

@ -3,21 +3,21 @@
. ../common-script.sh . ../common-script.sh
removeSnaps() { removeSnaps() {
case $PACKAGER in case "$PACKAGER" in
pacman) pacman)
$ESCALATION_TOOL ${PACKAGER} -Rns snapd $ESCALATION_TOOL "$PACKAGER" -Rns snapd
;; ;;
apt-get|nala) apt-get|nala)
$ESCALATION_TOOL ${PACKAGER} autoremove --purge snapd $ESCALATION_TOOL "$PACKAGER" autoremove --purge snapd
if [ "$ID" = ubuntu ]; then if [ "$ID" = ubuntu ]; then
$ESCALATION_TOOL apt-mark hold snapd $ESCALATION_TOOL apt-mark hold snapd
fi fi
;; ;;
dnf) dnf)
$ESCALATION_TOOL ${PACKAGER} remove snapd $ESCALATION_TOOL "$PACKAGER" remove snapd
;; ;;
zypper) zypper)
$ESCALATION_TOOL ${PACKAGER} remove snapd $ESCALATION_TOOL "$PACKAGER" remove snapd
;; ;;
*) *)
printf "%b\n" "${RED}Removing snapd not implemented for this package manager${RC}" printf "%b\n" "${RED}Removing snapd not implemented for this package manager${RC}"

View File

@ -3,7 +3,7 @@
. ../../common-script.sh . ../../common-script.sh
installDepend() { installDepend() {
case $PACKAGER in case "$PACKAGER" in
pacman) pacman)
if ! command_exists paru; then if ! command_exists paru; then
echo "Installing paru as AUR helper..." echo "Installing paru as AUR helper..."

View File

@ -3,7 +3,7 @@
. ../../common-script.sh . ../../common-script.sh
installDepend() { installDepend() {
case $PACKAGER in case "$PACKAGER" in
pacman) pacman)
if ! command_exists yay; then if ! command_exists yay; then
echo "Installing yay as AUR helper..." echo "Installing yay as AUR helper..."

View File

@ -5,7 +5,7 @@
# https://rpmfusion.org/Configuration # https://rpmfusion.org/Configuration
installRPMFusion() { installRPMFusion() {
case $PACKAGER in case "$PACKAGER" in
dnf) dnf)
if [ ! -e /etc/yum.repos.d/rpmfusion-free.repo ] || [ ! -e /etc/yum.repos.d/rpmfusion-nonfree.repo ]; then if [ ! -e /etc/yum.repos.d/rpmfusion-free.repo ] || [ ! -e /etc/yum.repos.d/rpmfusion-nonfree.repo ]; then
echo "Installing RPM Fusion..." echo "Installing RPM Fusion..."

View File

@ -3,7 +3,7 @@
. ../common-script.sh . ../common-script.sh
fastUpdate() { fastUpdate() {
case ${PACKAGER} in case "$PACKAGER" in
pacman) pacman)
$AUR_HELPER -S --needed --noconfirm rate-mirrors-bin $AUR_HELPER -S --needed --noconfirm rate-mirrors-bin
@ -31,27 +31,27 @@ fastUpdate() {
$ESCALATION_TOOL apt-get install -y nala || { printf "%b\n" "${YELLOW}Falling back to apt-get${RC}"; PACKAGER="apt-get"; } $ESCALATION_TOOL apt-get install -y nala || { printf "%b\n" "${YELLOW}Falling back to apt-get${RC}"; PACKAGER="apt-get"; }
fi fi
if [ "${PACKAGER}" = "nala" ]; then if [ "$PACKAGER" = "nala" ]; then
$ESCALATION_TOOL cp /etc/apt/sources.list /etc/apt/sources.list.bak $ESCALATION_TOOL cp /etc/apt/sources.list /etc/apt/sources.list.bak
$ESCALATION_TOOL nala update $ESCALATION_TOOL nala update
PACKAGER="nala" PACKAGER="nala"
fi fi
$ESCALATION_TOOL ${PACKAGER} upgrade -y $ESCALATION_TOOL "$PACKAGER" upgrade -y
;; ;;
dnf) dnf)
$ESCALATION_TOOL ${PACKAGER} update -y $ESCALATION_TOOL "$PACKAGER" update -y
;; ;;
zypper) zypper)
$ESCALATION_TOOL ${PACKAGER} ref $ESCALATION_TOOL "$PACKAGER" ref
$ESCALATION_TOOL ${PACKAGER} --non-interactive dup $ESCALATION_TOOL "$PACKAGER" --non-interactive dup
;; ;;
yum) yum)
$ESCALATION_TOOL ${PACKAGER} update -y $ESCALATION_TOOL "$PACKAGER" update -y
$ESCALATION_TOOL ${PACKAGER} upgrade -y $ESCALATION_TOOL "$PACKAGER" upgrade -y
;; ;;
xbps-install) xbps-install)
$ESCALATION_TOOL ${PACKAGER} -Syu $ESCALATION_TOOL "$PACKAGER" -Syu
;; ;;
*) *)
printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}" printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}"
@ -61,26 +61,26 @@ fastUpdate() {
} }
updateSystem() { updateSystem() {
printf "%b\n" "${YELLOW}Updating system${RC}" printf "%b\n" "${GREEN}Updating system${RC}"
case ${PACKAGER} in case "$PACKAGER" in
nala|apt-get) nala|apt-get)
$ESCALATION_TOOL "${PACKAGER}" update -y $ESCALATION_TOOL "$PACKAGER" update -y
$ESCALATION_TOOL "${PACKAGER}" upgrade -y $ESCALATION_TOOL "$PACKAGER" upgrade -y
;; ;;
yum|dnf) yum|dnf)
$ESCALATION_TOOL "${PACKAGER}" update -y $ESCALATION_TOOL "$PACKAGER" update -y
$ESCALATION_TOOL "${PACKAGER}" upgrade -y $ESCALATION_TOOL "$PACKAGER" upgrade -y
;; ;;
pacman) pacman)
$ESCALATION_TOOL "${PACKAGER}" -Sy --noconfirm --needed archlinux-keyring $ESCALATION_TOOL "$PACKAGER" -Sy --noconfirm --needed archlinux-keyring
$ESCALATION_TOOL "${PACKAGER}" -Su --noconfirm $ESCALATION_TOOL "$PACKAGER" -Su --noconfirm
;; ;;
zypper) zypper)
$ESCALATION_TOOL ${PACKAGER} ref $ESCALATION_TOOL "$PACKAGER" ref
$ESCALATION_TOOL ${PACKAGER} --non-interactive dup $ESCALATION_TOOL "$PACKAGER" --non-interactive dup
;; ;;
xbps-install) xbps-install)
$ESCALATION_TOOL ${PACKAGER} -Syu $ESCALATION_TOOL "$PACKAGER" -Syu
;; ;;
*) *)
printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}" printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}"

View File

@ -6,12 +6,12 @@
setupBluetooth() { setupBluetooth() {
printf "%b\n" "${YELLOW}Installing Bluez...${RC}" printf "%b\n" "${YELLOW}Installing Bluez...${RC}"
if ! command_exists bluetoothctl; then if ! command_exists bluetoothctl; then
case ${PACKAGER} in case "$PACKAGER" in
pacman) pacman)
$ESCALATION_TOOL "${PACKAGER}" -S --noconfirm bluez-utils $ESCALATION_TOOL "$PACKAGER" -S --noconfirm bluez-utils
;; ;;
*) *)
$ESCALATION_TOOL "${PACKAGER}" install -y bluez $ESCALATION_TOOL "$PACKAGER" install -y bluez
;; ;;
esac esac
else else
@ -147,5 +147,6 @@ remove_device() {
# Initialize # Initialize
checkEnv checkEnv
checkEscalationTool
setupBluetooth setupBluetooth
main_menu main_menu

View File

@ -6,15 +6,15 @@
setup_xrandr() { setup_xrandr() {
echo "Install xrandr if not already installed..." echo "Install xrandr if not already installed..."
if ! command_exists xrandr; then if ! command_exists xrandr; then
case ${PACKAGER} in case "$PACKAGER" in
pacman) pacman)
$ESCALATION_TOOL "${PACKAGER}" -S --noconfirm xorg-xrandr $ESCALATION_TOOL "$PACKAGER" -S --noconfirm xorg-xrandr
;; ;;
apt-get) apt-get|nala)
$ESCALATION_TOOL "${PACKAGER}" install -y x11-xserver-utils $ESCALATION_TOOL "$PACKAGER" install -y x11-xserver-utils
;; ;;
*) *)
$ESCALATION_TOOL "${PACKAGER}" install -y xorg-x11-server-utils $ESCALATION_TOOL "$PACKAGER" install -y xorg-x11-server-utils
;; ;;
esac esac
else else
@ -90,4 +90,5 @@ confirm_action() {
} }
checkEnv checkEnv
checkEscalationTool
setup_xrandr setup_xrandr

View File

@ -60,5 +60,6 @@ numlockSetup() {
fi fi
} }
checkEnv
checkEscalationTool checkEscalationTool
numlockSetup numlockSetup

View File

@ -6,15 +6,15 @@
setupNetworkManager() { setupNetworkManager() {
printf "%b\n" "${YELLOW}Installing NetworkManager...${RC}" printf "%b\n" "${YELLOW}Installing NetworkManager...${RC}"
if ! command_exists nmcli; then if ! command_exists nmcli; then
case ${PACKAGER} in case "$PACKAGER" in
pacman) pacman)
$ESCALATION_TOOL "${PACKAGER}" -S --noconfirm networkmanager $ESCALATION_TOOL "$PACKAGER" -S --noconfirm networkmanager
;; ;;
dnf) dnf)
$ESCALATION_TOOL "${PACKAGER}" install -y NetworkManager-1 $ESCALATION_TOOL "$PACKAGER" install -y NetworkManager-1
;; ;;
*) *)
$ESCALATION_TOOL "${PACKAGER}" install -y network-manager $ESCALATION_TOOL "$PACKAGER" install -y network-manager
;; ;;
esac esac
else else
@ -186,5 +186,6 @@ remove_network() {
# Initialize # Initialize
checkEnv checkEnv
checkEscalationTool
setupNetworkManager setupNetworkManager
main_menu main_menu