aboutsummaryrefslogtreecommitdiff
path: root/scripts/package-inventory
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/package-inventory')
-rwxr-xr-xscripts/package-inventory15
1 files changed, 10 insertions, 5 deletions
diff --git a/scripts/package-inventory b/scripts/package-inventory
index 4742645..2dda44b 100755
--- a/scripts/package-inventory
+++ b/scripts/package-inventory
@@ -8,7 +8,12 @@
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
-ARCHSETUP="$SCRIPT_DIR/archsetup"
+
+# Seams for testing: PKGINV_ARCHSETUP points the extractor at a fixture
+# installer; PKGINV_PACMAN swaps in a fake pacman serving controlled
+# -Qqe/-Qq/-Qqen/-Qqem output. Both default to the real targets.
+ARCHSETUP="${PKGINV_ARCHSETUP:-$SCRIPT_DIR/archsetup}"
+PACMAN="${PKGINV_PACMAN:-pacman}"
# Colors
RED='\033[0;31m'
@@ -66,22 +71,22 @@ extract_archsetup_packages() {
# Get packages on live system
# ============================================================================
get_system_packages_explicit() {
- pacman -Qqe | sort -u # explicitly installed
+ "$PACMAN" -Qqe | sort -u # explicitly installed
}
get_system_packages_all() {
- pacman -Qq | sort -u # all installed (including deps)
+ "$PACMAN" -Qq | sort -u # all installed (including deps)
}
# ============================================================================
# Categorize system packages
# ============================================================================
get_system_native() {
- pacman -Qqen | sort -u # native (official repos)
+ "$PACMAN" -Qqen | sort -u # native (official repos)
}
get_system_foreign() {
- pacman -Qqem | sort -u # foreign (AUR/manual)
+ "$PACMAN" -Qqem | sort -u # foreign (AUR/manual)
}
# ============================================================================