mirror of
https://github.com/JaKooLit/Debian-Hyprland.git
synced 2025-12-21 10:20:12 +01:00
new package removal function
This commit is contained in:
parent
0bdd2fb29e
commit
eaebe94940
@ -87,11 +87,19 @@ 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"
|
||||||
|
|
||||||
# Remove conflicting packages
|
# Remove conflicting packages
|
||||||
printf "\n%s - ${SKY_BLUE}removing some packages${RESET} inorder for dots to work properly \n" "${NOTE}"
|
overall_failed=0
|
||||||
|
printf "\n%s - Removing some packages as it causes conflicts with KooL's Hyprland Dots \n" "${NOTE}"
|
||||||
for PKG in "${uninstall[@]}"; do
|
for PKG in "${uninstall[@]}"; do
|
||||||
uninstall_package "$PKG" "$LOG"
|
uninstall_package "$PKG" 2>&1 | tee -a "$LOG"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
overall_failed=1
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ $overall_failed -ne 0 ]; then
|
||||||
|
echo -e "${ERROR} Some packages failed to uninstall. Please check the log."
|
||||||
|
fi
|
||||||
|
|
||||||
printf "\n%.0s" {1..1}
|
printf "\n%.0s" {1..1}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -94,15 +94,23 @@ re_install_package() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function for removing packages
|
||||||
# Function for uninstalling packages
|
|
||||||
uninstall_package() {
|
uninstall_package() {
|
||||||
|
local pkg="$1"
|
||||||
|
|
||||||
|
# Checking if package is installed
|
||||||
if sudo dpkg -l | grep -q -w "^ii $1" ; then
|
if sudo dpkg -l | grep -q -w "^ii $1" ; then
|
||||||
sudo apt autoremove -y "$1" >> "$LOG" 2>&1
|
echo -e "${NOTE} Uninstalling $pkg ..."
|
||||||
|
sudo apt autoremove -y "$1" >> "$LOG" 2>&1 | grep -v "error: target not found"
|
||||||
|
|
||||||
if ! dpkg -l | grep -q -w "^ii $1" ; then
|
if ! dpkg -l | grep -q -w "^ii $1" ; then
|
||||||
echo -e "\e[1A\e[K${OK} ${MAGENTA}$1${RESET} was uninstalled."
|
echo -e "\e[1A\e[K${OK} ${MAGENTA}$1${RESET} was uninstalled."
|
||||||
else
|
else
|
||||||
echo -e "\e[1A\e[K${ERROR} $1 failed to uninstall. Please check the uninstall.log."
|
echo -e "\e[1A\e[K${ERROR} $pkg failed to uninstall. Please check the log."
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
echo -e "${INFO} Package $pkg not installed, skipping."
|
||||||
fi
|
fi
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user