[Fai-commit] r5514 - trunk/lib

Thomas Lange lange at alioth.debian.org
Wed Sep 23 14:19:53 UTC 2009


Author: lange
Date: 2009-09-23 14:19:53 +0000 (Wed, 23 Sep 2009)
New Revision: 5514

Modified:
   trunk/lib/subroutines
   trunk/lib/subroutines-linux
Log:
add comments, remove trailing whitespace, move subroutine to different
file, no changes in code


Modified: trunk/lib/subroutines
===================================================================
--- trunk/lib/subroutines	2009-09-23 13:44:25 UTC (rev 5513)
+++ trunk/lib/subroutines	2009-09-23 14:19:53 UTC (rev 5514)
@@ -21,7 +21,7 @@
 # WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 # General Public License for more details.
-# 
+#
 # A copy of the GNU General Public License is available as
 # `/usr/share/common-licences/GPL' in the Debian GNU/Linux distribution
 # or on the World Wide Web at http://www.gnu.org/copyleft/gpl.html.  You
@@ -77,7 +77,7 @@
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 rwmount() {
 
-    # remount partition read/write
+    # remount partition read/write, for interactive use only
     mount -o rw,remount $1
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -86,6 +86,12 @@
     dmesg > $LOGDIR/dmesg.log
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+jobsrunning() {
+
+    # test if jobs are running
+    ps r | egrep -qv "ps r|TIME COMMAND|rcS"
+}
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 wait_for_jobs() {
 
     # can be an extern script
@@ -154,7 +160,7 @@
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ### BEGIN SUBROUTINE INFO
-# Provides-Var:      
+# Provides-Var:
 # Required-Var:      $classes $debug
 # Short-Description: call a hook, hook.source can define additional variables
 ### END SUBROUTINE INFO
@@ -198,7 +204,7 @@
     local task
 
     for task in "$@"; do
-	> $LOGDIR/skip.$task
+	echo > $LOGDIR/skip.$task # create file with size != 0
     done
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -228,17 +234,6 @@
     # source user specific subroutines
     [ -f $FAI/hooks/subroutines ] && . $FAI/hooks/subroutines
 
-    # warn user if cdrom has DMA not enabled
-    if [ -f /etc/RUNNING_FROM_FAICD ]; then
-	local cdrom=$(mount| awk '/dev.+on \/ /{print $1}')
-	if [ -n "$cdrom" ]; then
-	    hdparm -d $cdrom | grep -q off 2>/dev/null
-	    if [ $? -eq 0 ]; then
-		echo "WARNING: CD-ROM does not use DMA mode. The installation will be sloooow."
-	    fi
-	fi
-    fi
-
     define_fai_flags
 
     # this may be moved to an external script
@@ -252,7 +247,7 @@
 	    openvt -c2 /bin/bash ; openvt -c3 /bin/bash
 	    trap 'echo "You can reboot with faireboot";bash' INT QUIT
         }
-    
+
         # start secure shell daemon for remote access
         mkdir -p /var/run/sshd # ubuntu fix for 9.10
 	[ "$flag_sshd" -a -x /usr/sbin/sshd ] && /usr/sbin/sshd
@@ -275,11 +270,11 @@
 	echo "No action in \$FAI_ACTION defined."
 	sendmon "TASKERROR action 21"
 	task_faiend
-	exit 
+	exit
     fi
+
     echo "FAI_ACTION: $FAI_ACTION"
     case $FAI_ACTION in
-
 	install)
 	    if [ $do_init_tasks -eq 0 ]; then
 		echo "Cowardly refusing to run a FAI installation on a running system."
@@ -329,7 +324,7 @@
 
     if [ ! -d $FAI/class ]; then
 	sendmon "TASKERROR defclass 21"
-	echo "Directory $FAI/class not found. Following subdirectories are found:"
+	echo "Subdirectory $FAI/class missing in config space. Following subdirectories are found:"
 	find $FAI -maxdepth 1 -type d -printf "%p\n"
 	die "Aborting."
     fi
@@ -360,7 +355,7 @@
 
     local showvar=1 # TODO: new FAI_FLAG or always set when verbose is used
     [ "$showvar" ] && set -x
-    . $1 </dev/null 
+    . $1 </dev/null
     [ "$showvar" ] && set +x
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -373,14 +368,14 @@
 	if [ -f $class.var -a -r $class.var ]; then
 	    [ "$verbose" ] && echo "Executing $class.var"
 	    # show only lines with ++, we cannot use a pipe, since it would call
-	    # _devfar in a subprocess. Then, variables are not defined 
+	    # _devfar in a subprocess. Then, variables are not defined
 	    _defvar $class.var > $svar 2>&1
 	    grep ^++ $svar
 	    rm $svar
 	fi
     done
 
-    # /fai/class/S* scripts or hooks can write variable definitions
+    # /fai/class/* scripts or hooks can write variable definitions
     # to additonal.var. now source these definitions
     if [ -f $LOGDIR/additional.var -a -r $LOGDIR/additional.var ]; then
 	_defvar $LOGDIR/additional.var > $svar 2>&1
