Merge pull request #193 from nnyyxxxx/testing-2

Add Multi-Escalation support
This commit is contained in:
Chris Titus 2024-08-28 20:33:25 -05:00 committed by GitHub
commit 2d7c2ca14f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 150 additions and 119 deletions

View File

@ -7,10 +7,10 @@ setupAlacritty() {
if ! command_exists alacritty; then if ! command_exists alacritty; then
case ${PACKAGER} in case ${PACKAGER} in
pacman) pacman)
sudo ${PACKAGER} -S --needed --noconfirm alacritty $ESCALATION_TOOL ${PACKAGER} -S --needed --noconfirm alacritty
;; ;;
*) *)
sudo ${PACKAGER} install -y alacritty $ESCALATION_TOOL ${PACKAGER} install -y alacritty
;; ;;
esac esac
else else
@ -26,4 +26,5 @@ setupAlacritty() {
} }
checkEnv checkEnv
checkEscalationTool
setupAlacritty setupAlacritty

View File

@ -1,27 +1,27 @@
#!/bin/sh -e #!/bin/sh -e
. ../common-script.sh . ../common-script.sh
makeDWM(){ makeDWM() {
cd $HOME && git clone https://github.com/ChrisTitusTech/dwm-titus.git # CD to Home directory to install dwm-titus cd "$HOME" && git clone https://github.com/ChrisTitusTech/dwm-titus.git # CD to Home directory to install dwm-titus
# This path can be changed (e.g. to linux-toolbox directory) # This path can be changed (e.g. to linux-toolbox directory)
cd dwm-titus/ # Hardcoded path, maybe not the best. cd dwm-titus/ # Hardcoded path, maybe not the best.
sudo ./setup.sh # Run setup $ESCALATION_TOOL ./setup.sh # Run setup
sudo make clean install # Run make clean install $ESCALATION_TOOL make clean install # Run make clean install
} }
setupDWM() { setupDWM() {
echo "Installing DWM-Titus if not already installed" echo "Installing DWM-Titus if not already installed"
case "$PACKAGER" in # Install pre-Requisites case "$PACKAGER" in # Install pre-Requisites
pacman) pacman)
sudo "$PACKAGER" -S --needed --noconfirm base-devel libx11 libxinerama libxft imlib2 $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm base-devel libx11 libxinerama libxft imlib2
;; ;;
*) *)
sudo "$PACKAGER" install -y build-essential libx11-dev libxinerama-dev libxft-dev libimlib2-dev $ESCALATION_TOOL "$PACKAGER" install -y build-essential libx11-dev libxinerama-dev libxft-dev libimlib2-dev
;; ;;
esac esac
} }
checkEnv checkEnv
checkEscalationTool
setupDWM setupDWM
makeDWM makeDWM

View File

@ -7,10 +7,10 @@ setupKitty() {
if ! command_exists kitty; then if ! command_exists kitty; then
case ${PACKAGER} in case ${PACKAGER} in
pacman) pacman)
sudo "${PACKAGER}" -S --needed --noconfirm kitty $ESCALATION_TOOL "${PACKAGER}" -S --needed --noconfirm kitty
;; ;;
*) *)
sudo "${PACKAGER}" install -y kitty $ESCALATION_TOOL "${PACKAGER}" install -y kitty
;; ;;
esac esac
else else
@ -18,12 +18,13 @@ setupKitty() {
fi fi
echo "Copy Kitty config files" echo "Copy Kitty config files"
if [ -d "${HOME}/.config/kitty" ]; then if [ -d "${HOME}/.config/kitty" ]; then
cp -r "${HOME}"/.config/kitty "${HOME}"/.config/kitty-bak cp -r "${HOME}/.config/kitty" "${HOME}/.config/kitty-bak"
fi fi
mkdir -p "${HOME}"/.config/kitty/ mkdir -p "${HOME}/.config/kitty/"
wget -O "${HOME}"/.config/kitty/kitty.conf https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/kitty/kitty.conf wget -O "${HOME}/.config/kitty/kitty.conf" https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/kitty/kitty.conf
wget -O "${HOME}"/.config/kitty/nord.conf https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/kitty/nord.conf wget -O "${HOME}/.config/kitty/nord.conf" https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/kitty/nord.conf
} }
checkEnv checkEnv
checkEscalationTool
setupKitty setupKitty

