[Fai-commit] r3949 - trunk/bin

fai-commit at lists.alioth.debian.org fai-commit at lists.alioth.debian.org
Wed Sep 13 16:47:26 UTC 2006


Author: lange
Date: 2006-09-13 16:47:26 +0000 (Wed, 13 Sep 2006)
New Revision: 3949

Modified:
   trunk/bin/fai
   trunk/bin/fai-cd
   trunk/bin/fai-mirror
   trunk/bin/make-fai-bootfloppy
   trunk/bin/make-fai-nfsroot
Log:
print message if FAI_ETC_DIR was set and will be used and not
overwritten by -C


Modified: trunk/bin/fai
===================================================================
--- trunk/bin/fai	2006-09-13 15:38:37 UTC (rev 3948)
+++ trunk/bin/fai	2006-09-13 16:47:26 UTC (rev 3949)
@@ -134,7 +134,8 @@
 fstart() {
 
     # these tasks can define variables, that are needed later
-    echo $etc_message
+    echo "$etc_message"
+    echo "Using configuration files from $FAI_ETC_DIR"
     unset etc_message
     task confdir
     task setup
@@ -198,11 +199,12 @@
 # use FAI_ETC_DIR from environment variable
 if [ -n "$FAI_ETC_DIR" -a -z "$cfdir" ]; then
     # print this message later so it gets into the log files
-    etc_message="Using $FAI_ETC_DIR as FAI_ETC_DIR."
+    etc_message="Using environment variable \$FAI_ETC_DIR."
 fi
 [ -n "$cfdir" ] && FAI_ETC_DIR=$cfdir
 unset cfdir
 : ${FAI_ETC_DIR:=/etc/fai}
+FAI_ETC_DIR=$(readlink -f $FAI_ETC_DIR) # canonicalize path
 export FAI_ETC_DIR
 
 # override FAI_ACTION later if a command line argument is given

Modified: trunk/bin/fai-cd
===================================================================
--- trunk/bin/fai-cd	2006-09-13 15:38:37 UTC (rev 3948)
+++ trunk/bin/fai-cd	2006-09-13 16:47:26 UTC (rev 3949)
@@ -172,8 +172,6 @@
        *) die 11 "fai-cd only works on i386 and maybe on amd64 architecture. Exiting."
 esac
 
-# use environment variable if defined
-[ -n "$FAI_ETC_DIR" ] && cfdir=$FAI_ETC_DIR
 # Parse commandline options
 while getopts "hg:bm:C:" opt ; do
     case "$opt" in
@@ -197,9 +195,17 @@
 [ -x "$(which mkinitrd-cd)" ] || die 7 "mkinitrd-cd not found. Please install package."
 [ -x "$(which mkisofs)" ] || die 8 "mkisofs not found. Please install package."
 
-[ -z "$cfdir" ] && cfdir=/etc/fai
-[ ! -d "$cfdir" ] && die 17 "$cfdir is not a directory."
-[ "$verbose" ] && echo "Using configuration files from directory $cfdir"
+# use FAI_ETC_DIR from environment variable
+if [ -n "$FAI_ETC_DIR" -a -z "$cfdir" ]; then
+    echo "Using environment variable \$FAI_ETC_DIR."
+fi
+cfdir=${FAI_ETC_DIR:=/etc/fai}
+cfdir=$(readlink -f $cfdir) # canonicalize path
+if [ ! -d "$cfdir" ]; then
+    echo "$cfdir is not a directory"
+    exit 6
+fi
+[ "$verbose" ] && echo "Using configuration files from $cfdir"
 . $cfdir/fai.conf
 export NFSROOT=$(source $cfdir/make-fai-nfsroot.conf; echo $NFSROOT)
 [ -d "$NFSROOT/etc/fai" ] || die 10 "Please create NFSROOT by calling make-fai-nfsroot or fai-setup."
@@ -210,7 +216,7 @@
 else
     grub_config="$cfdir/$grub_config"
 fi
-[ -f "$grub_config" ] || die 6 "Grub menu file $grub_config not found."
+[ -f "$grub_config" ] || die 13 "Grub menu file $grub_config not found."
 
 [ -z "$FAI_CONFIGDIR" ]  && die 14 "Variable \$FAI_CONFIG not set."
 [ -d $FAI_CONFIGDIR ] || die 15 "Can't find config space $FAI_CONFIGDIR."

Modified: trunk/bin/fai-mirror
===================================================================
--- trunk/bin/fai-mirror	2006-09-13 15:38:37 UTC (rev 3948)
+++ trunk/bin/fai-mirror	2006-09-13 16:47:26 UTC (rev 3949)
@@ -25,7 +25,7 @@
 # MA 02111-1307, USA.
 #*********************************************************************
 
