]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
deal with master + develop builds
authorHolger Levsen <holger@layer-acht.org>
Tue, 16 Oct 2012 17:44:52 +0000 (19:44 +0200)
committerHolger Levsen <holger@layer-acht.org>
Tue, 16 Oct 2012 17:44:52 +0000 (19:44 +0200)
extract_storage_kernel+modules.sh

index 416edecc7aa0cc84dbdd5da81e81c85119817fe3..b3f6253826a9b44b51f20c5228b108dc62a77bc6 100755 (executable)
@@ -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"