View File

@ -7,10 +7,10 @@ setupRofi() {
if ! command_exists rofi; then if ! command_exists rofi; then
case "$PACKAGER" in case "$PACKAGER" in
pacman) pacman)
sudo "$PACKAGER" -S --needed --noconfirm rofi $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm rofi
;; ;;
*) *)
sudo "$PACKAGER" install -y rofi $ESCALATION_TOOL "$PACKAGER" install -y rofi
;; ;;
esac esac
else else
@ -31,4 +31,5 @@ setupRofi() {
} }
checkEnv checkEnv
checkEscalationTool
setupRofi setupRofi

View File

@ -8,10 +8,10 @@ install_zsh() {
if ! command_exists zsh; then if ! command_exists zsh; then
case "$PACKAGER" in case "$PACKAGER" in
pacman) pacman)
sudo "$PACKAGER" -S --needed --noconfirm zsh $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm zsh
;; ;;
*) *)
sudo "$PACKAGER" install -y zsh $ESCALATION_TOOL "$PACKAGER" install -y zsh
;; ;;
esac esac
else else
@ -43,9 +43,10 @@ RPROMPT='%F{15}(%F{166}%D{%H:%M}%F{15})%f'
EOL EOL
# Ensure /etc/zsh/zshenv sets ZDOTDIR to the user's config directory # Ensure /etc/zsh/zshenv sets ZDOTDIR to the user's config directory
echo 'export ZDOTDIR="$HOME/.config/zsh"' | sudo tee -a /etc/zsh/zshenv echo 'export ZDOTDIR="$HOME/.config/zsh"' | $ESCALATION_TOOL tee -a /etc/zsh/zshenv
} }
checkEnv checkEnv
setup_zsh_config checkEscalationTool
install_zsh install_zsh
setup_zsh_config

View File

@ -11,6 +11,23 @@ command_exists() {
which "$1" >/dev/null 2>&1 which "$1" >/dev/null 2>&1
} }
checkEscalationTool() {
## Check for escalation tools.
if [ -z "$ESCALATION_TOOL_CHECKED" ]; then
ESCALATION_TOOLS='sudo doas'
for tool in ${ESCALATION_TOOLS}; do
if command_exists "${tool}"; then
ESCALATION_TOOL=${tool}
echo "Using ${tool} for privilege escalation"
ESCALATION_TOOL_CHECKED=true
return 0
fi
done
echo -e "${RED}Can't find a supported escalation tool${RC}"
exit 1
fi
}
checkCommandRequirements() { checkCommandRequirements() {
## Check for requirements. ## Check for requirements.
@ -82,4 +99,5 @@ checkEnv() {
checkCurrentDirectoryWritable checkCurrentDirectoryWritable
checkSuperUser checkSuperUser
checkDistro checkDistro
checkEscalationTool
} }

View File

@ -7,10 +7,10 @@ installPkg() {
if ! command_exists ufw; then if ! command_exists ufw; then
case ${PACKAGER} in case ${PACKAGER} in
pacman) pacman)
sudo "${PACKAGER}" -S --needed --noconfirm ufw $ESCALATION_TOOL "${PACKAGER}" -S --needed --noconfirm ufw
;; ;;
*) *)
sudo "${PACKAGER}" install -y ufw $ESCALATION_TOOL "${PACKAGER}" install -y ufw
;; ;;
esac esac
else else
@ -22,27 +22,28 @@ configureUFW() {
echo -e "${GREEN}Using Chris Titus Recommended Firewall Rules${RC}" echo -e "${GREEN}Using Chris Titus Recommended Firewall Rules${RC}"
echo "Disabling UFW" echo "Disabling UFW"
sudo ufw disable $ESCALATION_TOOL ufw disable
echo "Limiting port 22/tcp (UFW)" echo "Limiting port 22/tcp (UFW)"
sudo ufw limit 22/tcp $ESCALATION_TOOL ufw limit 22/tcp
echo "Allowing port 80/tcp (UFW)" echo "Allowing port 80/tcp (UFW)"
sudo ufw allow 80/tcp $ESCALATION_TOOL ufw allow 80/tcp
echo "Allowing port 443/tcp (UFW)" echo "Allowing port 443/tcp (UFW)"
sudo ufw allow 443/tcp $ESCALATION_TOOL ufw allow 443/tcp
echo "Denying Incoming Packets by Default(UFW)" echo "Denying Incoming Packets by Default(UFW)"
sudo ufw default deny incoming $ESCALATION_TOOL ufw default deny incoming
echo "Allowing Outcoming Packets by Default(UFW)" echo "Allowing Outcoming Packets by Default(UFW)"
sudo ufw default allow outgoing $ESCALATION_TOOL ufw default allow outgoing
sudo ufw enable $ESCALATION_TOOL ufw enable
echo -e "${GREEN}Enabled Firewall with Baselines!${RC}" echo -e "${GREEN}Enabled Firewall with Baselines!${RC}"
} }
checkEnv checkEnv
checkEscalationTool
installPkg installPkg
configureUFW configureUFW

