]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
make script more maintainable, provide stuf for setting build-id in the image
authorHolger Levsen <holger@layer-acht.org>
Fri, 22 Jun 2012 11:41:40 +0000 (13:41 +0200)
committerHolger Levsen <holger@layer-acht.org>
Fri, 22 Jun 2012 11:41:40 +0000 (13:41 +0200)
live_build.sh

index ccd53391fc9abd8aa1ca347047065c5ffc723454..ffc4a106de3229e4a7974e2d670fa598c05d443c 100755 (executable)
@@ -8,30 +8,36 @@ if [ "$LIVE_TYPE" == "" ] ; then
        exit 0
 fi
 
-figlet "building $LIVE_TYPE"
+BUILDDATE=$(date +%Y%m%d%H%M)
+TARGET_BASE=/srv/mirror/live-build
+
+BUILD_ID="${LIVE_TYPE}-${BUILDDATE}-${BUILD_NUMBER}"
+BUILD_TARGET=$TARGET_BASE/$BUILD_ID
+
+figlet "building $LIVE_TYPE with build_id $BUILD_ID"
 
 cd pserver.flexible
 sudo bash ./lb_build.sh mrproper
 sudo bash ./lb_build.sh -p office-proxy,$LIVE_TYPE
+#
+# TODO: echo $BUILD_ID > $live_buildchroot/etc/profitbricks-live-build-ID
+#
+
 ls -larth tftpboot/debian-live/amd64/
 ls -larth binary/live/
 
 figlet "success"
 
-BUILDDATE=$(date +%Y%m%d%H%M)
-
-BUILD_ID="${LIVE_TYPE}-${BUILDDATE}-${BUILD_NUMBER}"
-BUILD_TARGET=/srv/mirror/live-build/$BUILD_ID
-
 mkdir -p $BUILD_TARGET
 
 echo "Now copying results..."
 # hack to ignore 2.6.32 kernel + initrd
 cp -v tftpboot/debian-live/amd64/initrd.img-3* tftpboot/debian-live/amd64/vmlinuz-3* $BUILD_TARGET/
 cp -v binary/live/filesystem.squashfs $BUILD_TARGET/
+sort binary/live/filesystem.packages
 
 echo "Now rsyncing results to mgmt1..."
-rsync --password-file /etc/rsynclivebuild-send.pass -avv --delete /srv/mirror/live-build/ rsync://livebuild@10.1.1.1/livebuild/
+rsync --password-file /etc/rsynclivebuild-send.pass -avv --delete $TARGET_BASE/ rsync://livebuild@10.1.1.1/livebuild/
 
 figlet "rsync success"
 
@@ -39,7 +45,7 @@ figlet "rsync success"
 # cleanup /srv/mirror, keep MAX number of images
 # 
 MAX=10
-cd /srv/mirror/live-build/
+cd $TARGET_BASE
 COUNT=0
 for i in $(ls -artd1 ./${LIVE_TYPE}-*) ; do
        let COUNT=COUNT+1