[debian-edu-commits] r86192 - trunk/src/build/CD-administrator

pere at alioth.debian.org pere at alioth.debian.org
Fri Apr 24 07:58:09 UTC 2015


Author: pere
Date: 2015-04-24 07:58:09 +0000 (Fri, 24 Apr 2015)
New Revision: 86192

Modified:
   trunk/src/build/CD-administrator/build.sh
Log:
Try to make script more robust and report an error when exiting unexpectedly.

Modified: trunk/src/build/CD-administrator/build.sh
===================================================================
--- trunk/src/build/CD-administrator/build.sh	2015-04-23 22:15:39 UTC (rev 86191)
+++ trunk/src/build/CD-administrator/build.sh	2015-04-24 07:58:09 UTC (rev 86192)
@@ -33,12 +33,23 @@
 
 cleanup () {
 	set +e # Make sure we try to clean up as much as possible, even if there are errors.
-	rm -f $pidfile
+	if [ -e $pidfile ] ; ten
+	    echo "error: CD build exited unexpectedly"
+	    rm -f $pidfile
+	fi
 
 	# Save the log and useful files
 	cp $TDIR/$CODENAME/make_disc_tree.log $imgdir/.
 	for ARCH in $ARCHES ; do
-		cp $TDIR/$CODENAME/sort_deps.$ARCH.log $imgdir/. || cp $TDIR/$CODENAME/log.sort_deps.$ARCH $imgdir/. || cp $TDIR/$CODENAME/log.list2cds.$ARCH $imgdir/.
+		for f in \
+		    $TDIR/$CODENAME/sort_deps.$ARCH.log \
+		    $TDIR/$CODENAME/log.sort_deps.$ARCH \
+		    $TDIR/$CODENAME/log.list2cds.$ARCH \
+		    ; do
+		    if [ -e $f ] ; then
+			cp $f $imgdir/.
+		    fi
+		done
 	done
 	cp $logfile $imgdir/build.log
 	rm -f $logfile
@@ -151,9 +162,9 @@
 }
 
 if buildcd ; then
-	failed=""
+	failed=false
 else
-	failed=1
+	failed=true
 fi
 
 echo "Build finished on `date +%Y-%m-%dT%H:%M`"
@@ -204,11 +215,11 @@
 done
 
 
-if test ! -z "$failed" ; then
+if $failed ; then
 	if [ ! "$testbuild" ]; then
-		mail -s 'Etch CD build failed.' $mailto < $logfile
+		mail -s 'CD build failed.' $mailto < $logfile
 	else
-		echo 'Etch CD build failed.'
+		echo 'CD build failed.'
 	fi
 fi
 
@@ -219,7 +230,8 @@
 	fi
 }
 
-if test ! -z "$failed" ; then
+rm -f $pidfile
+if $failed ; then
 	overview failed
 	exit 1
 else




More information about the debian-edu-commits mailing list