View File

@ -9,16 +9,16 @@ installDepend() {
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]" | sudo tee -a /etc/pacman.conf echo "[multilib]" | $ESCALATION_TOOL tee -a /etc/pacman.conf
echo "Include = /etc/pacman.d/mirrorlist" | sudo tee -a /etc/pacman.conf echo "Include = /etc/pacman.d/mirrorlist" | $ESCALATION_TOOL tee -a /etc/pacman.conf
sudo "$PACKAGER" -Syu $ESCALATION_TOOL "$PACKAGER" -Syu
else else
echo "Multilib is already enabled." echo "Multilib is already enabled."
fi fi
if ! command_exists yay && ! command_exists paru; then if ! command_exists yay && ! command_exists paru; then
echo "Installing yay as AUR helper..." echo "Installing yay as AUR helper..."
sudo "$PACKAGER" -S --needed --noconfirm base-devel $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm base-devel
cd /opt && sudo git clone https://aur.archlinux.org/yay-git.git && sudo chown -R "$USER":"$USER" ./yay-git cd /opt && $ESCALATION_TOOL git clone https://aur.archlinux.org/yay-git.git && $ESCALATION_TOOL chown -R "$USER":"$USER" ./yay-git
cd yay-git && makepkg --noconfirm -si cd yay-git && makepkg --noconfirm -si
else else
echo "Aur helper already installed" echo "Aur helper already installed"
@ -31,30 +31,30 @@ installDepend() {
echo "No AUR helper found. Please install yay or paru." echo "No AUR helper found. Please install yay or paru."
exit 1 exit 1
fi fi
"$AUR_HELPER" -S --needed --noconfirm "$DEPENDENCIES" $AUR_HELPER -S --needed --noconfirm "$DEPENDENCIES"
;; ;;
apt-get|nala) apt-get|nala)
COMPILEDEPS='build-essential' COMPILEDEPS='build-essential'
sudo "$PACKAGER" update $ESCALATION_TOOL "$PACKAGER" update
sudo dpkg --add-architecture i386 $ESCALATION_TOOL dpkg --add-architecture i386
sudo "$PACKAGER" update $ESCALATION_TOOL "$PACKAGER" update
sudo "$PACKAGER" install -y $DEPENDENCIES $COMPILEDEPS $ESCALATION_TOOL "$PACKAGER" install -y $DEPENDENCIES $COMPILEDEPS
;; ;;
dnf) dnf)
COMPILEDEPS='@development-tools' COMPILEDEPS='@development-tools'
sudo "$PACKAGER" update $ESCALATION_TOOL "$PACKAGER" update
sudo "$PACKAGER" config-manager --set-enabled powertools $ESCALATION_TOOL "$PACKAGER" config-manager --set-enabled powertools
sudo "$PACKAGER" install -y "$DEPENDENCIES" $COMPILEDEPS $ESCALATION_TOOL "$PACKAGER" install -y "$DEPENDENCIES" $COMPILEDEPS
sudo "$PACKAGER" install -y glibc-devel.i686 libgcc.i686 $ESCALATION_TOOL "$PACKAGER" install -y glibc-devel.i686 libgcc.i686
;; ;;
zypper) zypper)
COMPILEDEPS='patterns-devel-base-devel_basis' COMPILEDEPS='patterns-devel-base-devel_basis'
sudo "$PACKAGER" refresh $ESCALATION_TOOL "$PACKAGER" refresh
sudo "$PACKAGER" --non-interactive install "$DEPENDENCIES" $COMPILEDEPS $ESCALATION_TOOL "$PACKAGER" --non-interactive install "$DEPENDENCIES" $COMPILEDEPS
sudo "$PACKAGER" --non-interactive install libgcc_s1-gcc7-32bit glibc-devel-32bit $ESCALATION_TOOL "$PACKAGER" --non-interactive install libgcc_s1-gcc7-32bit glibc-devel-32bit
;; ;;
*) *)
sudo "$PACKAGER" install -y $DEPENDENCIES # Fixed bug where no packages found on debian-based $ESCALATION_TOOL "$PACKAGER" install -y $DEPENDENCIES # Fixed bug where no packages found on debian-based
;; ;;
esac esac
} }
@ -80,5 +80,6 @@ install_additional_dependencies() {
} }
checkEnv checkEnv
checkEscalationTool
installDepend installDepend
install_additional_dependencies install_additional_dependencies

