From b272f5fd3a5392d34ee0cbd6599ad0a25af03376 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20K=C3=B6rber?= Date: Fri, 10 May 2024 18:53:16 +0200 Subject: [PATCH] Read hardware-specific packages properly for autoremoval --- remove-unconfigured-packages.sh | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/remove-unconfigured-packages.sh b/remove-unconfigured-packages.sh index bbc0aef..78fe311 100755 --- a/remove-unconfigured-packages.sh +++ b/remove-unconfigured-packages.sh @@ -1,20 +1,25 @@ #!/usr/bin/env bash +set -o nounset +set -o errexit + +cpu="$(yaml2json < _machines/"$(hostname --short)".yml | jq --raw-output .cpu)" +gpu="$(yaml2json < _machines/"$(hostname --short)".yml | jq --raw-output .gpu)" + +if [[ "${cpu}" ]] ; then + readarray -d $'\0' -t cpu_packages < <(]*}" "${makedepends[@]%%[<=>]*}" "${pkgname}") done -packages_to_remove=() +declare -a packages_to_remove=() readarray -d $'\0' -t packages_to_remove < <(comm --zero-terminated -13 \ <(cat \ <( 0 )) ; then +if (( "${#packages_to_remove[@]}" > 0 )) ; then sudo pacman -Rcns "${packages_to_remove[@]}" "${@}" || exit $? exit 123 fi