Diff of /trunk/wharfie/lib/makefile.py [r14] .. [r15]  Maximize  Restore

Switch to side-by-side view

--- a/trunk/wharfie/lib/makefile.py
+++ b/trunk/wharfie/lib/makefile.py
@@ -25,8 +25,8 @@
 # We use templates, which are checking their execution context,
 # to be sure, that target commands are really only executed
 # in the change root of the image.
-templateTrgCmd = "#!/bin/bash\n[ -f ../Wharfile ] && exit 2;\n%s\n"
-templateHostCmd = "#!/bin/bash\n[ ! -f ../Wharfile ] && exit 2;\n%s"
+templateTrgCmd = "#!/bin/bash\n[ -f ../Wharfile ] && exit 2;\n%s\nexit \$$?\n"
+templateHostCmd = "#!/bin/bash\n[ ! -f ../Wharfile ] && exit 2;\n%s\nexit \$$?\n"
 
 archiveName = 'rootfs.tar';
 makeTargets = list();
@@ -39,7 +39,7 @@
 def write_makefile(filename, dry_run, installpath='.'):
     f = open(filename, 'w');
     # write header
-    f.write("ifneq (VERBOSE,y)\n")
+    f.write("ifneq (${VERBOSE},y)\n")
     f.write("Q=@\n")
     f.write("endif\n")
     f.write("\n")
@@ -82,8 +82,8 @@
         
         f.write("cd $$(basename $@ .tar); tar -xf ../$<; "); 
         if not dry_run:
-            f.write("[ -f .trg.sh ] && chroot . ./.trg.sh; rm -f ./.trg.sh; ");
-            f.write("[ -f .hst.sh ] && ./.hst.sh; rm -f ./.hst.sh; ");
+            f.write("if [ -f .trg.sh ]; then chroot . ./.trg.sh || exit 1; fi; rm -f ./.trg.sh;");
+            f.write("if [ -f .hst.sh ]; then ./.hst.sh || exit 1; fi; rm -f ./.hst.sh;");
         if not 'temporary' in target or not target['temporary']:
             f.write("tar -cf '../$@' .;");
         f.write("\"\n");