[debian-lan-devel] [SCM] Debian-LAN development and packaging branch, master, updated. 0.5-11-ge6cab97

Andreas B. Mundt andi.mundt at web.de
Wed Apr 11 11:34:34 UTC 2012


The following commit has been merged in the master branch:
commit e6cab97e464a1faa0f3aeaf611fbdb44bd872794
Author: Andreas B. Mundt <andi.mundt at web.de>
Date:   Wed Apr 11 13:16:40 2012 +0200

    Rework faiserver setup.  Add instructions for the diskless server.
    
    Create configuration for PXE boot dependent on the total number of
    workstations. The number is fetched from the $WS_RANGE variable.
    Diskless servers show a message how to install the chroot for the
    diskless machines after setting up the FAI nfsroot.  Helps and
    simplifies getting the system ready after installation.

diff --git a/fai/config/files/etc/rc.local/FAISERVER b/fai/config/files/etc/rc.local/FAISERVER
index bf932a7..b0840c1 100755
--- a/fai/config/files/etc/rc.local/FAISERVER
+++ b/fai/config/files/etc/rc.local/FAISERVER
@@ -3,17 +3,18 @@
 set -e
 
 ## Setup script run at boot time.
-## Removed after successful execution. 
+## Removed after successful execution.
 
 ############################
-# Remove to enable: 
-echo
-echo "====================================================================="
-echo "The nfsroot for FAI may be created by executing $0."
-echo "This can be done at boot time or manually."
-echo "To enable, remove the lines marked in $0 and"
-echo "reboot or execute $0."
-echo "====================================================================="
+# Remove to enable:
+cat <<EOF
+=====================================================================
+The nfsroot for FAI may be created by executing $0.
+This can be done at boot time or manually.
+To enable, remove the lines marked in $0 and
+reboot or execute $0.
+=====================================================================
+EOF
 exit 0
 ###########################
 
@@ -22,21 +23,28 @@ echo "Creating the nfsroot for FAI."
 . /etc/fai/fai.conf
 . /etc/fai/make-fai-nfsroot.conf
 
-if [ ! -d "$FAI_CONFIGDIR/class" ]; then
+if [ ! -d "$FAI_CONFIGDIR/class" ] ; then
     mkdir -p $FAI_CONFIGDIR
     cp -a /usr/share/doc/fai-doc/examples/simple/* $FAI_CONFIGDIR
 fi
 
 URL=`echo $FAI_DEBOOTSTRAP | awk '{print $2}'`
-## Check if package repository is accessible:     
+## Check if package repository is accessible:
 if wget --quiet --output-document=/tmp/fai-setup $URL ; then
     fai-setup -e -v
-    ## Create pxelinux boot configuration for workstation*:
-    for i in `seq 0 9` ; do
-	for j in `seq 0 9` ; do
-	    fai-chboot -IFv workstation$i$j  2>&1 | tee /var/log/fai/fai-chboot.log 
-	done
+    ## Create pxelinux boot configuration for workstationXX.
+    ## The seq range is sed from the corresponding variable
+    ## when fcopy'd:
+    NUM=0
+    for i in `seq WS_RANGE` ; do
+	NUMSTR=`printf "%02d" $NUM`
+	fai-chboot -IFv workstation$NUMSTR  2>&1 | tee -a /var/log/fai/fai-chboot.log
+	NUM=$(($NUM+1))
     done
     ## remove me, things are prepared now:
     mv -v /etc/rc.local.pre_fcopy $0
+
+    ## The following message is sed for diskless servers when fcopy'd:
+    #DISKLESS_INFO
+
 fi
diff --git a/fai/config/scripts/FAISERVER/10-config b/fai/config/scripts/FAISERVER/10-config
index 8bb2ece..aa1fb66 100755
--- a/fai/config/scripts/FAISERVER/10-config
+++ b/fai/config/scripts/FAISERVER/10-config
@@ -5,5 +5,20 @@ set -e
 fcopy -r /etc/fai
 
 if [ $FAI_ACTION == "install" ]; then
+    ## fetch template and seed 'number' of workstations:
     fcopy  /etc/rc.local
+    sed -i "s/WS_RANGE/$WS_RANGE/" $target/etc/rc.local
+
+    if ifclass DISKLESS_SERVER ; then
+	sed -i "s/\#DISKLESS_INFO/\
+cat <<EOF\n\
+==============================================================\n\
+To install the chroot for diskless clients execute:           \n\n\
+    export LC_ALL=C                                           \n\
+    fai -vNu diskless dirinstall \/opt\/live\/filesystem.dir\/\n\n\
+You can do this right now or later.                           \n\
+==============================================================\n\
+EOF/" \
+	    $target/etc/rc.local
+    fi
 fi

-- 
Debian-LAN development and packaging



More information about the debian-lan-devel mailing list