#
export DIST=squeeze
export PB_SUITE=production-proposed-updates
-RSYNC_SRC=/srv/mirror/liveboot
-RSYNC_FILTER=''
-
-# ri server
-RSYNC_DST1="liveboot@riserver/liveboot/"
-# storage DC (mgmt11)
-RSYNC_DST2="liveboot@10.251.1.1/liveboot/"
-# pbb (mgmt5)
-RSYNC_DST3="liveboot@10.254.1.1/liveboot/"
-# staging (mgmt9)
-RSYNC_DST4="liveboot@10.252.1.1/liveboot/"
-# dc1+2 (mgmt1)
-RSYNC_DST5="liveboot@10.1.1.1/liveboot/"
SCRIPTSDIR=$(dirname $0)
BUILD_SCRIPT=$(mktemp)
cd /srv/build/
sudo rm liveboot -Rf
-# TODO: implement better garbage collection, allow to keep images
-# TODO: needs to update the db too
-#
-# cleanup $RSYNC_SRC, keep MAX number of images
#
-MAX=15
-cd $RSYNC_SRC
-COUNT=0
-for i in $(ls -atd1 ./liveboot-*) ; do
- let COUNT=COUNT+1
- if [ $COUNT -gt $MAX ] ; then
- sudo rm -rfv ./$i
- else
- echo "keeping $i"
- fi
-done
-
-#
-# Mirror
+# remove trap to not set failure at the end :)
#
-echo
-echo "Now rsyncing results to $RSYNC_DST1 ..."
-rsync --password-file /etc/rsynclivebuild-send.pass -avv --delete --delete-excluded $RSYNC_FILTER $RSYNC_SRC/ rsync://$RSYNC_DST1
-figlet "mirror to r+i OK"
-echo "Now rsyncing results to $RSYNC_DST2 ..."
-rsync --password-file /etc/rsynclivebuild-send.pass -avv --delete --delete-excluded $RSYNC_FILTER $RSYNC_SRC/ rsync://$RSYNC_DST2
-figlet "mirror to storage-dc OK"
-echo "Now rsyncing results to $RSYNC_DST3 ..."
-rsync --password-file /etc/rsynclivebuild-send.pass -avv --delete --delete-excluded $RSYNC_FILTER $RSYNC_SRC/ rsync://$RSYNC_DST3
-figlet "mirror to pbb OK"
-echo "Now rsyncing results to $RSYNC_DST4 ..."
-rsync --password-file /etc/rsynclivebuild-send.pass -avv --delete --delete-excluded $RSYNC_FILTER $RSYNC_SRC/ rsync://$RSYNC_DST4
-figlet "mirror to staging OK"
-echo "Now rsyncing results to $RSYNC_DST5 ..."
-rsync --password-file /etc/rsynclivebuild-send.pass -avv --delete --delete-excluded $RSYNC_FILTER $RSYNC_SRC/ rsync://$RSYNC_DST5
-figlet "mirror to DC1+2 OK"
+trap - INT TERM EXIT
-du -sh /srv/mirror/liveboot
+# all is good, mother.
figlet "OK"
-#
-# remove trap to not set failure at the end :)
-#
-trap - INT TERM EXIT
--- /dev/null
+#!/bin/bash
+
+# copyright 2012 Holger Levsen <holger@layer-acht.org>
+# GPL2 licenced
+
+set -e
+#set -x
+export
+
+
+#
+# Define default settings
+#
+RSYNC_SRC=/srv/mirror/liveboot
+RSYNC_FILTER=''
+
+# ri server
+RSYNC_DST1="liveboot@riserver/liveboot/"
+# storage DC (mgmt11)
+RSYNC_DST2="liveboot@10.251.1.1/liveboot/"
+# pbb (mgmt5)
+RSYNC_DST3="liveboot@10.254.1.1/liveboot/"
+# staging (mgmt9)
+RSYNC_DST4="liveboot@10.252.1.1/liveboot/"
+# dc1+2 (mgmt1)
+RSYNC_DST5="liveboot@10.1.1.1/liveboot/"
+
+# TODO: implement better garbage collection, allow to keep images
+# TODO: needs to update the db too
+# FIXME: locking
+#
+# cleanup $RSYNC_SRC, keep MAX number of images
+#
+MAX=15
+cd $RSYNC_SRC
+COUNT=0
+for i in $(ls -atd1 ./liveboot-*) ; do
+ let COUNT=COUNT+1
+ if [ $COUNT -gt $MAX ] ; then
+ sudo rm -rfv ./$i
+ else
+ echo "keeping $i"
+ fi
+done
+
+#
+# Mirror
+#
+echo
+echo "Now rsyncing results to $RSYNC_DST1 ..."
+rsync --password-file /etc/rsynclivebuild-send.pass -avv --delete --delete-excluded $RSYNC_FILTER $RSYNC_SRC/ rsync://$RSYNC_DST1
+figlet "mirror to r+i OK"
+echo "Now rsyncing results to $RSYNC_DST2 ..."
+rsync --password-file /etc/rsynclivebuild-send.pass -avv --delete --delete-excluded $RSYNC_FILTER $RSYNC_SRC/ rsync://$RSYNC_DST2
+figlet "mirror to storage-dc OK"
+echo "Now rsyncing results to $RSYNC_DST3 ..."
+rsync --password-file /etc/rsynclivebuild-send.pass -avv --delete --delete-excluded $RSYNC_FILTER $RSYNC_SRC/ rsync://$RSYNC_DST3
+figlet "mirror to pbb OK"
+echo "Now rsyncing results to $RSYNC_DST4 ..."
+rsync --password-file /etc/rsynclivebuild-send.pass -avv --delete --delete-excluded $RSYNC_FILTER $RSYNC_SRC/ rsync://$RSYNC_DST4
+figlet "mirror to staging OK"
+echo "Now rsyncing results to $RSYNC_DST5 ..."
+rsync --password-file /etc/rsynclivebuild-send.pass -avv --delete --delete-excluded $RSYNC_FILTER $RSYNC_SRC/ rsync://$RSYNC_DST5
+figlet "mirror to DC1+2 OK"
+
+du -sh /srv/mirror/liveboot
+figlet "OK"
+