From a9981a11ada4c1b9ffaef77d65aae98747607580 Mon Sep 17 00:00:00 2001 From: David Young Date: Wed, 3 Jun 2026 14:45:23 -0600 Subject: [PATCH] add remove packages functionality --- coreupdate | 5 +++++ install-flatpaks.sh | 1 - remove-packages.conf | 12 ++++++++++++ utils.sh | 36 +++++++++++++++++++++++++++++++++++- 4 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 remove-packages.conf diff --git a/coreupdate b/coreupdate index b56e6d4..c26efbf 100755 --- a/coreupdate +++ b/coreupdate @@ -31,6 +31,11 @@ sudo pacman -Syu cd ~/.local/share/coredesktop source utils.sh source packages.conf +source remove-packages.conf + +echo "Removing unwanted packages..." +remove_packages "${REMOVE_PACMAN[@]}" +remove_flatpaks "${REMOVE_FLATPAKS[@]}" echo "Checking for new packages..." install_packages "${SYSTEM_UTILS[@]}" diff --git a/install-flatpaks.sh b/install-flatpaks.sh index 059e389..5f4fd5f 100755 --- a/install-flatpaks.sh +++ b/install-flatpaks.sh @@ -28,7 +28,6 @@ FLATPAKS=( "org.audacityteam.Audacity" "org.remmina.Remmina" "com.getpostman.Postman" - "com.jeffser.Alpaca" "io.dbeaver.DBeaverCommunity" "com.github.iwalton3.jellyfin-media-player" "app.zen_browser.zen" diff --git a/remove-packages.conf b/remove-packages.conf new file mode 100644 index 0000000..d143b8c --- /dev/null +++ b/remove-packages.conf @@ -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" +) diff --git a/utils.sh b/utils.sh index 62c5d07..a3d77fb 100755 --- a/utils.sh +++ b/utils.sh @@ -25,4 +25,38 @@ install_packages() { echo "Installing: ${to_install[*]}" yay -S --noconfirm "${to_install[@]}" fi -} \ No newline at end of file +} + +# 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 +} \ No newline at end of file