mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-05 21:28:48 +00:00
Add Multi-Escalation support
This commit is contained in:
parent
1417ed73b2
commit
402037ea2b
|
@ -7,10 +7,10 @@ setupAlacritty() {
|
|||
if ! command_exists alacritty; then
|
||||
case ${PACKAGER} in
|
||||
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
|
||||
else
|
||||
|
@ -26,4 +26,5 @@ setupAlacritty() {
|
|||
}
|
||||
|
||||
checkEnv
|
||||
checkEscalationTool
|
||||
setupAlacritty
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
#!/bin/sh -e
|
||||
. ../common-script.sh
|
||||
|
||||
makeDWM(){
|
||||
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)
|
||||
cd dwm-titus/ # Hardcoded path, maybe not the best.
|
||||
sudo ./setup.sh # Run setup
|
||||
sudo make clean install # Run make clean install
|
||||
makeDWM() {
|
||||
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)
|
||||
cd dwm-titus/ # Hardcoded path, maybe not the best.
|
||||
$ESCALATION_TOOL ./setup.sh # Run setup
|
||||
$ESCALATION_TOOL make clean install # Run make clean install
|
||||
}
|
||||
|
||||
setupDWM() {
|
||||
echo "Installing DWM-Titus if not already installed"
|
||||
case "$PACKAGER" in # Install pre-Requisites
|
||||
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
|
||||
|
||||
}
|
||||
|
||||
checkEnv
|
||||
checkEscalationTool
|
||||
setupDWM
|
||||
makeDWM
|
||||
|
|
|
@ -7,10 +7,10 @@ setupKitty() {
|
|||
if ! command_exists kitty; then
|
||||
case ${PACKAGER} in
|
||||
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
|
||||
else
|
||||
|
@ -18,12 +18,13 @@ setupKitty() {
|
|||
fi
|
||||
echo "Copy Kitty config files"
|
||||
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
|
||||
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/nord.conf https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/kitty/nord.conf
|
||||
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/nord.conf" https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/kitty/nord.conf
|
||||
}
|
||||
|
||||
checkEnv
|
||||
checkEscalationTool
|
||||
setupKitty
|
||||
|
|
|
@ -7,10 +7,10 @@ setupRofi() {
|
|||
if ! command_exists rofi; then
|
||||
case "$PACKAGER" in
|
||||
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
|
||||
else
|
||||
|
@ -31,4 +31,5 @@ setupRofi() {
|
|||
}
|
||||
|
||||
checkEnv
|
||||
checkEscalationTool
|
||||
setupRofi
|
||||
|
|
|
@ -8,10 +8,10 @@ install_zsh() {
|
|||
if ! command_exists zsh; then
|
||||
case "$PACKAGER" in
|
||||
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
|
||||
else
|
||||
|
@ -43,9 +43,10 @@ RPROMPT='%F{15}(%F{166}%D{%H:%M}%F{15})%f'
|
|||
EOL
|
||||
|
||||
# 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
|
||||
setup_zsh_config
|
||||
checkEscalationTool
|
||||
install_zsh
|
||||
setup_zsh_config
|
||||
|
|
|
@ -11,6 +11,23 @@ command_exists() {
|
|||
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() {
|
||||
## Check for requirements.
|
||||
|
@ -82,4 +99,5 @@ checkEnv() {
|
|||
checkCurrentDirectoryWritable
|
||||
checkSuperUser
|
||||
checkDistro
|
||||
checkEscalationTool
|
||||
}
|
||||
|
|
|
@ -7,10 +7,10 @@ installPkg() {
|
|||
if ! command_exists ufw; then
|
||||
case ${PACKAGER} in
|
||||
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
|
||||
else
|
||||
|
@ -22,27 +22,28 @@ configureUFW() {
|
|||
echo -e "${GREEN}Using Chris Titus Recommended Firewall Rules${RC}"
|
||||
|
||||
echo "Disabling UFW"
|
||||
sudo ufw disable
|
||||
$ESCALATION_TOOL ufw disable
|
||||
|
||||
echo "Limiting port 22/tcp (UFW)"
|
||||
sudo ufw limit 22/tcp
|
||||
$ESCALATION_TOOL ufw limit 22/tcp
|
||||
|
||||
echo "Allowing port 80/tcp (UFW)"
|
||||
sudo ufw allow 80/tcp
|
||||
$ESCALATION_TOOL ufw allow 80/tcp
|
||||
|
||||
echo "Allowing port 443/tcp (UFW)"
|
||||
sudo ufw allow 443/tcp
|
||||
$ESCALATION_TOOL ufw allow 443/tcp
|
||||
|
||||
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)"
|
||||
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}"
|
||||
}
|
||||
|
||||
checkEnv
|
||||
checkEscalationTool
|
||||
installPkg
|
||||
configureUFW
|
||||
|
|
|
@ -31,16 +31,16 @@ installDepend() {
|
|||
case $PACKAGER in
|
||||
pacman)
|
||||
if ! grep -q "^\s*\[multilib\]" /etc/pacman.conf; then
|
||||
echo "[multilib]" | sudo tee -a /etc/pacman.conf
|
||||
echo "Include = /etc/pacman.d/mirrorlist" | sudo tee -a /etc/pacman.conf
|
||||
sudo "$PACKAGER" -Syu
|
||||
echo "[multilib]" | $ESCALATION_TOOL tee -a /etc/pacman.conf
|
||||
echo "Include = /etc/pacman.d/mirrorlist" | $ESCALATION_TOOL tee -a /etc/pacman.conf
|
||||
$ESCALATION_TOOL "$PACKAGER" -Syu
|
||||
else
|
||||
echo "Multilib is already enabled."
|
||||
fi
|
||||
if ! command_exists yay && ! command_exists paru; then
|
||||
echo "Installing yay as AUR helper..."
|
||||
sudo "$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
|
||||
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm base-devel
|
||||
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
|
||||
else
|
||||
echo "Aur helper already installed"
|
||||
|
@ -53,30 +53,30 @@ installDepend() {
|
|||
echo "No AUR helper found. Please install yay or paru."
|
||||
exit 1
|
||||
fi
|
||||
"$AUR_HELPER" -S --needed --noconfirm "$DEPENDENCIES"
|
||||
$AUR_HELPER -S --needed --noconfirm "$DEPENDENCIES"
|
||||
;;
|
||||
apt-get|nala)
|
||||
COMPILEDEPS='build-essential'
|
||||
sudo "$PACKAGER" update
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo "$PACKAGER" update
|
||||
sudo "$PACKAGER" install -y $DEPENDENCIES $COMPILEDEPS
|
||||
$ESCALATION_TOOL "$PACKAGER" update
|
||||
$ESCALATION_TOOL dpkg --add-architecture i386
|
||||
$ESCALATION_TOOL "$PACKAGER" update
|
||||
$ESCALATION_TOOL "$PACKAGER" install -y $DEPENDENCIES $COMPILEDEPS
|
||||
;;
|
||||
dnf)
|
||||
COMPILEDEPS='@development-tools'
|
||||
sudo "$PACKAGER" update
|
||||
sudo "$PACKAGER" config-manager --set-enabled powertools
|
||||
sudo "$PACKAGER" install -y "$DEPENDENCIES" $COMPILEDEPS
|
||||
sudo "$PACKAGER" install -y glibc-devel.i686 libgcc.i686
|
||||
$ESCALATION_TOOL "$PACKAGER" update
|
||||
$ESCALATION_TOOL "$PACKAGER" config-manager --set-enabled powertools
|
||||
$ESCALATION_TOOL "$PACKAGER" install -y "$DEPENDENCIES" $COMPILEDEPS
|
||||
$ESCALATION_TOOL "$PACKAGER" install -y glibc-devel.i686 libgcc.i686
|
||||
;;
|
||||
zypper)
|
||||
COMPILEDEPS='patterns-devel-base-devel_basis'
|
||||
sudo "$PACKAGER" refresh
|
||||
sudo "$PACKAGER" --non-interactive install "$DEPENDENCIES" $COMPILEDEPS
|
||||
sudo "$PACKAGER" --non-interactive install libgcc_s1-gcc7-32bit glibc-devel-32bit
|
||||
$ESCALATION_TOOL "$PACKAGER" refresh
|
||||
$ESCALATION_TOOL "$PACKAGER" --non-interactive install "$DEPENDENCIES" $COMPILEDEPS
|
||||
$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
|
||||
}
|
||||
|
@ -102,5 +102,6 @@ install_additional_dependencies() {
|
|||
}
|
||||
|
||||
checkEnv
|
||||
checkEscalationTool
|
||||
installDepend
|
||||
install_additional_dependencies
|
||||
|
|
|
@ -7,16 +7,16 @@ installDepend() {
|
|||
echo -e "${YELLOW}Installing dependencies...${RC}"
|
||||
if [ "$PACKAGER" = "pacman" ]; then
|
||||
if ! grep -q "^\s*\[multilib\]" /etc/pacman.conf; then
|
||||
echo "[multilib]" | sudo tee -a /etc/pacman.conf
|
||||
echo "Include = /etc/pacman.d/mirrorlist" | sudo tee -a /etc/pacman.conf
|
||||
sudo ${PACKAGER} -Syu
|
||||
echo "[multilib]" | $ESCALATION_TOOL tee -a /etc/pacman.conf
|
||||
echo "Include = /etc/pacman.d/mirrorlist" | $ESCALATION_TOOL tee -a /etc/pacman.conf
|
||||
$ESCALATION_TOOL ${PACKAGER} -Syu
|
||||
else
|
||||
echo "Multilib is already enabled."
|
||||
fi
|
||||
if ! command_exists yay && ! command_exists paru; then
|
||||
echo "Installing yay as AUR helper..."
|
||||
sudo ${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
|
||||
$ESCALATION_TOOL ${PACKAGER} -S --needed --noconfirm base-devel
|
||||
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
|
||||
else
|
||||
echo "Aur helper already installed"
|
||||
|
@ -29,24 +29,24 @@ installDepend() {
|
|||
echo "No AUR helper found. Please install yay or paru."
|
||||
exit 1
|
||||
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 \
|
||||
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 \
|
||||
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
|
||||
elif [ "$PACKAGER" = "apt-get" ]; then
|
||||
sudo ${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} update
|
||||
$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
|
||||
sudo ${PACKAGER} install -y wine
|
||||
$ESCALATION_TOOL ${PACKAGER} install -y wine
|
||||
else
|
||||
sudo ${PACKAGER} install -y ${DEPENDENCIES}
|
||||
$ESCALATION_TOOL ${PACKAGER} install -y ${DEPENDENCIES}
|
||||
fi
|
||||
}
|
||||
|
||||
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)
|
||||
version=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/lutris/lutris |
|
||||
grep -v 'beta' |
|
||||
|
@ -58,8 +58,8 @@ install_additional_dependencies() {
|
|||
|
||||
# Install the downloaded .deb package using apt-get
|
||||
echo "Installing lutris_${version_no_v}_all.deb"
|
||||
sudo apt-get update
|
||||
sudo apt-get install ./lutris_${version_no_v}_all.deb
|
||||
$ESCALATION_TOOL apt-get update
|
||||
$ESCALATION_TOOL apt-get install ./lutris_${version_no_v}_all.deb
|
||||
|
||||
# Clean up the downloaded .deb file
|
||||
rm lutris_${version_no_v}_all.deb
|
||||
|
@ -70,34 +70,35 @@ install_additional_dependencies() {
|
|||
#Install steam on Debian
|
||||
if (lsb_release -i | grep -qi Debian); then
|
||||
#Enable i386 repos
|
||||
sudo dpkg --add-architecture i386
|
||||
$ESCALATION_TOOL dpkg --add-architecture i386
|
||||
# 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
|
||||
sudo apt-add-repository contrib -y
|
||||
sudo apt-add-repository non-free -y
|
||||
$ESCALATION_TOOL apt-add-repository contrib -y
|
||||
$ESCALATION_TOOL apt-add-repository non-free -y
|
||||
#Install steam
|
||||
sudo apt-get install steam-installer -y
|
||||
$ESCALATION_TOOL apt-get install steam-installer -y
|
||||
else
|
||||
#Install steam on Ubuntu
|
||||
sudo apt-get install -y steam
|
||||
$ESCALATION_TOOL apt-get install -y steam
|
||||
fi
|
||||
;;
|
||||
*zypper)
|
||||
|
||||
|
||||
;;
|
||||
*dnf)
|
||||
|
||||
|
||||
;;
|
||||
*pacman)
|
||||
|
||||
|
||||
;;
|
||||
*)
|
||||
|
||||
;;
|
||||
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
checkEnv
|
||||
checkEscalationTool
|
||||
installDepend
|
||||
install_additional_dependencies
|
||||
|
|
|
@ -17,19 +17,19 @@ install_theme_tools() {
|
|||
printf "${YELLOW}Installing theme tools (qt6ct and kvantum)...${RC}\n"
|
||||
case $PACKAGER in
|
||||
apt-get)
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y qt6ct kvantum
|
||||
$ESCALATION_TOOL apt-get update
|
||||
$ESCALATION_TOOL apt-get install -y qt6ct kvantum
|
||||
;;
|
||||
zypper)
|
||||
sudo zypper refresh
|
||||
sudo zypper --non-interactive install qt6ct kvantum
|
||||
$ESCALATION_TOOL zypper refresh
|
||||
$ESCALATION_TOOL zypper --non-interactive install qt6ct kvantum
|
||||
;;
|
||||
dnf)
|
||||
sudo dnf update
|
||||
sudo dnf install -y qt6ct kvantum
|
||||
$ESCALATION_TOOL dnf update
|
||||
$ESCALATION_TOOL dnf install -y qt6ct kvantum
|
||||
;;
|
||||
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"
|
||||
|
@ -52,7 +52,7 @@ EOF
|
|||
# Add QT_QPA_PLATFORMTHEME to /etc/environment
|
||||
if ! grep -q "QT_QPA_PLATFORMTHEME=qt6ct" /etc/environment; then
|
||||
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"
|
||||
else
|
||||
printf "${GREEN}QT_QPA_PLATFORMTHEME already set in /etc/environment.${RC}\n"
|
||||
|
@ -70,6 +70,7 @@ EOF
|
|||
}
|
||||
|
||||
checkEnv
|
||||
checkEscalationTool
|
||||
install_theme_tools
|
||||
configure_qt6ct
|
||||
configure_kvantum
|
||||
|
|
|
@ -5,24 +5,26 @@
|
|||
removeSnaps() {
|
||||
case $PACKAGER in
|
||||
pacman)
|
||||
sudo ${PACKAGER} -Rns snapd
|
||||
$ESCALATION_TOOL ${PACKAGER} -Rns snapd
|
||||
;;
|
||||
apt-get|nala)
|
||||
sudo ${PACKAGER} autoremove --purge snapd
|
||||
$ESCALATION_TOOL ${PACKAGER} autoremove --purge snapd
|
||||
if [ "$ID" = ubuntu ]; then
|
||||
sudo apt-mark hold snapd
|
||||
$ESCALATION_TOOL apt-mark hold snapd
|
||||
fi
|
||||
;;
|
||||
dnf)
|
||||
sudo ${PACKAGER} remove snapd
|
||||
$ESCALATION_TOOL ${PACKAGER} remove snapd
|
||||
;;
|
||||
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
|
||||
}
|
||||
|
||||
checkEnv
|
||||
checkEscalationTool
|
||||
removeSnaps
|
||||
|
|
|
@ -7,8 +7,8 @@ installDepend() {
|
|||
pacman)
|
||||
if ! command_exists paru; then
|
||||
echo "Installing paru as AUR helper..."
|
||||
sudo "$PACKAGER" -S --needed --noconfirm base-devel
|
||||
cd /opt && sudo git clone https://aur.archlinux.org/paru.git && sudo chown -R "$USER": ./paru
|
||||
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm base-devel
|
||||
cd /opt && $ESCALATION_TOOL git clone https://aur.archlinux.org/paru.git && $ESCALATION_TOOL chown -R "$USER": ./paru
|
||||
cd paru && makepkg --noconfirm -si
|
||||
echo "Paru installed"
|
||||
else
|
||||
|
@ -22,4 +22,5 @@ installDepend() {
|
|||
}
|
||||
|
||||
checkEnv
|
||||
installDepend
|
||||
checkEscalationTool
|
||||
installDepend
|
||||
|
|
|
@ -7,8 +7,8 @@ installDepend() {
|
|||
pacman)
|
||||
if ! command_exists yay; then
|
||||
echo "Installing yay as AUR helper..."
|
||||
sudo "$PACKAGER" -S --needed --noconfirm base-devel
|
||||
cd /opt && sudo git clone https://aur.archlinux.org/yay-git.git && sudo chown -R "$USER": ./yay-git
|
||||
$ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm base-devel
|
||||
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
|
||||
echo "Yay installed"
|
||||
else
|
||||
|
@ -22,4 +22,5 @@ installDepend() {
|
|||
}
|
||||
|
||||
checkEnv
|
||||
installDepend
|
||||
checkEscalationTool
|
||||
installDepend
|
||||
|
|
|
@ -7,8 +7,8 @@ fastUpdate() {
|
|||
pacman)
|
||||
if ! command_exists yay && ! command_exists paru; then
|
||||
echo "Installing yay as AUR helper..."
|
||||
sudo ${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
|
||||
$ESCALATION_TOOL ${PACKAGER} -S --needed --noconfirm base-devel || { echo -e "${RED}Failed to install base-devel${RC}"; exit 1; }
|
||||
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; }
|
||||
else
|
||||
echo "Aur helper already installed"
|
||||
|
@ -21,9 +21,9 @@ fastUpdate() {
|
|||
echo "No AUR helper found. Please install yay or paru."
|
||||
exit 1
|
||||
fi
|
||||
${AUR_HELPER} -S --needed --noconfirm rate-mirrors-bin
|
||||
$AUR_HELPER -S --needed --noconfirm rate-mirrors-bin
|
||||
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
|
||||
|
||||
# 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
|
||||
dtype_local="arch"
|
||||
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)
|
||||
sudo apt-get update
|
||||
$ESCALATION_TOOL apt-get update
|
||||
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
|
||||
if [ "${PACKAGER}" = "nala" ]; then
|
||||
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
|
||||
sudo nala update
|
||||
$ESCALATION_TOOL cp /etc/apt/sources.list /etc/apt/sources.list.bak
|
||||
$ESCALATION_TOOL nala update
|
||||
PACKAGER="nala"
|
||||
fi
|
||||
sudo ${PACKAGER} upgrade -y
|
||||
$ESCALATION_TOOL ${PACKAGER} upgrade -y
|
||||
;;
|
||||
dnf)
|
||||
sudo ${PACKAGER} update -y
|
||||
$ESCALATION_TOOL ${PACKAGER} update -y
|
||||
;;
|
||||
zypper)
|
||||
sudo ${PACKAGER} ref
|
||||
sudo ${PACKAGER} --non-interactive dup
|
||||
$ESCALATION_TOOL ${PACKAGER} ref
|
||||
$ESCALATION_TOOL ${PACKAGER} --non-interactive dup
|
||||
;;
|
||||
yum)
|
||||
sudo ${PACKAGER} update -y
|
||||
sudo ${PACKAGER} upgrade -y
|
||||
$ESCALATION_TOOL ${PACKAGER} update -y
|
||||
$ESCALATION_TOOL ${PACKAGER} upgrade -y
|
||||
;;
|
||||
xbps-install)
|
||||
sudo ${PACKAGER} -Syu
|
||||
$ESCALATION_TOOL ${PACKAGER} -Syu
|
||||
;;
|
||||
*)
|
||||
echo -e "${RED}Unsupported package manager: $PACKAGER${RC}"
|
||||
|
@ -70,23 +70,23 @@ updateSystem() {
|
|||
echo -e "${GREEN}Updating system${RC}"
|
||||
case ${PACKAGER} in
|
||||
nala|apt-get)
|
||||
sudo "${PACKAGER}" update -y
|
||||
sudo "${PACKAGER}" upgrade -y
|
||||
$ESCALATION_TOOL "${PACKAGER}" update -y
|
||||
$ESCALATION_TOOL "${PACKAGER}" upgrade -y
|
||||
;;
|
||||
yum|dnf)
|
||||
sudo "${PACKAGER}" update -y
|
||||
sudo "${PACKAGER}" upgrade -y
|
||||
$ESCALATION_TOOL "${PACKAGER}" update -y
|
||||
$ESCALATION_TOOL "${PACKAGER}" upgrade -y
|
||||
;;
|
||||
pacman)
|
||||
sudo "${PACKAGER}" -Sy --noconfirm --needed archlinux-keyring
|
||||
sudo "${PACKAGER}" -Su --noconfirm
|
||||
$ESCALATION_TOOL "${PACKAGER}" -Sy --noconfirm --needed archlinux-keyring
|
||||
$ESCALATION_TOOL "${PACKAGER}" -Su --noconfirm
|
||||
;;
|
||||
zypper)
|
||||
sudo ${PACKAGER} ref
|
||||
sudo ${PACKAGER} --non-interactive dup
|
||||
$ESCALATION_TOOL ${PACKAGER} ref
|
||||
$ESCALATION_TOOL ${PACKAGER} --non-interactive dup
|
||||
;;
|
||||
xbps-install)
|
||||
sudo ${PACKAGER} -Syu
|
||||
$ESCALATION_TOOL ${PACKAGER} -Syu
|
||||
;;
|
||||
*)
|
||||
echo -e "${RED}Unsupported package manager: ${PACKAGER}${RC}"
|
||||
|
@ -102,6 +102,7 @@ updateFlatpaks() {
|
|||
}
|
||||
|
||||
checkEnv
|
||||
checkEscalationTool
|
||||
fastUpdate
|
||||
updateSystem
|
||||
updateFlatpaks
|
||||
|
|
Loading…
Reference in New Issue
Block a user