View File

@ -7,16 +7,16 @@ installDepend() {
echo -e "${YELLOW}Installing dependencies...${RC}" echo -e "${YELLOW}Installing dependencies...${RC}"
if [ "$PACKAGER" = "pacman" ]; then if [ "$PACKAGER" = "pacman" ]; then
if ! grep -q "^\s*\[multilib\]" /etc/pacman.conf; then if ! grep -q "^\s*\[multilib\]" /etc/pacman.conf; then
echo "[multilib]" | sudo tee -a /etc/pacman.conf echo "[multilib]" | $ESCALATION_TOOL tee -a /etc/pacman.conf
echo "Include = /etc/pacman.d/mirrorlist" | sudo tee -a /etc/pacman.conf echo "Include = /etc/pacman.d/mirrorlist" | $ESCALATION_TOOL tee -a /etc/pacman.conf
sudo ${PACKAGER} -Syu $ESCALATION_TOOL ${PACKAGER} -Syu
else else
echo "Multilib is already enabled." echo "Multilib is already enabled."
fi fi
if ! command_exists yay && ! command_exists paru; then if ! command_exists yay && ! command_exists paru; then
echo "Installing yay as AUR helper..." echo "Installing yay as AUR helper..."
sudo ${PACKAGER} -S --needed --noconfirm base-devel $ESCALATION_TOOL ${PACKAGER} -S --needed --noconfirm base-devel
cd /opt && sudo git clone https://aur.archlinux.org/yay-git.git && sudo chown -R ${USER}:${USER} ./yay-git cd /opt && $ESCALATION_TOOL git clone https://aur.archlinux.org/yay-git.git && $ESCALATION_TOOL chown -R ${USER}:${USER} ./yay-git
cd yay-git && makepkg --noconfirm -si cd yay-git && makepkg --noconfirm -si
else else
echo "Aur helper already installed" echo "Aur helper already installed"
@ -29,24 +29,24 @@ installDepend() {
echo "No AUR helper found. Please install yay or paru." echo "No AUR helper found. Please install yay or paru."
exit 1 exit 1
fi fi
${AUR_HELPER} -S --needed --noconfirm wine giflib lib32-giflib libpng lib32-libpng libldap lib32-libldap gnutls lib32-gnutls \ $AUR_HELPER -S --needed --noconfirm wine giflib lib32-giflib libpng lib32-libpng libldap lib32-libldap gnutls lib32-gnutls \
mpg123 lib32-mpg123 openal lib32-openal v4l-utils lib32-v4l-utils libpulse lib32-libpulse libgpg-error \ mpg123 lib32-mpg123 openal lib32-openal v4l-utils lib32-v4l-utils libpulse lib32-libpulse libgpg-error \
lib32-libgpg-error alsa-plugins lib32-alsa-plugins alsa-lib lib32-alsa-lib libjpeg-turbo lib32-libjpeg-turbo \ lib32-libgpg-error alsa-plugins lib32-alsa-plugins alsa-lib lib32-alsa-lib libjpeg-turbo lib32-libjpeg-turbo \
sqlite lib32-sqlite libxcomposite lib32-libxcomposite libxinerama lib32-libgcrypt libgcrypt lib32-libxinerama \ sqlite lib32-sqlite libxcomposite lib32-libxcomposite libxinerama lib32-libgcrypt libgcrypt lib32-libxinerama \
ncurses lib32-ncurses ocl-icd lib32-ocl-icd libxslt lib32-libxslt libva lib32-libva gtk3 \ ncurses lib32-ncurses ocl-icd lib32-ocl-icd libxslt lib32-libxslt libva lib32-libva gtk3 \
lib32-gtk3 gst-plugins-base-libs lib32-gst-plugins-base-libs vulkan-icd-loader lib32-vulkan-icd-loader lib32-gtk3 gst-plugins-base-libs lib32-gst-plugins-base-libs vulkan-icd-loader lib32-vulkan-icd-loader
elif [ "$PACKAGER" = "apt-get" ]; then elif [ "$PACKAGER" = "apt-get" ]; then
sudo ${PACKAGER} update $ESCALATION_TOOL ${PACKAGER} update
sudo ${PACKAGER} install -y wine64 wine32 libasound2-plugins:i386 libsdl2-2.0-0:i386 libdbus-1-3:i386 libsqlite3-0:i386 $ESCALATION_TOOL ${PACKAGER} install -y wine64 wine32 libasound2-plugins:i386 libsdl2-2.0-0:i386 libdbus-1-3:i386 libsqlite3-0:i386
elif [ "$PACKAGER" = "dnf" ] || [ "$PACKAGER" = "zypper" ]; then elif [ "$PACKAGER" = "dnf" ] || [ "$PACKAGER" = "zypper" ]; then
sudo ${PACKAGER} install -y wine $ESCALATION_TOOL ${PACKAGER} install -y wine
else else
sudo ${PACKAGER} install -y ${DEPENDENCIES} $ESCALATION_TOOL ${PACKAGER} install -y ${DEPENDENCIES}
fi fi
} }
install_additional_dependencies() { install_additional_dependencies() {
case $(which apt-get || which zypper || which dnf || which pacman) in case $(command -v apt-get || command -v zypper || command -v dnf || command -v pacman) in
*apt-get) *apt-get)
version=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/lutris/lutris | version=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/lutris/lutris |
grep -v 'beta' | grep -v 'beta' |
@ -58,8 +58,8 @@ install_additional_dependencies() {
# Install the downloaded .deb package using apt-get # Install the downloaded .deb package using apt-get
echo "Installing lutris_${version_no_v}_all.deb" echo "Installing lutris_${version_no_v}_all.deb"
sudo apt-get update $ESCALATION_TOOL apt-get update
sudo apt-get install ./lutris_${version_no_v}_all.deb $ESCALATION_TOOL apt-get install ./lutris_${version_no_v}_all.deb
# Clean up the downloaded .deb file # Clean up the downloaded .deb file
rm lutris_${version_no_v}_all.deb rm lutris_${version_no_v}_all.deb
@ -70,34 +70,35 @@ install_additional_dependencies() {
#Install steam on Debian #Install steam on Debian
if (lsb_release -i | grep -qi Debian); then if (lsb_release -i | grep -qi Debian); then
#Enable i386 repos #Enable i386 repos
sudo dpkg --add-architecture i386 $ESCALATION_TOOL dpkg --add-architecture i386
# Install software-properties-common to be able to add repos # Install software-properties-common to be able to add repos
sudo apt-get install -y software-properties-common $ESCALATION_TOOL apt-get install -y software-properties-common
# Add repos necessary for installing steam # Add repos necessary for installing steam
sudo apt-add-repository contrib -y $ESCALATION_TOOL apt-add-repository contrib -y
sudo apt-add-repository non-free -y $ESCALATION_TOOL apt-add-repository non-free -y
#Install steam #Install steam
sudo apt-get install steam-installer -y $ESCALATION_TOOL apt-get install steam-installer -y
else else
#Install steam on Ubuntu #Install steam on Ubuntu
sudo apt-get install -y steam $ESCALATION_TOOL apt-get install -y steam
fi fi
;; ;;
*zypper) *zypper)
;; ;;
*dnf) *dnf)
;; ;;
*pacman) *pacman)
;; ;;
*) *)
;; ;;
esac esac
} }
checkEnv checkEnv
checkEscalationTool
installDepend installDepend
install_additional_dependencies install_additional_dependencies

