From b16dffda4d531333dd11beaeafa021f0e67f2f31 Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Sat, 14 Sep 2024 11:40:36 +0900 Subject: [PATCH] another update for uninstallation process --- install-scripts/00-hypr-pkgs.sh | 2 +- install-scripts/Global_functions.sh | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/install-scripts/00-hypr-pkgs.sh b/install-scripts/00-hypr-pkgs.sh index 020a428..0ff3fee 100755 --- a/install-scripts/00-hypr-pkgs.sh +++ b/install-scripts/00-hypr-pkgs.sh @@ -92,6 +92,7 @@ LOG="Install-Logs/install-$(date +%d-%H%M%S)_hypr-pkgs.log" # uninstalling conflicting packages # 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 uninstall_package "$PKG" 2>&1 | tee -a "$LOG" @@ -101,7 +102,6 @@ for PKG in "${uninstall[@]}"; do fi 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 diff --git a/install-scripts/Global_functions.sh b/install-scripts/Global_functions.sh index e4199b3..8e25bd3 100755 --- a/install-scripts/Global_functions.sh +++ b/install-scripts/Global_functions.sh @@ -71,16 +71,15 @@ uninstall_package() { if pacman -Qi "$pkg" &>> /dev/null ; then # Package is installed echo -e "${NOTE} Uninstalling $pkg ..." - sudo pacman -R --noconfirm "$pkg" 2>&1 | grep -v "error: target not found" | tee -a "$LOG" - # Making sure package is uninstalled + sudo pacman -R --noconfirm "$pkg" 2>&1 | tee -a "$LOG" | grep -v "error: target not found" + # Check if the package was uninstalled if ! pacman -Qi "$pkg" &>> /dev/null ; then echo -e "\e[1A\e[K${OK} $pkg was uninstalled." else - # Log the failure but continue echo -e "\e[1A\e[K${ERROR} $pkg failed to uninstall. Please check the log." - return 1 + return 1 fi - else # Package is not installed + else echo -e "${NOTE} $pkg is not installed, skipping uninstallation." fi return 0