[debian-lan-devel] [debian-lan] 01/01: Improve the setup of the chroots for FAI and diskless machines.
Andreas B. Mundt
andi at moszumanska.debian.org
Mon Aug 4 07:25:03 UTC 2014
This is an automated email from the git hooks/post-receive script.
andi pushed a commit to branch wheezy
in repository debian-lan.
commit f27b882abdb23e685221640c730dcbbf6adfd55d
Author: Andreas B. Mundt <andi at debian.org>
Date: Sat Jun 14 14:39:23 2014 +0200
Improve the setup of the chroots for FAI and diskless machines.
Add the possibility to update the chroots.
(cherry picked (modified) from commit 56bc27de5e7f5d8591b561e87f0a52980186cf96)
---
fai/config/files/etc/rc.local/FAISERVER | 66 +++++++++++++++++----------------
1 file changed, 34 insertions(+), 32 deletions(-)
diff --git a/fai/config/files/etc/rc.local/FAISERVER b/fai/config/files/etc/rc.local/FAISERVER
index 51d7f4d..8a51dd0 100755
--- a/fai/config/files/etc/rc.local/FAISERVER
+++ b/fai/config/files/etc/rc.local/FAISERVER
@@ -28,7 +28,12 @@ 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 -l
+ if [ ! -d $NFSROOT ] ; then
+ fai-setup -e -v -l
+ else
+ ## Update nfsroot:
+ fai-make-nfsroot -v -l -k
+ fi
trap - ERR SIGHUP SIGINT SIGTERM
## Create pxelinux boot configuration for workstationXX.
## The seq range is sed from the corresponding variable
@@ -55,16 +60,22 @@ setup_nfsroot () {
setup_diskless () {
export LC_ALL=C
trap "rc=$?; rm -rf $DLROOT; exit $rc" ERR SIGHUP SIGINT SIGTERM
- fai -vNu diskless dirinstall $DLROOT/filesystem.dir/
+ if [ ! -d $DLROOT ] ; then
+ fai -vNu diskless dirinstall $DLROOT/filesystem.dir/
+ else
+ chroot $DLROOT/filesystem.dir/ fai -vNu diskless softupdate
+ fi
trap - ERR SIGHUP SIGINT SIGTERM
- TEMPLATE=$TFTPROOT/pxelinux.cfg/diskless.tmpl
- if [ ! -e $TEMPLATE ]; then
- KERNEL=`basename $(ls $TFTPROOT/vmlinuz*)`
- INITRD=`basename $(ls $TFTPROOT/initrd.img*)`
+ DL_TEMPLATE=$TFTPROOT/pxelinux.cfg/diskless.tmpl
+ if [ -e $DL_TEMPLATE ]; then
+ cp -v $DL_TEMPLATE ${DL_TEMPLATE}_$(date +%Y%m%d%H%M)
+ fi
+ KERNEL=`basename $(ls $TFTPROOT/vmlinuz*)`
+ INITRD=`basename $(ls $TFTPROOT/initrd.img*)`
- echo "Creating template with $KERNEL and $INITRD."
- cat > $TEMPLATE <<EOF
+ echo "Creating template with $KERNEL and $INITRD."
+ cat > $DL_TEMPLATE <<EOF
# template for diskless
default Debian-LAN/FAI Live System
@@ -72,9 +83,6 @@ label Debian-LAN/FAI Live System
kernel $KERNEL
append initrd=$INITRD ip=dhcp root=/dev/nfs nfsroot=/opt boot=live
EOF
- else
- echo "The template $TEMPLATE exists already!"
- fi
## Create pxelinux boot configuration for disklessXX.
## The seq range is sed from the corresponding variable
@@ -140,47 +148,41 @@ EOF
## Add missing plugins to munin, the line will be commented afterwards:
munin-node-configure --shell 2>/dev/null | sh && sed -i "s%\(^munin-node-configure\)%\#\1%" $0
-## Setup nfsroot for FAI:
-if [ ! -d $NFSROOT ] ; then
- cat <<EOF
+## Setup/update nfsroot for FAI:
+cat <<EOF
================================================================================
-The nfsroot for FAI may be created by executing $0.
+The nfsroot for FAI may be created/updated by executing $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.
EOF
- read -e -t $TIMEOUT -n 1 -p "Install the nfsroot for FAI now? [y|N]: " inp
- if [ "$inp" = "y" ] ; then
- check_network
- setup_nfsroot
- setup_PXEinstaller
- else
- exit 0
- fi
+read -e -t $TIMEOUT -n 1 -p "Install/update the nfsroot for FAI now? [y|N]: " inp
+if [ "$inp" = "y" ] ; then
+ check_network
+ setup_nfsroot
+ setup_PXEinstaller
fi
## The following code is activated if diskless machines
## are to be served. Do not change the following line:
exit 0 ##DISKLESS_SERVER##
-## Setup chroot for diskless machines:
-if [ ! -d $DLROOT ] ; then
+if [ -d $NFSROOT ] ; then
+ ## Setup/update chroot for diskless machines:
cat <<EOF
================================================================================
-To install the chroot for diskless clients execute:
- export LC_ALL=C
- fai -vNu diskless dirinstall $DLROOT/filesystem.dir/
-This can be done right now or manually.
+The chroot for diskless clients may be installed/updated.
+This can be done right now, later or manually by executing $0.
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
+ read -e -t $TIMEOUT -n 1 -p "Install/update the chroot for diskless clients now? [y|N]: " inp
if [ "$inp" = "y" ] ; then
check_network
setup_diskless
setup_PXEinstaller
- else
- exit 0
fi
fi
+
+exit 0
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/debian-lan.git
More information about the debian-lan-devel
mailing list