[Collab-qa-commits] r1317 - upload-history

filippo at alioth.debian.org filippo at alioth.debian.org
Sat Oct 4 18:30:29 UTC 2008


Author: filippo
Date: 2008-10-04 18:30:29 +0000 (Sat, 04 Oct 2008)
New Revision: 1317

Added:
   upload-history/update_from_message.sh
Log:
add script subscribed to d-d-a

Added: upload-history/update_from_message.sh
===================================================================
--- upload-history/update_from_message.sh	                        (rev 0)
+++ upload-history/update_from_message.sh	2008-10-04 18:30:29 UTC (rev 1317)
@@ -0,0 +1,45 @@
+#!/bin/bash -xe
+# script subscribed to d-d-changes, takes an email messagge from d-d-changes on
+# stdin and invokes munge_ddc
+
+targetdir="$HOME/public_html/ddc/"
+#targetdir="$HOME/tmp/ddc/"
+
+export KEYRING_DIR="/home/filippo/munge-ddc/keyrings/"
+
+function cleanup {
+	[ -e $tmpfile ] && rm --force $tmpfile
+	exit 0
+}
+trap cleanup SIGHUP SIGINT SIGPIPE SIGTERM QUIT
+
+tmpfile=$(mktemp) || { echo "$0: creation of temporary file failed!"; exit 1; }
+
+cat /dev/stdin > $tmpfile
+
+date=$(sed -ne 's/^Date: \(.\+\)/\1/p' $tmpfile | head -1)
+
+d=$(date -d"$date" +%d)
+
+# handle rotation
+if [ $d -eq 1 ]; then
+	m=$(date -d "$date 2 days ago" +%m)
+	y=$(date -d "$date 2 days ago" +%Y)
+
+	base="debian-devel-changes.$y$m"
+		
+	[ -e $targetdir/$base.gz ] || gzip -9 $targetdir/$base 
+	chmod a+r $targetdir/$base.gz	
+fi
+
+m=$(date -d"$date" +%m)
+y=$(date -d"$date" +%Y)
+
+base="debian-devel-changes.$y$m"
+
+./munge_ddc.py $tmpfile >> $targetdir/$base
+
+# XXX check umask instead
+chmod a+r $targetdir/$base
+
+[ -e $tmpfile ] && rm --force $tmpfile


Property changes on: upload-history/update_from_message.sh
___________________________________________________________________
Name: svn:executable
   + *




More information about the Collab-qa-commits mailing list