summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-12-16 16:28:46 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-12-16 16:28:46 -0500
commit700e3cf27dcddac84632bcfed3d27ef36cb43df5 (patch)
tree3f362329a698c2a50b1bb48926c2c7db0733e394
parent3990c562952d8f71da933b1a38ddd7c93f05d36d (diff)
packages.sh b64
-rwxr-xr-xpackages.sh21
1 files changed, 17 insertions, 4 deletions
diff --git a/packages.sh b/packages.sh
index 8296644..c79d58c 100755
--- a/packages.sh
+++ b/packages.sh
@@ -2,18 +2,31 @@
all=($(< packages.txt sed 's/#.*//' | xargs printf -- '%s\n' | sort -u))
grps=($(printf -- '%s\n' "${all[@]}" | sed -n 's/^g://p'))
pkgs=($(printf -- '%s\n' "${all[@]}" | sed -n 's/^p://p'))
-igns=($(printf -- '%s\n' "${all[@]}" | sed -n 's/^i://p'))
+excl=($(printf -- '%s\n' "${all[@]}" | sed -n 's/^x://p'))
+bads=($(printf -- '%s\n' "${all[@]}" | grep -v '^[gpx]:'))
+if [[ ${#bads[@]} -gt 0 ]]; then
+ echo ' => Invalid entries in packages.txt'
+ printf ' -> %s\n' "${bads[@]}"
+ exit 1
+fi
+
+packages_txt() {
+ {
+ pacman -Sgq -- "${grps[@]}"|grep -vFx -f <(printf '%s\n' "${excl[@]}")
+ printf '%s\n' "${pkgs[@]}"
+ } | sort -u
+}
echo ' => In packages.txt, but not installed'
comm -13 \
<(pacman -Qq|sort -u) \
- <({ pacman -Sgq -- "${grps[@]}"; printf '%s\n' "${pkgs[@]}"; }|sort -u) |
+ <(packages_txt) |
sed 's|^| -> |'
echo ' => Installed explicitly and not depended on, but not in packages.txt'
comm -23 \
<(pacman -Qetq |sort -u) \
- <({ pacman -Sgq -- "${grps[@]}"; printf '%s\n' "${pkgs[@]}"; }|sort -u) |
+ <(packages_txt) |
sed 's|^| -> |'
echo ' => Installed explicitly and only optionally depended on, but not in packages.txt'
@@ -21,7 +34,7 @@ comm -23 \
<(comm -23 \
<(pacman -Qettq|sort -u) \
<(pacman -Qetq |sort -u)) \
- <({ pacman -Sgq -- "${grps[@]}"; printf '%s\n' "${pkgs[@]}"; }|sort -u) |
+ <(packages_txt) |
sed 's|^| -> |'
echo ' => Installed as dependencies, but only optionally depended on'