33 lines
1.2 KiB
Bash
33 lines
1.2 KiB
Bash
#!/bin/bash
|
|
|
|
# CoreDesktop no longer installs Sonarr, qBittorrent, or the tools it had two
|
|
# of: borg (restic does backups), lsd (eza), screen (tmux) and asdf-vm (mise).
|
|
# Remove them once. Install one again yourself and update leaves it alone.
|
|
# Their data stays: Sonarr's in /var/lib/sonarr, qBittorrent's in ~/.var/app.
|
|
DROPPED=(sonarr-bin borg lsd screen asdf-vm)
|
|
|
|
if systemctl is-enabled -q sonarr.service 2> /dev/null || systemctl is-active -q sonarr.service 2> /dev/null; then
|
|
echo "Stopping Sonarr..."
|
|
sudo systemctl disable --now sonarr.service || exit 1
|
|
fi
|
|
|
|
for pkg in "${DROPPED[@]}"; do
|
|
# The exact name: pacman -Q also matches a package that only provides it
|
|
[ "$(pacman -Qq "$pkg" 2> /dev/null)" = "$pkg" ] || continue
|
|
|
|
# Something else still needs it: leave it to go with that, as an orphan
|
|
if [ "$(LC_ALL=C pacman -Qi "$pkg" | awk -F' *: *' '/^Required By/ { print $2 }')" != "None" ]; then
|
|
sudo pacman -D --asdeps "$pkg" > /dev/null || exit 1
|
|
continue
|
|
fi
|
|
|
|
echo "Removing $pkg..."
|
|
sudo pacman -Rns --noconfirm "$pkg" || exit 1
|
|
done
|
|
|
|
if flatpak info --system org.qbittorrent.qBittorrent &> /dev/null; then
|
|
echo "Removing qBittorrent..."
|
|
sudo flatpak uninstall --system --noninteractive org.qbittorrent.qBittorrent || exit 1
|
|
fi
|
|
exit 0
|