[Fai-commit] r6291 - in trunk/examples/simple: files/boot/grub/menu.lst scripts/CENTOS scripts/DEBIAN scripts/FAIBASE scripts/GRUB scripts/GRUB_PC scripts/LAST

Thomas Lange lange at alioth.debian.org
Sat Feb 12 17:53:29 UTC 2011


Author: lange
Date: 2011-02-12 17:53:27 +0000 (Sat, 12 Feb 2011)
New Revision: 6291

Modified:
   trunk/examples/simple/files/boot/grub/menu.lst/postinst
   trunk/examples/simple/scripts/CENTOS/10-security
   trunk/examples/simple/scripts/CENTOS/30-mkinitrd
   trunk/examples/simple/scripts/CENTOS/40-install-grub
   trunk/examples/simple/scripts/DEBIAN/10-keymap
   trunk/examples/simple/scripts/DEBIAN/10-rootpw
   trunk/examples/simple/scripts/DEBIAN/30-interface
   trunk/examples/simple/scripts/DEBIAN/40-misc
   trunk/examples/simple/scripts/FAIBASE/10-misc
   trunk/examples/simple/scripts/GRUB/10-setup
   trunk/examples/simple/scripts/GRUB/20-initramfs
   trunk/examples/simple/scripts/GRUB_PC/10-setup
   trunk/examples/simple/scripts/LAST/50-misc
Log:
new code for trap ERR, it now saves the maximum value of all errors

In the past the variable error was only set to 1, since a logical OR
was used inside the trap code. Now it compares the actual exit code $?
with the previous value of $error and saves the bigger of both back to $error


Modified: trunk/examples/simple/files/boot/grub/menu.lst/postinst
===================================================================
--- trunk/examples/simple/files/boot/grub/menu.lst/postinst	2011-02-12 09:32:57 UTC (rev 6290)
+++ trunk/examples/simple/files/boot/grub/menu.lst/postinst	2011-02-12 17:53:27 UTC (rev 6291)
@@ -1,6 +1,6 @@
 #! /bin/bash
 
-error=0 ; trap "error=$((error|1))" ERR
+error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
 
 set -a
 

Modified: trunk/examples/simple/scripts/CENTOS/10-security
===================================================================
--- trunk/examples/simple/scripts/CENTOS/10-security	2011-02-12 09:32:57 UTC (rev 6290)
+++ trunk/examples/simple/scripts/CENTOS/10-security	2011-02-12 17:53:27 UTC (rev 6291)
@@ -2,7 +2,7 @@
 
 # (c) Michael Goetze, 2010-11, mgoetze at mgoetze.net
 
-error=0 ; trap "error=$((error|1))" ERR
+error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
 
 $ROOTCMD authconfig --enableshadow --enablemd5 \
 	--enablelocauthorize --updateall

Modified: trunk/examples/simple/scripts/CENTOS/30-mkinitrd
===================================================================
--- trunk/examples/simple/scripts/CENTOS/30-mkinitrd	2011-02-12 09:32:57 UTC (rev 6290)
+++ trunk/examples/simple/scripts/CENTOS/30-mkinitrd	2011-02-12 17:53:27 UTC (rev 6291)
@@ -2,7 +2,7 @@
 
 # (c) Michael Goetze, 2010-2011, mgoetze at mgoetze.net
 
-error=0 ; trap "error=$((error|1))" ERR
+error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
 
 ainsl -v $target/etc/fstab "proc	/proc	proc	defaults	0 0"
 ainsl -v $target/etc/fstab "sysfs	/sys	sysfs	auto		0 0"

Modified: trunk/examples/simple/scripts/CENTOS/40-install-grub
===================================================================
--- trunk/examples/simple/scripts/CENTOS/40-install-grub	2011-02-12 09:32:57 UTC (rev 6290)
+++ trunk/examples/simple/scripts/CENTOS/40-install-grub	2011-02-12 17:53:27 UTC (rev 6291)
@@ -2,7 +2,7 @@
 
 # (c) Michael Goetze, 2011, mgoetze at mgoetze.net
 
-error=0 ; trap "error=$((error|1))" ERR
+error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
 
 if [ -r $LOGDIR/disk_var.sh ] ; then
 	. $LOGDIR/disk_var.sh

Modified: trunk/examples/simple/scripts/DEBIAN/10-keymap
===================================================================
--- trunk/examples/simple/scripts/DEBIAN/10-keymap	2011-02-12 09:32:57 UTC (rev 6290)
+++ trunk/examples/simple/scripts/DEBIAN/10-keymap	2011-02-12 17:53:27 UTC (rev 6291)
@@ -1,9 +1,9 @@
 #! /bin/bash
 
-# (c) Thomas Lange, 2001-2008, lange at debian.org
+# (c) Thomas Lange, 2001-2011, lange at debian.org
 # (c) Michael Goetze, 2010, mgoetze at mgoetze.net
 
-error=0 ; trap "error=$((error|1))" ERR
+error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
 
 # create keyboard layout table
 $ROOTCMD bash -c "echo 'console-data console-data/keymap/full select $KEYMAP' | debconf-set-selections"

