Unduplicate udev package cleanup code

Two backup directories for each package don't need to exist. Combine them into the one.
This commit is contained in:
Thomas Duckworth
2025-11-21 18:27:08 +11:00
parent ac609adc68
commit 2a96785821

View File

@@ -21,18 +21,11 @@ if [ -f "$SRCDIR/.secure_files/gpg.public.key" ]; then # only useful and availab
# https://invent.kde.org/kde-linux/kde-linux/-/issues/199
fi
# Uninstall solaar, but keep its udev rules.
# Uninstall solaar and sane, but keep their udev rules.
# This ensures that they stay up to date.
UDEV_BACKUP_DIR=$(mktemp -d)
pacman -Qlq solaar | grep '^/usr/lib/udev/' | xargs -r cp -a --parents -t "$UDEV_BACKUP_DIR"
pacman -Rns --noconfirm solaar
# Uninstall sane, but keep its udev rules.
# This ensures that they stay up to date.
UDEV_BACKUP_DIR=$(mktemp -d)
pacman -Qlq sane | grep '^/usr/lib/udev/' | xargs -r cp -a --parents -t "$UDEV_BACKUP_DIR"
pacman -Rns --noconfirm sane
pacman -Qlq solaar sane | grep '^/usr/lib/udev/' | xargs -r cp -a --parents -t "$UDEV_BACKUP_DIR"
pacman -Rns --noconfirm solaar sane
cp -a "$UDEV_BACKUP_DIR"/* /
rm -rf "$UDEV_BACKUP_DIR"