@@ -426,8 +421,7 @@
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 task_savelog() {
 
-    mkdir -p $FAI_ROOT/var/lib/fai
-    mkdir -p $FAI_ROOT/var/log/fai
+    mkdir -p $FAI_ROOT/var/{lib,log}/fai
     fai-savelog -l
     [ -f $LOGDIR/FAI_CLASSES ] && cp -pu $LOGDIR/FAI_CLASSES $FAI_ROOT/var/lib/fai
     [ -f $LOGDIR/disk_var.sh ] && cp -pu $LOGDIR/disk_var.sh $FAI_ROOT/var/lib/fai
@@ -496,8 +490,7 @@
     task chboot
 
     rm -f $stamp
-    # save again, because new messages could be created
-    save_dmesg
+    save_dmesg    # save again, because new messages could be created
     task savelog
 
     if [ -f $stamp ]; then
@@ -574,7 +567,7 @@
     # the following copy operation is required to make $LOGDIR a reliable source
     # for disk_var.sh
     # use the last disk_var during update if available
-    [ -f /var/lib/fai/disk_var.sh ] && cp -p /var/lib/fai/disk_var.sh $LOGDIR 
+    [ -f /var/lib/fai/disk_var.sh ] && cp -p /var/lib/fai/disk_var.sh $LOGDIR
 
     defnop wait_for_jobs
     save_dmesg

Modified: trunk/lib/subroutines-linux
===================================================================
--- trunk/lib/subroutines-linux	2009-09-23 13:44:25 UTC (rev 5513)
+++ trunk/lib/subroutines-linux	2009-09-23 14:19:53 UTC (rev 5514)
@@ -12,7 +12,7 @@
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ### BEGIN SUBROUTINE INFO
 # Provides-Var:    $device_size $disklist
-# Requires-Var:    
+# Requires-Var:
 # Short-Description: create list of available disks and their sizes
 ### END SUBROUTINE INFO
 
@@ -25,12 +25,6 @@
     disklist=$(list_disks $device_size | sort)
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-jobsrunning() {
-
-    # test if jobs are running
-    ps r | egrep -qv "ps r|TIME COMMAND|rcS"
-}
-# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 eval_cmdline() {
 
     # parse kernel parameters and define variables
@@ -66,13 +60,11 @@
 task_confdir() {
 
     if [ $do_init_tasks -eq 1 ] ; then
-        local bootlog
         eval_cmdline
 
-        bootlog=$LOGDIR/boot.log
         get-boot-info
-        echo "Reading $bootlog"
-        . $bootlog
+        echo "Reading $LOGDIR/boot.log"
+        . $LOGDIR/boot.log
         unset T170 T171 T172 ROOT_PATH BOOTFILE
 
 	printk=${printk:-6}
@@ -104,7 +96,9 @@
 	echo "Problems accessing the config space."
 	die ""
     }
+
     # now you have enough time to make changes to the config space
+    # only for debugging
     if [ -n "$flag_wait" ]; then
 	echo "Sleeping. Now you may change the config space in $FAI."
 	echo "Continue after killall sleep."
@@ -122,7 +116,7 @@
 
     if [ X$USE_SETUP_STORAGE = X1 ]; then
 	echo "Partitioning local harddisks using setup-storage"
-	[ ! -s $LOGDIR/disk_var.sh ] && setup-storage -X 2>&1 | tee $LOGDIR/format.log 
+	[ ! -s $LOGDIR/disk_var.sh ] && setup-storage -X 2>&1 | tee $LOGDIR/format.log
     else
 	echo "Partitioning local harddisks using setup_harddisks"
 	[ ! -s $LOGDIR/disk_var.sh ] && setup_harddisks -d -X 2>&1 | tee $LOGDIR/format.log
@@ -142,12 +136,12 @@
 ### BEGIN SUBROUTINE INFO
 # Provides-Var:    none
 # Requires-Var:    $NFSROOT
-# Suggests-Var:    
+# Suggests-Var:
 # Short-Description: <task desc.>
 ### END SUBROUTINE INFO
 
 call_debootstrap() {
-    
+
     local dversion=$(dpkg -l debootstrap | grep debootstrap | cut -f7 -d' ')
     echo "Creating base system using debootstrap version $dversion"
     echo "Calling debootstrap $FAI_DEBOOTSTRAP_OPTS $1 $FAI_ROOT $2"
@@ -188,7 +182,7 @@
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ### BEGIN SUBROUTINE INFO
-# Provides-Var:    
+# Provides-Var:
 # Requires-Var:    $FAI_ROOT $MNTPOINT $romountopt
 # Suggests-Var:    $FAI_DEBMIRROR $debug
 # Short-Description: <task desc.>
@@ -303,11 +297,10 @@
 
     [ -z "$LOGUSER" ] && return # silently return from subroutine
 
-    local frsh
+    local frsh remotesh
     local doexit=0
     local hostname=$(hostname)
     local ipaddr=$(grep IPADDR $LOGDIR/boot.log | cut -d= -f2 | sed "s/'//g")
-    local remotesh
     local nexttest=$(egrep -s ^NEXTTEST= $LOGDIR/test.log | cut -d= -f2)
 
     case "$FAI_LOGPROTO" in




More information about the Fai-commit mailing list