[Fai-commit] r5386 - trunk/bin

Thomas Lange lange at alioth.debian.org
Sat May 2 23:06:40 UTC 2009


Author: lange
Date: 2009-05-02 23:06:40 +0000 (Sat, 02 May 2009)
New Revision: 5386

Modified:
   trunk/bin/fai-cd
Log:
replace if-then construct with  [ ] && return
this saves one indentation level


Modified: trunk/bin/fai-cd
===================================================================
--- trunk/bin/fai-cd	2009-05-02 22:58:51 UTC (rev 5385)
+++ trunk/bin/fai-cd	2009-05-02 23:06:40 UTC (rev 5386)
@@ -131,38 +131,38 @@
 # - - - - - - - - - - - - - - - - - - - - - - - - - -
 mkiso() {
 
-    if [ $makeiso -eq 1 ]; then
-	echo "Writing FAI CD-ROM image to $isoname. This may need some time."
-	mkisofs --iso-level 4 -V "$vname" -A "$aname" -log-file /dev/null -quiet -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o $isoname $tmp || die 12 "mkisofs failed." 
-	echo -n "ISO image size and filename: "; du -h $isoname
-    fi
+    [ $makeiso -eq 0 ] && return
+
+    echo "Writing FAI CD-ROM image to $isoname. This may need some time."
+    mkisofs --iso-level 4 -V "$vname" -A "$aname" -log-file /dev/null -quiet -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o $isoname $tmp || die 12 "mkisofs failed." 
+    echo -n "ISO image size and filename: "; du -h $isoname
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - -
 mkusb(){
 
-    if [ $makeusb -eq 1 ]; then
-	# TODO: If usbdir is a device (matches /dev/) mount it
-	[ -d $usbdir ] || die 17 "$usbdir does not exist."
-	if [ $rsync -eq 1 ]; then
-	    echo "Syncing FAI data to USB device $usbdir"
-	    rsync --delete -av $tmp/live $tmp/boot $usbdir || true
-	else
-	    echo "Writing FAI data to USB device $usbdir"
-	    cp -a $tmp/live $tmp/boot $usbdir 2>/dev/null || true
-	fi
-	echo $isoversion > $usbdir/.FAI-CD-VERSION
+    [ $makeusb -eq 0 ] && return
 
-	# now make the USB device bootable
-	rootpartition=$(find_fai_data)
-	usbdev=$(echo $rootpartition | sed -e 's/,[[:digit:]]//')
-	echo "Root partition is $rootpartition, device is: $usbdev"
-	if [ -n "$rootpartition" -a -n "$usbdev" ]; then
-	    echo "Installing grub."
-	    echo -e "root $rootpartition\n setup $usbdev" | grub --batch >/dev/null
-	else
-	    echo "Device could not be detemined. Installing grub will be skipped."
-	fi
+    # TODO: If usbdir is a device (matches /dev/) mount it
+    [ -d $usbdir ] || die 17 "$usbdir does not exist."
+    if [ $rsync -eq 1 ]; then
+	echo "Syncing FAI data to USB device $usbdir"
+	rsync --delete -av $tmp/live $tmp/boot $usbdir || true
+    else
+	echo "Writing FAI data to USB device $usbdir"
+	cp -a $tmp/live $tmp/boot $usbdir 2>/dev/null || true
     fi
+    echo $isoversion > $usbdir/.FAI-CD-VERSION
+
+    # now make the USB device bootable
+    rootpartition=$(find_fai_data)
+    usbdev=$(echo $rootpartition | sed -e 's/,[[:digit:]]//')
+    echo "Root partition is $rootpartition, device is: $usbdev"
+    if [ -n "$rootpartition" -a -n "$usbdev" ]; then
+	echo "Installing grub."
+	echo -e "root $rootpartition\n setup $usbdev" | grub --batch >/dev/null
+    else
+	echo "Device could not be detemined. Installing grub will be skipped."
+    fi
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - -
 create_iso() {




More information about the Fai-commit mailing list