From 76c834d3d2ba9a1089798eb3748a259b5e334691 Mon Sep 17 00:00:00 2001 From: lilydjwg Date: Wed, 25 Sep 2013 14:38:36 +0800 Subject: [PATCH] add helper scripts: arch_repopkg_unmonitored --- scripts/README.rst | 1 + scripts/arch_repopkg_unmonitored | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 scripts/README.rst create mode 100755 scripts/arch_repopkg_unmonitored diff --git a/scripts/README.rst b/scripts/README.rst new file mode 100644 index 0000000..2fd6144 --- /dev/null +++ b/scripts/README.rst @@ -0,0 +1 @@ +Additional scripts may help someone. diff --git a/scripts/arch_repopkg_unmonitored b/scripts/arch_repopkg_unmonitored new file mode 100755 index 0000000..dc06622 --- /dev/null +++ b/scripts/arch_repopkg_unmonitored @@ -0,0 +1,29 @@ +#!/bin/bash -e + +if [[ $# -ne 2 || ! -r $1 || -z $2 ]]; then + echo >&2 "usage: arch_repopkg_unmonitored config.ini pkg_list or repository_namee" + 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 +grep -oP '^(?:[;#]\s*)?\[.*(?=]$)' "$config" | sed 's/^\([;#]\s*\)\?\[//' | 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