From 4a206ac9fde652787ba0fcafb15e54e9481aabab Mon Sep 17 00:00:00 2001 From: Olivier Mehani Date: Sat, 3 Sep 2016 14:09:37 +1000 Subject: [PATCH] [deborphan] New plugin counting orphaned packages in all sections Signed-off-by: Olivier Mehani --- plugins/system/deborphan | 64 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100755 plugins/system/deborphan diff --git a/plugins/system/deborphan b/plugins/system/deborphan new file mode 100755 index 00000000..19eafee2 --- /dev/null +++ b/plugins/system/deborphan @@ -0,0 +1,64 @@ +#!/bin/bash +# +# Plugin to monitor the number of orphaned packages on the +# system (using deborphan). Might work on section distib, who knows... +# +# Based on the debsecan plugin by Nicolas Bouthors. 2016-09-02 +# +# Olivie Mehani +# +# Licence : GPLv2 +# +#%# family=auto +#%# capabilities=autoconf + +# Auto enable if we have deborphan only +if [ "$1" = "autoconf" ] ; then + if [ -x /usr/bin/deborphan ]; then + echo yes + else + echo no + fi + exit 0 +fi + +# Fail if we don't have deborphan +if [ ! -x /usr/bin/deborphan ]; then + exit 1 +fi + +OUT=`mktemp -t deborphan.XXXXXX` +deborphan --show-section --guess-all | sed 's/\//_/' | sort > ${OUT} + +CATEGORIES="$(sed 's/ .*//' ${OUT} | uniq)" + +if [ "$1" = "config" ]; then + cat < ${TMP} + echo "${cat}.value `cat ${TMP} | wc -l`" + echo "${cat}.extinfo `echo $(cat ${TMP})`" + rm ${TMP} + done +fi + +rm -f ${OUT}