apt-feed-logbuch.sh
changeset 11 475f93aa63cb
parent 10 51b2226ad231
--- a/apt-feed-logbuch.sh	Thu Oct 25 09:03:59 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-#! /bin/sh
-#
-# automaticly update logbuch
-# if using apt-get or aptitude command
-#
-# (C) 2012 by Christian Arnold - Schlittermann internet & unix support
-
-set -e
-
-unset  LC_ALL
-export LANG=C
-export LC_CTYPE=en_US.UTF-8
-
-APT_LOG="/var/log/apt/history.log"
-LINES_COUNT="/tmp/lines_count.dat"
-LOGBUCH_OPT=""
-
-if test -f /etc/default/ius.upgrade.conf; then
-    . /etc/default/ius.upgrade.conf
-fi
-
-if ! test -f "$LINES_COUNT"; then
-    echo "$0: $LINES_COUNT is missing" >&2
-    exit 0
-fi
-
-if ! test -s "$LINES_COUNT"; then
-    echo "$0: $LINES_COUNT is empty" >&2
-    exit 0
-fi
-
-APT_CMD=$(ps -p $1 -o args=)
-
-# skip download-only from logbuch
-if echo $APT_CMD | grep -q "[[:space:]]\+-d\|-dy\|-yd\|--download-only"; then
-	exit 0
-fi
-
-APT_TMP="/tmp/$$.tmp"
-APT_OUT="/tmp/$$.out"
-
-if [ $APT_LOG -nt $LINES_COUNT ]; then
-  BEFOR=$(cat $LINES_COUNT)
-  AFTER=$(wc -l < $APT_LOG)
-  LINES=$(($AFTER - $BEFOR - 1))
-  echo APT: $APT_CMD > $APT_OUT
-  tail -n $LINES $APT_LOG | sed -e '/^Start-Date:/d;/^Commandline:/d;/^End-Date:/d' >> $APT_TMP
-  perl -ne 'chomp; ($action, $packages) = split " ", $_, 2; print map { "- $action $_\n" } $packages =~ /\S+\s\(.*?\)/g' $APT_TMP >> $APT_OUT
-  logbuch $LOGBUCH_OPT --message=@$APT_OUT
-  # cleanup
-  rm -f $APT_TMP $LINES_COUNT $APT_OUT
-fi