Modified: trunk/examples/simple/scripts/DEBIAN/10-rootpw
===================================================================
--- trunk/examples/simple/scripts/DEBIAN/10-rootpw	2011-02-12 09:32:57 UTC (rev 6290)
+++ trunk/examples/simple/scripts/DEBIAN/10-rootpw	2011-02-12 17:53:27 UTC (rev 6291)
@@ -1,9 +1,9 @@
 #! /bin/bash
 
-# (c) Thomas Lange, 2001-2008, lange at debian.org
+# (c) Thomas Lange, 2001-2011, lange at debian.org
 # (c) Michael Goetze, 2010, mgoetze at mgoetze.net
 
-error=0 ; trap "error=$((error|1))" ERR
+error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
 
 # set root password
 $ROOTCMD usermod -p $ROOTPW root

Modified: trunk/examples/simple/scripts/DEBIAN/30-interface
===================================================================
--- trunk/examples/simple/scripts/DEBIAN/30-interface	2011-02-12 09:32:57 UTC (rev 6290)
+++ trunk/examples/simple/scripts/DEBIAN/30-interface	2011-02-12 17:53:27 UTC (rev 6291)
@@ -1,6 +1,6 @@
 #! /bin/bash
 
-error=0 ; trap "error=$((error|1))" ERR
+error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
 
 if ifclass DHCPC && [ $FAI_ACTION != "softupdate" ]
 then

Modified: trunk/examples/simple/scripts/DEBIAN/40-misc
===================================================================
--- trunk/examples/simple/scripts/DEBIAN/40-misc	2011-02-12 09:32:57 UTC (rev 6290)
+++ trunk/examples/simple/scripts/DEBIAN/40-misc	2011-02-12 17:53:27 UTC (rev 6291)
@@ -1,6 +1,6 @@
 #! /bin/bash
 
-error=0 ; trap "error=$((error|1))" ERR
+error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
 
 ainsl -av ${target}/etc/mailname ${HOSTNAME}
 sed -i -e "s/^UTC.*/UTC=${UTC}/" $target/etc/default/rcS

Modified: trunk/examples/simple/scripts/FAIBASE/10-misc
===================================================================
--- trunk/examples/simple/scripts/FAIBASE/10-misc	2011-02-12 09:32:57 UTC (rev 6290)
+++ trunk/examples/simple/scripts/FAIBASE/10-misc	2011-02-12 17:53:27 UTC (rev 6291)
@@ -1,9 +1,9 @@
 #! /bin/bash
 
-# (c) Thomas Lange, 2001-2008, lange at debian.org
+# (c) Thomas Lange, 2001-2011, lange at debian.org
 # (c) Michael Goetze, 2010-2011, mgoetze at mgoetze.net
 
-error=0 ; trap "error=$((error|1))" ERR
+error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
 
 # a list of modules which are loaded at boot time
 for module in $MODULESLIST; do

Modified: trunk/examples/simple/scripts/GRUB/10-setup
===================================================================
--- trunk/examples/simple/scripts/GRUB/10-setup	2011-02-12 09:32:57 UTC (rev 6290)
+++ trunk/examples/simple/scripts/GRUB/10-setup	2011-02-12 17:53:27 UTC (rev 6291)
@@ -1,6 +1,6 @@
 #! /bin/bash
 
-error=0 ; trap "error=$((error|1))" ERR
+error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
 
 fcopy -v /boot/grub/menu.lst
 

Modified: trunk/examples/simple/scripts/GRUB/20-initramfs
===================================================================
--- trunk/examples/simple/scripts/GRUB/20-initramfs	2011-02-12 09:32:57 UTC (rev 6290)
+++ trunk/examples/simple/scripts/GRUB/20-initramfs	2011-02-12 17:53:27 UTC (rev 6291)
@@ -1,6 +1,6 @@
 #! /bin/bash
 
-error=0 ; trap "error=$((error|1))" ERR
+error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
 
 not_up2date() {
   if [ $# -eq 0 ] ; then

Modified: trunk/examples/simple/scripts/GRUB_PC/10-setup
===================================================================
--- trunk/examples/simple/scripts/GRUB_PC/10-setup	2011-02-12 09:32:57 UTC (rev 6290)
+++ trunk/examples/simple/scripts/GRUB_PC/10-setup	2011-02-12 17:53:27 UTC (rev 6291)
@@ -1,7 +1,7 @@
 #! /bin/bash
 # support for GRUB version 2 (1.98-1)
 
-error=0 ; trap "error=$((error|1))" ERR
+error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
 
 set -a
 

Modified: trunk/examples/simple/scripts/LAST/50-misc
===================================================================
--- trunk/examples/simple/scripts/LAST/50-misc	2011-02-12 09:32:57 UTC (rev 6290)
+++ trunk/examples/simple/scripts/LAST/50-misc	2011-02-12 17:53:27 UTC (rev 6291)
@@ -1,8 +1,8 @@
 #! /bin/bash
 
-# copyright Thomas Lange 2001-2007, lange at debian.org
+# copyright Thomas Lange 2001-2011, lange at debian.org
 
-error=0 ; trap "error=$((error|1))" ERR
+error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
 
 # remove backup files from cfengine, but only if cfengine is installed
 if [ -x /usr/sbin/cfagent ] || [ -x $target/usr/sbin/cfagent ] ; then




More information about the Fai-commit mailing list