[Fai-commit] r5890 - in trunk: bin debian

Thomas Lange lange at alioth.debian.org
Wed Jul 28 20:29:25 UTC 2010


Author: lange
Date: 2010-07-28 20:29:22 +0000 (Wed, 28 Jul 2010)
New Revision: 5890

Modified:
   trunk/bin/fai-cd
   trunk/debian/changelog
Log:
fai-cd: add checks if package download succeeded

Modified: trunk/bin/fai-cd
===================================================================
--- trunk/bin/fai-cd	2010-07-28 19:53:44 UTC (rev 5889)
+++ trunk/bin/fai-cd	2010-07-28 20:29:22 UTC (rev 5890)
@@ -33,7 +33,7 @@
 
 set -e 
 
-# last die exit code 20
+# last die exit code 22
 
 grub_version=2
 boot_image="boot/grub/eltorito.img"
@@ -80,8 +80,13 @@
     else
 	# if grub1 is not available in NFSROOT, we download the package based on the current
 	# sources.list, unpack and use these files for further processing
+	# this does not work if file: URI's are used in sources.lst
 	apt-get -d install --reinstall grub >/dev/null
 	grubPackage=`ls -rt /var/cache/apt/archives/grub_*|tail -1`
+	if [ -z "$grubPackage" ]; then
+	    die 21 "Downloading grub failed."
+	fi
+
 	GRUBDIR=$tmp/grubPackage
 	echo "no grub1 installation found in NFSROOT, using downloaded $grubPackage"
 	mkdir -p $GRUBDIR
@@ -122,9 +127,12 @@
 	cp $NFSROOT/boot/grub/core.img $tmp/boot/grub
 	MODULEBASE=$NFSROOT/usr/lib/grub/
     else
-	apt-get -d install --reinstall grub-pc >/dev/null
+	echo "no grub2 installation found in NFSROOT, using downloaded $grubPackage"
+	apt-get -y -d install --reinstall grub-pc >/dev/null
 	grubPackage=`ls -rt /var/cache/apt/archives/grub-pc*|tail -1`
-	echo "no grub2 installation fount in NFSROOT, using downloaded $grubPackage"
+	if [ -z "$grubPackage" ]; then
+	    die 22 "Downloading grub2 failed."
+	fi
 	GRUBDIR=$tmp/grubPackage
 	mkdir -p $GRUBDIR
 	dpkg -x $grubPackage $GRUBDIR

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2010-07-28 19:53:44 UTC (rev 5889)
+++ trunk/debian/changelog	2010-07-28 20:29:22 UTC (rev 5890)
@@ -90,8 +90,9 @@
     inside $FAI_ROOT but are still registered in /etc/mtab outside of
     $FAI_ROOT, so let's get rid of them outside the chroot as well iff
     they are present
+  * fai-cd: add checks if package download succeeded
 
- -- Thomas Lange <lange at debian.org>  Fri, 09 Jul 2010 16:11:07 +0200
+ -- Thomas Lange <lange at debian.org>  Wed, 28 Jul 2010 16:28:51 -0400
 
 fai (3.3.5) unstable; urgency=high
 




More information about the Fai-commit mailing list