updated uninstall functions
This commit is contained in:
parent
44b58b3c65
commit
04995241c4
|
|
@ -90,15 +90,23 @@ source "$(dirname "$(readlink -f "$0")")/Global_functions.sh"
|
||||||
LOG="Install-Logs/install-$(date +%d-%H%M%S)_hypr-pkgs.log"
|
LOG="Install-Logs/install-$(date +%d-%H%M%S)_hypr-pkgs.log"
|
||||||
|
|
||||||
# uninstalling conflicting packages
|
# uninstalling conflicting packages
|
||||||
printf "\n%s - Removing Mako, Dunst and rofi as it conflicts with swaync and rofi-wayland \n" "${NOTE}"
|
# Initialize a variable to track overall errors
|
||||||
|
overall_failed=0
|
||||||
|
printf "\n%s - Removing Mako, Dunst, and rofi as they conflict with swaync and rofi-wayland \n" "${NOTE}"
|
||||||
for PKG in "${uninstall[@]}"; do
|
for PKG in "${uninstall[@]}"; do
|
||||||
uninstall_package "$PKG" 2>&1 | tee -a "$LOG"
|
uninstall_package "$PKG" 2>&1 | tee -a "$LOG"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo -e "\e[1A\e[K${ERROR} - $PKG uninstallation failed, please check the log"
|
# Track if any uninstallation failed
|
||||||
exit 1
|
overall_failed=1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Report if any uninstallation failed, but do not exit the script
|
||||||
|
if [ $overall_failed -ne 0 ]; then
|
||||||
|
echo -e "${ERROR} Some packages failed to uninstall. Please check the log."
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Installation of main components
|
# Installation of main components
|
||||||
printf "\n%s - Installing hyprland packages.... \n" "${NOTE}"
|
printf "\n%s - Installing hyprland packages.... \n" "${NOTE}"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,18 +65,23 @@ install_package() {
|
||||||
|
|
||||||
# Function for uninstalling packages
|
# Function for uninstalling packages
|
||||||
uninstall_package() {
|
uninstall_package() {
|
||||||
|
local pkg="$1"
|
||||||
|
|
||||||
# Checking if package is installed
|
# Checking if package is installed
|
||||||
if pacman -Qi "$1" &>> /dev/null ; then
|
if pacman -Qi "$pkg" &>> /dev/null ; then
|
||||||
# Package is installed
|
# Package is installed
|
||||||
echo -e "${NOTE} Uninstalling $1 ..."
|
echo -e "${NOTE} Uninstalling $pkg ..."
|
||||||
sudo pacman -R --noconfirm "$1" 2>&1 | tee -a "$LOG"
|
sudo pacman -R --noconfirm "$pkg" 2>&1 | grep -v "error: target not found" | tee -a "$LOG"
|
||||||
# Making sure package is uninstalled
|
# Making sure package is uninstalled
|
||||||
if ! pacman -Qi "$1" &>> /dev/null ; then
|
if ! pacman -Qi "$pkg" &>> /dev/null ; then
|
||||||
echo -e "\e[1A\e[K${OK} $1 was uninstalled."
|
echo -e "\e[1A\e[K${OK} $pkg was uninstalled."
|
||||||
else
|
else
|
||||||
# Something went wrong, exiting to review log
|
# Log the failure but continue
|
||||||
echo -e "\e[1A\e[K${ERROR} $1 failed to uninstall. Please check the log."
|
echo -e "\e[1A\e[K${ERROR} $pkg failed to uninstall. Please check the log."
|
||||||
exit 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
else # Package is not installed
|
||||||
|
echo -e "${NOTE} $pkg is not installed, skipping uninstallation."
|
||||||
fi
|
fi
|
||||||
}
|
return 0
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue