]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
finally, trap sudo
authorHolger Levsen <holger@layer-acht.org>
Thu, 25 Oct 2012 14:50:15 +0000 (16:50 +0200)
committerHolger Levsen <holger@layer-acht.org>
Thu, 25 Oct 2012 14:50:15 +0000 (16:50 +0200)
liveboot_build.sh

index 9babfeed805f2f1451303e6438cbc27e288ebf5a..66b87bb87ef785bf6d8b22ffe063a694a2cae36e 100755 (executable)
@@ -9,6 +9,7 @@ set_failure() {
         exit 1
 }
 
+set -x
 export
 
 if [ "$REQUEST_ID" = "" ] ; then 
@@ -48,9 +49,11 @@ trap set_failure INT TERM EXIT ERR KILL STOP HUP ABRT
 
 #
 # build liveboot
-#
-sudo pbuilder --execute --bindmounts /srv/build/ -- $BUILD_SCRIPT
-rm $BUILD_SCRIPT
+# (sudo is called from within a(nother) script as it's not possible to trap sudo directly
+# 
+echo "sudo pbuilder --execute --bindmounts /srv/build/ -- $BUILD_SCRIPT" > ${BUILD_SCRIPT}_sudo
+bash -x ${BUILD_SCRIPT}_sudo
+rm $BUILD_SCRIPT ${BUILD_SCRIPT}_sudo
 
 #
 # add liveboot build result to cidb