summaryrefslogtreecommitdiffstats
path: root/gitmirror/robot.sh
diff options
context:
space:
mode:
Diffstat (limited to 'gitmirror/robot.sh')
-rwxr-xr-xgitmirror/robot.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/gitmirror/robot.sh b/gitmirror/robot.sh
new file mode 100755
index 0000000..8f7a25c
--- /dev/null
+++ b/gitmirror/robot.sh
@@ -0,0 +1,37 @@
+#!/bin/bash -xe
+
+MAILTO='NASM commits list <nasm-cvs@lists.sourceforge.net>'
+#MAILTO='NASM commits list <hpa+nasm/cvs@zytor.com>'
+SENDER='nasmbuild@zytor.com'
+
+# /usr/sbin needed for sendmail
+export PATH=/bin:/usr/bin:/usr/local/bin:/usr/sbin:$HOME/bin
+
+(
+ flock -nx 8 || exit 0
+
+ mkdir -m 0700 -p /tmp/$USER
+
+ cd $HOME/gitmirror/git
+ git fetch
+ git reset --hard origin/master
+ git push -f zytor
+ git push --tags -f zytor
+
+ HEAD=$(git-rev-parse HEAD)
+ OLD_HEAD=$(cat ../LAST_EMAIL)
+
+ if [ x"$HEAD" != x"$OLD_HEAD" ]; then
+ mkdir -m 0700 /tmp/$USER/gitpatches.$$
+
+ # -k = no [PATCH], since we're sending to a mailing list.
+ git format-patch -M -C -C -k -o /tmp/gitpatches.$$ $OLD_HEAD..$HEAD
+
+ for f in /tmp/gitpatches.$$/*; do
+ ../robotfmt.pl "$MAILTO" < "$f" | sendmail -f "$SENDER" -t
+ done
+
+ echo "$HEAD" > ../LAST_EMAIL
+ rm -rf /tmp/$USER/gitpatches.$$
+ fi
+) 8< "$0"