[Fai-commit] r5612 - in trunk: bin debian lib

Thomas Lange lange at alioth.debian.org
Wed Oct 28 10:55:50 UTC 2009


Author: lange
Date: 2009-10-28 10:55:50 +0000 (Wed, 28 Oct 2009)
New Revision: 5612

Modified:
   trunk/bin/fai-mirror
   trunk/bin/fai-setup
   trunk/debian/changelog
   trunk/lib/fai-savelog
   trunk/lib/subroutines
Log:
set default values using bash : ${variable:=value}

Modified: trunk/bin/fai-mirror
===================================================================
--- trunk/bin/fai-mirror	2009-10-28 10:42:52 UTC (rev 5611)
+++ trunk/bin/fai-mirror	2009-10-28 10:55:50 UTC (rev 5612)
@@ -250,7 +250,8 @@
 [ -d $FAI_CONFIGDIR/package_config ] || die 6 "Can't find package config files in $FAI_CONFIGDIR."
 
 # set default if undefined
-[ -z "$MAXPACKAGES" ] && export MAXPACKAGES=1
+: ${MAXPACKAGES:=1}
+export MAXPACKAGES
 
 initialize
 

Modified: trunk/bin/fai-setup
===================================================================
--- trunk/bin/fai-setup	2009-10-28 10:42:52 UTC (rev 5611)
+++ trunk/bin/fai-setup	2009-10-28 10:55:50 UTC (rev 5612)
@@ -118,7 +118,7 @@
 	    ips=$(ip addr show up| grep -w inet | cut -d t -f 2 | cut -d ' ' -f 2 | grep -v 127.0.0.1)
 	    for ip in $ips; do
 		hname=$(getent hosts $ip| tr -s ' ' ',')
-		[ -z "$hname" ] && hname=$ip
+		: ${hname:=$ip}
 		echo "Adding $hname to known_hosts."
 		[ -z "$DSASERVER" ] || echo "$hname $DSASERVER" >> $sshdir/known_hosts
 		[ -z "$RSASERVER" ] || echo "$hname $RSASERVER" >> $sshdir/known_hosts

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2009-10-28 10:42:52 UTC (rev 5611)
+++ trunk/debian/changelog	2009-10-28 10:55:50 UTC (rev 5612)
@@ -117,6 +117,7 @@
   * Makefile: remove .svn directories in fai-doc
   * debian/source/format: use source package format 3.0 (native)
   * fix class FAISERVER
+  * set default values using bash : ${variable:=value}
   
   [ Michael Tautschnig ]
   * setup-storage, setup-storage/Exec.pm: auto-detect a proper way to tell

Modified: trunk/lib/fai-savelog
===================================================================
--- trunk/lib/fai-savelog	2009-10-28 10:42:52 UTC (rev 5611)
+++ trunk/lib/fai-savelog	2009-10-28 10:55:50 UTC (rev 5612)
@@ -89,7 +89,7 @@
 
     [ "$LOGUSER" ] || return
     # LOGSERVER is overridable until now
-    [ -z "$LOGSERVER" ] && LOGSERVER=$SERVER
+    : ${LOGSERVER:=$SERVER}
     [ "$LOGSERVER" ] || return
 
     case "$FAI_LOGPROTO" in
@@ -113,7 +113,7 @@
     cat <<EOF
 fai-savelog, save log files from fai to a local or remote location
 
-   Copyright (C) 2002-2007 by Thomas Lange
+   Copyright (C) 2002-2009 by Thomas Lange
 
 Usage: fai-savelog [OPTION]
 
@@ -128,7 +128,7 @@
 
 [ "$1" ] || usage
 
-[ -z "$FAI_ACTION" ] && FAI_ACTION=noaction
+: ${FAI_ACTION:=noaction}
 while getopts lr opt ; do
         case "$opt" in
         l) save_log_local ;;

Modified: trunk/lib/subroutines
===================================================================
--- trunk/lib/subroutines	2009-10-28 10:42:52 UTC (rev 5611)
+++ trunk/lib/subroutines	2009-10-28 10:55:50 UTC (rev 5612)
@@ -255,7 +255,7 @@
     unset flag_createvt flag_sshd
 
     # when did FAI start, using localtime
-    [ -z "$fai_rundate" ] && fai_rundate=$(date +'%Y%m%d_%H%M%S')
+    : ${fai_rundate:=$(date +'%Y%m%d_%H%M%S')}
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ### BEGIN SUBROUTINE INFO
@@ -436,7 +436,7 @@
     [ $do_init_tasks -eq 0 ] && exit 0
     wait_for_jobs
     echo "Press <RETURN> to reboot."
-    [ -z "$flag_reboot" ] && : ${flag_reboot:=0}
+    : ${flag_reboot:=0}
     [ -s $LOGDIR/error.log -a "$flag_reboot" -gt "0" ] && sleep 10
     # reboot without prompting if FAI_FLAG reboot is set
     sendmon "TASKEND faiend 0"
@@ -674,7 +674,7 @@
     define_fai_flags
 
     # check if monitor server is available
-    [ -z "$monserver" ] && monserver=$SERVER
+    : ${monserver:=$SERVER}
     if [ -z "$monserver" ]; then
 	echo "No monitor daemon defined."
 	faimond=0




More information about the Fai-commit mailing list