View File

@ -6,19 +6,19 @@ install_theme_tools() {
printf "${YELLOW}Installing theme tools (qt6ct and kvantum)...${RC}\n" printf "${YELLOW}Installing theme tools (qt6ct and kvantum)...${RC}\n"
case $PACKAGER in case $PACKAGER in
apt-get) apt-get)
sudo apt-get update $ESCALATION_TOOL apt-get update
sudo apt-get install -y qt6ct kvantum $ESCALATION_TOOL apt-get install -y qt6ct kvantum
;; ;;
zypper) zypper)
sudo zypper refresh $ESCALATION_TOOL zypper refresh
sudo zypper --non-interactive install qt6ct kvantum $ESCALATION_TOOL zypper --non-interactive install qt6ct kvantum
;; ;;
dnf) dnf)
sudo dnf update $ESCALATION_TOOL dnf update
sudo dnf install -y qt6ct kvantum $ESCALATION_TOOL dnf install -y qt6ct kvantum
;; ;;
pacman) pacman)
sudo pacman -S --needed --noconfirm qt6ct kvantum $ESCALATION_TOOL pacman -S --needed --noconfirm qt6ct kvantum
;; ;;
*) *)
printf "${RED}Unsupported package manager. Please install qt6ct and kvantum manually.${RC}\n" printf "${RED}Unsupported package manager. Please install qt6ct and kvantum manually.${RC}\n"
@ -41,7 +41,7 @@ EOF
# Add QT_QPA_PLATFORMTHEME to /etc/environment # Add QT_QPA_PLATFORMTHEME to /etc/environment
if ! grep -q "QT_QPA_PLATFORMTHEME=qt6ct" /etc/environment; then if ! grep -q "QT_QPA_PLATFORMTHEME=qt6ct" /etc/environment; then
printf "${YELLOW}Adding QT_QPA_PLATFORMTHEME to /etc/environment...${RC}\n" printf "${YELLOW}Adding QT_QPA_PLATFORMTHEME to /etc/environment...${RC}\n"
echo "QT_QPA_PLATFORMTHEME=qt6ct" | sudo tee -a /etc/environment > /dev/null echo "QT_QPA_PLATFORMTHEME=qt6ct" | $ESCALATION_TOOL tee -a /etc/environment > /dev/null
printf "${GREEN}QT_QPA_PLATFORMTHEME added to /etc/environment.${RC}\n" printf "${GREEN}QT_QPA_PLATFORMTHEME added to /etc/environment.${RC}\n"
else else
printf "${GREEN}QT_QPA_PLATFORMTHEME already set in /etc/environment.${RC}\n" printf "${GREEN}QT_QPA_PLATFORMTHEME already set in /etc/environment.${RC}\n"
@ -59,6 +59,7 @@ EOF
} }
checkEnv checkEnv
checkEscalationTool
install_theme_tools install_theme_tools
configure_qt6ct configure_qt6ct
configure_kvantum configure_kvantum

