[debian-lan-devel] [SCM] Debian-LAN development and packaging branch, squeeze, updated. 0.6-15-gbeab8b2

Andreas B. Mundt andi at debian.org
Sun Sep 2 07:01:25 UTC 2012


The following commit has been merged in the squeeze branch:
commit e76ba9bbf80a7a2967ab2c19dbc449dfea9d82d2
Author: Andreas B. Mundt <andi.mundt at web.de>
Date:   Mon Aug 20 15:09:38 2012 +0200

    Improve installation procedure of the nfs/diskless chroot.
    
    Cherry-pick commits from master branch.

diff --git a/fai/config/files/etc/rc.local/FAISERVER b/fai/config/files/etc/rc.local/FAISERVER
index 90e24f9..04ec58b 100755
--- a/fai/config/files/etc/rc.local/FAISERVER
+++ b/fai/config/files/etc/rc.local/FAISERVER
@@ -3,22 +3,27 @@
 set -e
 
 ## Setup script run at boot time.
-## Removed after successful execution.
+## Moved after successful execution.
 
 ############################
-# Remove to enable:
+TIMEOUT=120
 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
-###########################
+This can be done now, later or manually.
+Internet access is needed to download packages.
+If unanswered, this script will exit after $TIMEOUT seconds.
 
-echo "Creating the nfsroot for FAI."
+EOF
+read -e -t $TIMEOUT -n 1 -p "Install the nfsroot for FAI now? [y|N]: " inp
+inp=${inp:-N}
+case $inp in
+    y)
+	;;
+    *)
+	exit 0
+	;;
+esac
 
 . /etc/fai/fai.conf
 . /etc/fai/make-fai-nfsroot.conf
@@ -31,6 +36,7 @@ fi
 URL=`echo $FAI_DEBOOTSTRAP | awk '{print $2}'`
 ## Check if package repository is accessible:
 if wget --quiet --output-document=/tmp/fai-setup $URL ; then
+    echo "Creating the nfsroot for FAI."
     fai-setup -e -v
     ## Create pxelinux boot configuration for workstationXX.
     ## The seq range is sed from the corresponding variable
@@ -44,6 +50,10 @@ if wget --quiet --output-document=/tmp/fai-setup $URL ; then
 
     ## Use git to track modifications of the config space:
     cd $FAI_CONFIGDIR
+    HOME="/root"
+    git config --global user.name  root
+    git config --global user.email root@`hostname --fqdn`
+    git config --global color.ui auto
     git init
     git add .
     git commit -m "Initial commit"
@@ -54,7 +64,30 @@ if wget --quiet --output-document=/tmp/fai-setup $URL ; then
 	mv -v $0 $0_setup
 	mv -v /etc/rc.local.pre_fcopy $0
     fi
-    ## The following message is sed for diskless servers when fcopy'd:
-    #DISKLESS_INFO
+    ## The following message is activated if diskless machines
+    ## are to be served.  Do not change the following line:
+    exit 0  ##DISKLESS_SERVER##
+    cat <<EOF
+================================================================================
+To install the chroot for diskless clients execute:
+    export LC_ALL=C
+    fai -vNu diskless dirinstall /opt/live/filesystem.dir/
+This can be done right now or manually.
+If unanswered, this script will exit after $TIMEOUT seconds.
 
+EOF
+    read -e -t $TIMEOUT -n 1 -p "Install the chroot for diskless clients now? [y|N]: " inp
+    inp=${inp:-N}
+    case $inp in
+	y)
+	    export LC_ALL=C
+	    fai -vNu diskless dirinstall /opt/live/filesystem.dir/
+	    ;;
+	*)
+	    exit 0
+	    ;;
+    esac
+else
+    echo "Error accessing '$URL', check network and internet access."
+    exit 0
 fi
diff --git a/fai/config/scripts/FAISERVER/10-config b/fai/config/scripts/FAISERVER/10-config
index aa1fb66..14abc8b 100755
--- a/fai/config/scripts/FAISERVER/10-config
+++ b/fai/config/scripts/FAISERVER/10-config
@@ -10,15 +10,6 @@ if [ $FAI_ACTION == "install" ]; then
     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
+	sed -i "s%\(^.*\#\#DISKLESS_SERVER\#\#\)%\#\1%"  $target/etc/rc.local
     fi
 fi

-- 
Debian-LAN development and packaging



More information about the debian-lan-devel mailing list