From a2da319b36908289adfb3df3548bb5cf58f33d24 Mon Sep 17 00:00:00 2001 From: "[yuri]" <[yuri.kuit@gmail.com]> Date: Wed, 10 Dec 2025 20:46:56 +0100 Subject: [PATCH] update removal --- v2/arch-plasma.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/v2/arch-plasma.sh b/v2/arch-plasma.sh index 555ee17..cec4af6 100755 --- a/v2/arch-plasma.sh +++ b/v2/arch-plasma.sh @@ -38,8 +38,27 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # Helper functions ########################## install_packages() { sudo pacman -S --noconfirm --needed "$@"; } -remove_packages() { sudo pacman -Rs --noconfirm "$@"; } is_package_installed() { pacman -Qi "$@" &>/dev/null; } +remove_packages() { + local packages_to_remove=() + + # 1. Identify which packages are actually installed + for pkg in "$@"; do + if is_package_installed "$pkg"; then + packages_to_remove+=("$pkg") + else + say_gray "Package '$pkg' not found. Skipping removal." + fi + done + + # 2. Only run pacman if there are packages to remove + if [ ${#packages_to_remove[@]} -gt 0 ]; then + say_cyan "Removing packages: ${packages_to_remove[*]}" + sudo pacman -Rs --noconfirm "${packages_to_remove[@]}" || true + else + say_gray "No packages to remove from the list." + fi +} detect_de() { if command -v plasmashell >/dev/null 2>&1; then