View File

@ -5,24 +5,26 @@
removeSnaps() { removeSnaps() {
case $PACKAGER in case $PACKAGER in
pacman) pacman)
sudo ${PACKAGER} -Rns snapd $ESCALATION_TOOL ${PACKAGER} -Rns snapd
;; ;;
apt-get|nala) apt-get|nala)
sudo ${PACKAGER} autoremove --purge snapd $ESCALATION_TOOL ${PACKAGER} autoremove --purge snapd
if [ "$ID" = ubuntu ]; then if [ "$ID" = ubuntu ]; then
sudo apt-mark hold snapd $ESCALATION_TOOL apt-mark hold snapd
fi fi
;; ;;
dnf) dnf)
sudo ${PACKAGER} remove snapd $ESCALATION_TOOL ${PACKAGER} remove snapd
;; ;;
zypper) zypper)
sudo ${PACKAGER} remove snapd $ESCALATION_TOOL ${PACKAGER} remove snapd
;; ;;
*) *)
echo "removing snapd not implemented for this package manager" echo "Removing snapd not implemented for this package manager"
;;
esac esac
} }
checkEnv checkEnv
checkEscalationTool
removeSnaps removeSnaps

View File

@ -7,8 +7,8 @@ installDepend() {
pacman) pacman)
if ! command_exists paru; then if ! command_exists paru; then
echo "Installing paru as AUR helper..." echo "Installing paru as AUR helper..."
sudo "$PACKAGER" -S --needed --noconfirm base-devel $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm base-devel
cd /opt && sudo git clone https://aur.archlinux.org/paru.git && sudo chown -R "$USER": ./paru cd /opt && $ESCALATION_TOOL git clone https://aur.archlinux.org/paru.git && $ESCALATION_TOOL chown -R "$USER": ./paru
cd paru && makepkg --noconfirm -si cd paru && makepkg --noconfirm -si
echo "Paru installed" echo "Paru installed"
else else
@ -22,4 +22,5 @@ installDepend() {
} }
checkEnv checkEnv
installDepend checkEscalationTool
installDepend