-version="Version 1.9.1, 12-sep-2006"
+version="Version 1.9.2, 13-sep-2006"
 
 # variables: NFSROOT, FAI_CONFIGDIR
 
@@ -216,8 +216,6 @@
 
 [ -x "$(which apt-move)" ] || die 5 "apt-move not found. Please install package."
 
-# use environment variable if defined
-[ -n "$FAI_ETC_DIR" ] && cfdir=$FAI_ETC_DIR
 preserve=0
 verbose=0
 add=1
@@ -236,12 +234,17 @@
 done
 shift $(($OPTIND - 1))
 
-[ -z "$cfdir" ] && cfdir=/etc/fai
+# use FAI_ETC_DIR from environment variable
+if [ -n "$FAI_ETC_DIR" -a -z "$cfdir" ]; then
+    echo "Using environment variable \$FAI_ETC_DIR."
+fi
+cfdir=${FAI_ETC_DIR:=/etc/fai}
+cfdir=$(readlink -f $cfdir) # canonicalize path
 if [ ! -d "$cfdir" ]; then
     echo "$cfdir is not a directory"
     exit 6
 fi
-[ "$verbose" ] && echo "Using configuration files from directory $cfdir"
+[ "$verbose" ] && echo "Using configuration files from $cfdir"
 . $cfdir/fai.conf
 . $cfdir/make-fai-nfsroot.conf
 

Modified: trunk/bin/make-fai-bootfloppy
===================================================================
--- trunk/bin/make-fai-bootfloppy	2006-09-13 15:38:37 UTC (rev 3948)
+++ trunk/bin/make-fai-bootfloppy	2006-09-13 16:47:26 UTC (rev 3949)
@@ -27,11 +27,9 @@
 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #*********************************************************************
 
-version="Version 2.8.1, 12-september-2006"
+version="Version 2.8.2, 13-september-2006"
 set -e
 
-# use environment variable if defined
-[ -n "$FAI_ETC_DIR" ] && cfdir=$FAI_ETC_DIR
 timeout=15
 mkimage=0
 size=1440
@@ -319,12 +317,17 @@
 # additional kernel parameter
 params="$flags $@"
 
-[ -z "$cfdir" ] && cfdir=/etc/fai
+# use FAI_ETC_DIR from environment variable
+if [ -n "$FAI_ETC_DIR" -a -z "$cfdir" ]; then
+    echo "Using environment variable \$FAI_ETC_DIR."
+fi
+cfdir=${FAI_ETC_DIR:=/etc/fai}
+cfdir=$(readlink -f $cfdir) # canonicalize path
 if [ ! -d "$cfdir" ]; then
     echo "$cfdir is not a directory"
     exit 6
 fi
-[ "$verbose" ] && echo "Using configuration files from directory $cfdir."
+[ "$verbose" ] && echo "Using configuration files from $cfdir."
 #. $cfdir/fai.conf
 . $cfdir/make-fai-nfsroot.conf
 

Modified: trunk/bin/make-fai-nfsroot
===================================================================
--- trunk/bin/make-fai-nfsroot	2006-09-13 15:38:37 UTC (rev 3948)
+++ trunk/bin/make-fai-nfsroot	2006-09-13 16:47:26 UTC (rev 3949)
@@ -42,8 +42,6 @@
     exit 9
 fi
 
-# use environment variable if defined
-[ -n "$FAI_ETC_DIR" ] && cfdir=$FAI_ETC_DIR
 kfile="vmlinuz" # some architectures use different names
 kernelname="$kfile-install"
 merror="properly"
@@ -64,13 +62,17 @@
 
 set -e
 
-[ -z "$cfdir" ] && cfdir=/etc/fai
+# use FAI_ETC_DIR from environment variable
+if [ -n "$FAI_ETC_DIR" -a -z "$cfdir" ]; then
+    echo "Using environment variable \$FAI_ETC_DIR."
+fi
+cfdir=${FAI_ETC_DIR:=/etc/fai}
 cfdir=$(readlink -f $cfdir) # canonicalize path
 if [ ! -d "$cfdir" ]; then
     echo "$cfdir is not a directory"
     exit 6
 fi
-[ "$verbose" ] && echo "Using configuration files from directory $cfdir"
+[ "$verbose" ] && echo "Using configuration files from $cfdir"
 . $cfdir/fai.conf
 
 # read config file for this tool




More information about the Fai-commit mailing list