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

Andreas B. Mundt andi at debian.org
Mon Oct 29 12:16:28 UTC 2012


The following commit has been merged in the squeeze branch:
commit 4411841eca67cd14e8c59c046be6618fbe5bf973
Author: Andreas B. Mundt <andi at debian.org>
Date:   Sun Oct 28 10:59:44 2012 +0100

    Improved and restructured rc.local.  Fix squeeze installer.
    
    Make sure that setting up the chroots for FAI and for diskless
    machines works independently.  Trap errors.

diff --git a/fai/config/files/etc/rc.local/FAISERVER b/fai/config/files/etc/rc.local/FAISERVER
index a933378..0f65b60 100755
--- a/fai/config/files/etc/rc.local/FAISERVER
+++ b/fai/config/files/etc/rc.local/FAISERVER
@@ -7,7 +7,7 @@ set -e
 ############################
 TIMEOUT=120
 URL="http.debian.net"
-INSTALLER="/usr/lib/debian-installer/images/*/*/text/debian-installer/"
+INSTALLER="/usr/lib/debian-installer/images/"
 
 DLROOT="/opt/live"
 . /etc/fai/fai.conf
@@ -25,7 +25,9 @@ check_network () {
 
 setup_nfsroot () {
     echo "Creating the nfsroot for FAI."
+    trap "rc=$?; rm -rf $NFSROOT; exit $rc" ERR SIGHUP SIGINT SIGTERM
     fai-setup -e -v
+    trap - ERR SIGHUP SIGINT SIGTERM
     ## Create pxelinux boot configuration for workstationXX.
     ## The seq range is sed from the corresponding variable
     ## when fcopy'd:
@@ -36,55 +38,20 @@ setup_nfsroot () {
 	NUM=$(($NUM+1))
     done
 
-    ## create default configuration (sysinfo):
-    fai-chboot -Svu $FAI_CONFIG_SRC default
-}
-
-setup_PXEinstaller () {
-    ## Add Debian PXE Installer.
-    ## Copy stuff, symlinks do not work (chroot environment):
-    cp -r $INSTALLER $TFTPROOT
-    append2PXEmenu
-}
-
-append2PXEmenu () {
-    if [ -d $TFTPROOT/debian-installer/i386 ] ; then
-	## add installer menu
-	cat >> $TFTPROOT/pxelinux.cfg/default <<EOF
-menu label Debian-LAN/FAI live system
-
-menu title Boot menu
-menu background debian-installer/i386/boot-screens/splash.png
-menu color title        * #FFFFFFFF *
-menu color border       * #00000000 #00000000 none
-menu color sel          * #ffffffff #76a1d0ff *
-menu color hotsel       1;7;37;40 #ffffffff #76a1d0ff *
-menu color tabmsg       * #ffffffff #00000000 *
-menu color help         37;40 #ffdddd00 #00000000 none
-menu vshift 16
-menu rows 7
-menu helpmsgrow 12
-menu cmdlinerow 12
-menu tabmsgrow 13
-default debian-installer/i386/boot-screens/vesamenu.c32
-timeout 150
-ontimeout fai-generated
-prompt 0
-noescape 1
-
-label Debian Installer i386
-        config debian-installer/i386/pxelinux.cfg/default
-
-label Debian Installer amd64
-        config debian-installer/amd64/pxelinux.cfg/default
-EOF
+    if [ -d $DLROOT ] ; then
+	fai-chboot -vc diskless.tmpl default
+    else
+        ## create default configuration (sysinfo):
+	fai-chboot -Svu $FAI_CONFIG_SRC default
     fi
 }
 
 
 setup_diskless () {
     export LC_ALL=C
-    fai -vNu diskless dirinstall /opt/live/filesystem.dir/
+    trap "rc=$?; rm -rf $DLROOT; exit $rc" ERR SIGHUP SIGINT SIGTERM
+    fai -vNu diskless dirinstall $DLROOT/filesystem.dir/
+    trap - ERR SIGHUP SIGINT SIGTERM
 
     TEMPLATE=$TFTPROOT/pxelinux.cfg/diskless.tmpl
     if [ ! -e $TEMPLATE ]; then
@@ -116,9 +83,51 @@ EOF
 
     ## Boot unknown machines as diskless:
     fai-chboot -vc diskless.tmpl default
-    append2PXEmenu
 }
 
+
+setup_PXEinstaller () {
+    ## Add Debian PXE Installer.
+    ## Copy stuff, symlinks do not work (chroot environment):
+    mkdir -p $TFTPROOT/debian-installer/i386
+    mkdir -p $TFTPROOT/debian-installer/amd64
+    cp -ru $INSTALLER/i386/text/* $TFTPROOT/debian-installer/i386/
+    cp -ru $INSTALLER/amd64/text/* $TFTPROOT/debian-installer/amd64/
+
+    if [ -d $TFTPROOT/debian-installer/i386/ ] ; then
+	## add installer menu
+	cat >> $TFTPROOT/pxelinux.cfg/default <<EOF
+menu label Debian-LAN/FAI live system
+
+menu title Boot menu
+menu background debian-installer/i386/boot-screens/splash.png
+menu color title        * #FFFFFFFF *
+menu color border       * #00000000 #00000000 none
+menu color sel          * #ffffffff #76a1d0ff *
+menu color hotsel       1;7;37;40 #ffffffff #76a1d0ff *
+menu color tabmsg       * #ffffffff #00000000 *
+menu color help         37;40 #ffdddd00 #00000000 none
+menu vshift 16
+menu rows 7
+menu helpmsgrow 12
+menu cmdlinerow 12
+menu tabmsgrow 13
+default debian-installer/i386/boot-screens/vesamenu.c32
+timeout 150
+ontimeout fai-generated
+prompt 0
+noescape 1
+
+label Debian Installer i386
+        config debian-installer/i386/pxelinux.cfg/default
+
+label Debian Installer amd64
+        config debian-installer/amd64/pxelinux.cfg/default
+EOF
+    fi
+}
+
+
 #########################
 
 ## Setup nfsroot for FAI:
@@ -155,7 +164,7 @@ if [ ! -d $DLROOT ] ; then
 ================================================================================
 To install the chroot for diskless clients execute:
     export LC_ALL=C
-    fai -vNu diskless dirinstall /opt/live/filesystem.dir/
+    fai -vNu diskless dirinstall $DLROOT/filesystem.dir/
 This can be done right now or manually.
 If unanswered, this script will exit after $TIMEOUT seconds.
 
@@ -166,6 +175,7 @@ EOF
 	y)
 	    check_network
 	    setup_diskless
+	    setup_PXEinstaller
 	    ;;
 	*)
 	    exit 0

-- 
Debian-LAN development and packaging



More information about the debian-lan-devel mailing list