add remove packages functionality

This commit is contained in:
2026-06-03 14:45:23 -06:00
parent cbe7dc938e
commit a9981a11ad
4 changed files with 52 additions and 2 deletions

View File

@@ -31,6 +31,11 @@ sudo pacman -Syu
cd ~/.local/share/coredesktop cd ~/.local/share/coredesktop
source utils.sh source utils.sh
source packages.conf source packages.conf
source remove-packages.conf
echo "Removing unwanted packages..."
remove_packages "${REMOVE_PACMAN[@]}"
remove_flatpaks "${REMOVE_FLATPAKS[@]}"
echo "Checking for new packages..." echo "Checking for new packages..."
install_packages "${SYSTEM_UTILS[@]}" install_packages "${SYSTEM_UTILS[@]}"

View File

@@ -28,7 +28,6 @@ FLATPAKS=(
"org.audacityteam.Audacity" "org.audacityteam.Audacity"
"org.remmina.Remmina" "org.remmina.Remmina"
"com.getpostman.Postman" "com.getpostman.Postman"
"com.jeffser.Alpaca"
"io.dbeaver.DBeaverCommunity" "io.dbeaver.DBeaverCommunity"
"com.github.iwalton3.jellyfin-media-player" "com.github.iwalton3.jellyfin-media-player"
"app.zen_browser.zen" "app.zen_browser.zen"

12
remove-packages.conf Normal file
View File

@@ -0,0 +1,12 @@
# Packages to remove on next coreupdate run.
# Add entries here and they will be uninstalled automatically.
# Pacman / AUR packages to remove (works for both pacman and yay packages)
REMOVE_PACMAN=(
# none at this time
)
# Flatpak applications to remove
REMOVE_FLATPAKS=(
"com.jeffser.Alpaca"
)

View File

@@ -26,3 +26,37 @@ install_packages() {
yay -S --noconfirm "${to_install[@]}" yay -S --noconfirm "${to_install[@]}"
fi fi
} }
# Function to remove pacman/AUR packages if installed
remove_packages() {
local packages=("$@")
local to_remove=()
for pkg in "${packages[@]}"; do
if is_installed "$pkg"; then
to_remove+=("$pkg")
fi
done
if [ ${#to_remove[@]} -ne 0 ]; then
echo "Removing: ${to_remove[*]}"
sudo pacman -Rns --noconfirm "${to_remove[@]}"
fi
}
# Function to remove flatpak applications if installed
remove_flatpaks() {
local flatpaks=("$@")
local to_remove=()
for pak in "${flatpaks[@]}"; do
if flatpak list | grep -qi "$pak"; then
to_remove+=("$pak")
fi
done
if [ ${#to_remove[@]} -ne 0 ]; then
echo "Removing flatpaks: ${to_remove[*]}"
flatpak uninstall --noninteractive "${to_remove[@]}"
fi
}