From: Holger Levsen Date: Tue, 16 Oct 2012 17:44:52 +0000 (+0200) Subject: deal with master + develop builds X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=81a93eebb01cce03d37fa2c50474476fd1708c78;p=profitbricks%2Fjenkins-build-scripts.git deal with master + develop builds --- diff --git a/extract_storage_kernel+modules.sh b/extract_storage_kernel+modules.sh index 416edec..b3f6253 100755 --- a/extract_storage_kernel+modules.sh +++ b/extract_storage_kernel+modules.sh @@ -12,7 +12,18 @@ export # export DIST=squeeze export PB_SUITE=$DISTRIBUTION -export TARGET_DIR=/srv/storage-kernels +export TARGET_BASE=/srv/storage-kernels + +if [ "$DISTRIBUTION" = "production-proposed-updates" ] ; then + export $TARGET_DIR=$TARGET_BASE/master/$BUILD_NUMBER +elif [ "$DISTRIBUTION" = "pre-staging" ] ; then + export $TARGET_DIR=$TARGET_BASE/develop/$BUILD_NUMBER +else + echo "DISTRIBUTION must be 'production-proposed-updates' or 'pre-staging', exiting." + figlet "FAIL" + exit 1 +fi + SCRIPTSDIR=$(dirname $0) BUILD_SCRIPT=$(mktemp) cat > $BUILD_SCRIPT <<-EOF @@ -23,18 +34,18 @@ apt-get update # grub is needed in the postinst... apt-get install -y grub2 apt-get -y install profitbricks-andbd-modules-storage profitbricks-linux-image-storage || true -mkdir $TARGET_DIR/$BUILD_NUMBER -cp -v /boot/vmlinu* $TARGET_DIR/$BUILD_NUMBER/ -cp -v /boot/config* $TARGET_DIR/$BUILD_NUMBER/ +mkdir -p $TARGET_DIR +cp -v /boot/vmlinu* $TARGET_DIR/ +cp -v /boot/config* $TARGET_DIR/ cd /lib/modules/*storage/ -/bin/tar -cJvf $TARGET_DIR/$BUILD_NUMBER/modules.tar.xz . +/bin/tar -cJvf $TARGET_DIR/modules.tar.xz . EOF chmod +x $BUILD_SCRIPT # # build liveboot # -sudo pbuilder --execute --bindmounts $TARGET_DIR -- $BUILD_SCRIPT +sudo pbuilder --execute --bindmounts $TARGET_BASE -- $BUILD_SCRIPT rm $BUILD_SCRIPT @@ -43,21 +54,25 @@ rm $BUILD_SCRIPT # cleanup $TARGET_DIR, keep MAX number of images # MAX=15 -cd $TARGET_DIR -COUNT=0 -for i in $(ls -atd1) ; do - if [ "$i" != "." ] ; then - let COUNT=COUNT+1 - if [ $COUNT -gt $MAX ] ; then - echo sudo rm -rfv ./$i - else - echo "keeping $i" - fi - fi - if [ $COUNT -gt 0 ] ; then - figlet "Warning:" - echo "Garbage collection disabled." - fi +cd $TARGET_BASE +for suite in production-proposed-updates pre-staging ; do + cd $suite + COUNT=0 + for i in $(ls -atd1) ; do + if [ "$i" != "." ] ; then + let COUNT=COUNT+1 + if [ $COUNT -gt $MAX ] ; then + echo sudo rm -rfv ./$i + else + echo "keeping $i" + fi + fi + if [ $COUNT -gt 0 ] ; then + figlet "Warning:" + echo "Garbage collection disabled." + fi + done + cd .. done figlet "OK"