View File

@ -7,8 +7,8 @@ installDepend() {
pacman) pacman)
if ! command_exists yay; then if ! command_exists yay; then
echo "Installing yay as AUR helper..." echo "Installing yay as AUR helper..."
sudo "$PACKAGER" -S --needed --noconfirm base-devel $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm base-devel
cd /opt && sudo git clone https://aur.archlinux.org/yay-git.git && sudo chown -R "$USER": ./yay-git cd /opt && $ESCALATION_TOOL git clone https://aur.archlinux.org/yay-git.git && $ESCALATION_TOOL chown -R "$USER": ./yay-git
cd yay-git && makepkg --noconfirm -si cd yay-git && makepkg --noconfirm -si
echo "Yay installed" echo "Yay installed"
else else
@ -22,4 +22,5 @@ installDepend() {
} }
checkEnv checkEnv
installDepend checkEscalationTool
installDepend

View File

@ -7,8 +7,8 @@ fastUpdate() {
pacman) pacman)
if ! command_exists yay && ! command_exists paru; then if ! command_exists yay && ! command_exists paru; then
echo "Installing yay as AUR helper..." echo "Installing yay as AUR helper..."
sudo ${PACKAGER} -S --needed --noconfirm base-devel || { echo -e "${RED}Failed to install base-devel${RC}"; exit 1; } $ESCALATION_TOOL ${PACKAGER} -S --needed --noconfirm base-devel || { echo -e "${RED}Failed to install base-devel${RC}"; exit 1; }
cd /opt && sudo git clone https://aur.archlinux.org/yay-git.git && sudo chown -R ${USER}:${USER} ./yay-git cd /opt && $ESCALATION_TOOL git clone https://aur.archlinux.org/yay-git.git && $ESCALATION_TOOL chown -R ${USER}:${USER} ./yay-git
cd yay-git && makepkg --noconfirm -si || { echo -e "${RED}Failed to install yay${RC}"; exit 1; } cd yay-git && makepkg --noconfirm -si || { echo -e "${RED}Failed to install yay${RC}"; exit 1; }
else else
echo "Aur helper already installed" echo "Aur helper already installed"
@ -21,9 +21,9 @@ fastUpdate() {
echo "No AUR helper found. Please install yay or paru." echo "No AUR helper found. Please install yay or paru."
exit 1 exit 1
fi fi
${AUR_HELPER} -S --needed --noconfirm rate-mirrors-bin $AUR_HELPER -S --needed --noconfirm rate-mirrors-bin
if [ -s /etc/pacman.d/mirrorlist ]; then if [ -s /etc/pacman.d/mirrorlist ]; then
sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak $ESCALATION_TOOL cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
fi fi
# If for some reason DTYPE is still unknown use always arch so the rate-mirrors does not fail # If for some reason DTYPE is still unknown use always arch so the rate-mirrors does not fail
@ -31,33 +31,33 @@ fastUpdate() {
if [ "${DTYPE}" = "unknown" ]; then if [ "${DTYPE}" = "unknown" ]; then
dtype_local="arch" dtype_local="arch"
fi fi
sudo rate-mirrors --top-mirrors-number-to-retest=5 --disable-comments --save /etc/pacman.d/mirrorlist --allow-root ${dtype_local} $ESCALATION_TOOL rate-mirrors --top-mirrors-number-to-retest=5 --disable-comments --save /etc/pacman.d/mirrorlist --allow-root ${dtype_local}
;; ;;
apt-get|nala) apt-get|nala)
sudo apt-get update $ESCALATION_TOOL apt-get update
if ! command_exists nala; then if ! command_exists nala; then
sudo apt-get install -y nala || { echo -e "${YELLOW}Falling back to apt-get${RC}"; PACKAGER="apt-get"; } $ESCALATION_TOOL apt-get install -y nala || { echo -e "${YELLOW}Falling back to apt-get${RC}"; PACKAGER="apt-get"; }
fi fi
if [ "${PACKAGER}" = "nala" ]; then if [ "${PACKAGER}" = "nala" ]; then
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak $ESCALATION_TOOL cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo nala update $ESCALATION_TOOL nala update
PACKAGER="nala" PACKAGER="nala"
fi fi
sudo ${PACKAGER} upgrade -y $ESCALATION_TOOL ${PACKAGER} upgrade -y
;; ;;
dnf) dnf)
sudo ${PACKAGER} update -y $ESCALATION_TOOL ${PACKAGER} update -y
;; ;;
zypper) zypper)
sudo ${PACKAGER} ref $ESCALATION_TOOL ${PACKAGER} ref
sudo ${PACKAGER} --non-interactive dup $ESCALATION_TOOL ${PACKAGER} --non-interactive dup
;; ;;
yum) yum)
sudo ${PACKAGER} update -y $ESCALATION_TOOL ${PACKAGER} update -y
sudo ${PACKAGER} upgrade -y $ESCALATION_TOOL ${PACKAGER} upgrade -y
;; ;;
xbps-install) xbps-install)
sudo ${PACKAGER} -Syu $ESCALATION_TOOL ${PACKAGER} -Syu
;; ;;
*) *)
echo -e "${RED}Unsupported package manager: $PACKAGER${RC}" echo -e "${RED}Unsupported package manager: $PACKAGER${RC}"
@ -70,23 +70,23 @@ updateSystem() {
echo -e "${GREEN}Updating system${RC}" echo -e "${GREEN}Updating system${RC}"
case ${PACKAGER} in case ${PACKAGER} in
nala|apt-get) nala|apt-get)
sudo "${PACKAGER}" update -y $ESCALATION_TOOL "${PACKAGER}" update -y
sudo "${PACKAGER}" upgrade -y $ESCALATION_TOOL "${PACKAGER}" upgrade -y
;; ;;
yum|dnf) yum|dnf)
sudo "${PACKAGER}" update -y $ESCALATION_TOOL "${PACKAGER}" update -y
sudo "${PACKAGER}" upgrade -y $ESCALATION_TOOL "${PACKAGER}" upgrade -y
;; ;;
pacman) pacman)
sudo "${PACKAGER}" -Sy --noconfirm --needed archlinux-keyring $ESCALATION_TOOL "${PACKAGER}" -Sy --noconfirm --needed archlinux-keyring
sudo "${PACKAGER}" -Su --noconfirm $ESCALATION_TOOL "${PACKAGER}" -Su --noconfirm
;; ;;
zypper) zypper)
sudo ${PACKAGER} ref $ESCALATION_TOOL ${PACKAGER} ref
sudo ${PACKAGER} --non-interactive dup $ESCALATION_TOOL ${PACKAGER} --non-interactive dup
;; ;;
xbps-install) xbps-install)
sudo ${PACKAGER} -Syu $ESCALATION_TOOL ${PACKAGER} -Syu
;; ;;
*) *)
echo -e "${RED}Unsupported package manager: ${PACKAGER}${RC}" echo -e "${RED}Unsupported package manager: ${PACKAGER}${RC}"
@ -102,6 +102,7 @@ updateFlatpaks() {
} }
checkEnv checkEnv
checkEscalationTool
fastUpdate fastUpdate
updateSystem updateSystem
updateFlatpaks updateFlatpaks