nvchecker/scripts/arch_repopkg_unmonitored

32 lines
776 B
Plaintext
Raw Normal View History

#!/bin/bash -e
2017-02-28 07:24:53 +00:00
# MIT licensed
# Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al.
if [[ $# -ne 2 || ! -r $1 || -z $2 ]]; then
2013-12-08 13:50:17 +00:00
echo >&2 "usage: arch_repopkg_unmonitored config.ini pkg_list or repository_name"
exit 1
fi
tmp_configured=$(mktemp)
tmp_list=$(mktemp)
trap 'rm -f "$tmp_configured" "$tmp_list"' INT QUIT TERM EXIT
config=$1
if [[ -r $2 ]]; then
sort "$2" > "$tmp_list"
else
pacman -Sl "$2" | cut -d' ' -f2 | sort > "$tmp_list"
fi
# Also take commented-out items into account
2013-12-08 13:50:17 +00:00
grep -oP '^(?:[;#]\s*)?\[.*(?=]$)' "$config" | sed 's/^\([;#]\s*\)\?\[//;/^__/d' | sort > "$tmp_configured"
echo ">>> Un-monitored list:"
comm -23 "$tmp_list" "$tmp_configured"
echo
echo ">>> Monitored but not in list:"
comm -13 "$tmp_list" "$tmp_configured"
echo