Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Generate make-fai-nfsroot.conf and nfsroot.conf on-the-fly

FAI 4 uses nfsroot.conf instead of make-fai-nfsroot.conf without
providing any backwards compatibility. :( So while at it rework
the way how make-fai-nfsroot.conf is handled:

* No longer ship /etc/grml/fai/make-fai-nfsroot.conf at all
* Generate nfsroot.conf based on default settings (can be overriden
  by $FAI_DEBOOTSTRAP + $FAI_DEBOOTSTRAP_OPTS) on the fly
* Provide symlink make-fai-nfsroot.conf pointing to nfsroot.conf
  to support old and new FAI versions at the same time
* After execution copy generated nfsroot.conf file to log directory
  and get rid of make-fai-nfsroot.conf and nfsroot.conf in
  $GRML_FAI_CONFIG (/etc/grml/fai/ by default) afterwards

Closes: #4
  • Loading branch information...
commit 9e1c0433e556ebdbee391d37cf95aba0868255e1 1 parent 193203a
Michael Prokop mika authored
6 docs/grml-live.txt
@@ -400,12 +400,6 @@ GRML_FAI_CONFIG=/etc/grml/fai/config - both pointing to a directory shipped by
400 400 grml-live out-of-the-box so you shouldn't have to configure anything in this
401 401 file.
402 402
403   - ${GRML_FAI_CONFIG}/make-fai-nfsroot.conf
404   -
405   -This file is used by make-fai-nfsroot(8) only. Usually you don't have to change
406   -anything inside this file. If you want to modify NFSROOT though you can adjust
407   -it there.
408   -
409 403 ${GRML_FAI_CONFIG}/NFSROOT
410 404
411 405 This file specifies the package list for creating the NFSROOT.
31 etc/grml/fai/make-fai-nfsroot.conf
... ... @@ -1,31 +0,0 @@
1   -# these variables are only used by make-fai-nfsroot(8)
2   -# here you can use also variables defined in fai.conf
3   -
4   -# directory on the install server where the nfsroot for FAI is
5   -# created, approx size: 250MB, also defined in bootptab or dhcp.conf
6   -NFSROOT=/srv/fai/nfsroot
7   -
8   -# TFTP root directory
9   -TFTPROOT=/srv/tftp/fai
10   -
11   -# Add a line for mirrorhost and installserver when DNS is not available
12   -# on the clients. This line(s) will be added to $nfsroot/etc/hosts.
13   -#NFSROOT_ETC_HOSTS="192.168.1.250 yourinstallserver"
14   -
15   -# debootstrap commandline
16   -FAI_DEBOOTSTRAP="squeeze http://cdn.debian.net/debian"
17   -
18   -# which options do you want to use for debootstrap?
19   -FAI_DEBOOTSTRAP_OPTS="--exclude=info,tasksel,tasksel-data"
20   -
21   -# the encrypted (with md5 or crypt) root password on all install clients during
22   -# installation process; used when log in via ssh; default pw is: fai
23   -FAI_ROOTPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1'
24   -
25   -# location of a identity.pub file; this user can log to the install
26   -# clients in as root without a password; only useful with FAI_FLAGS="sshd"
27   -#SSH_IDENTITY=/home/admin/.ssh/identity.pub
28   -
29   -# directory of hooks to be sourced at the end of make-fai-nfsroot,
30   -# i.e they have to be shell scripts.
31   -#NFSROOT_HOOKS=/etc/fai/nfsroot-hooks/
3  etc/grml/grml-live.conf
@@ -65,9 +65,6 @@
65 65 # APT_PROXY="http://localhost:3142/"
66 66
67 67 # Which Debian suite and which mirror do you want to use for debootstrapping?
68   -# Unless specified the default from /etc/grml/fai/make-fai-nfsroot.conf will be
69   -# taken. If you specify a value then the file /etc/grml/fai/make-fai-nfsroot.conf
70   -# will be updated by grml-live on-the-fly.
71 68 # Usage: "<suite> <mirror>"
72 69 # FAI_DEBOOTSTRAP="squeeze http://cdn.debian.net/debian"
73 70
38 grml-live
@@ -183,6 +183,11 @@ bailout() {
183 183 [ -n "${CHROOT_OUTPUT}" -a -d "${CHROOT_OUTPUT}" ] && rm -r "${CHROOT_OUTPUT}"
184 184 eend 0
185 185 fi
  186 +
  187 + # get rid of automatically generated conffiles
  188 + rm -f ${GRML_FAI_CONFIG}/nfsroot.conf
  189 + rm -f ${GRML_FAI_CONFIG}/make-fai-nfsroot.conf
  190 +
186 191 if [ -n "$CHOWN_USER" ]; then
187 192 log "Setting ownership"
188 193 einfo "Setting ownership"
@@ -365,7 +370,6 @@ fi
365 370 [ -n "$GRML_NAME" ] || GRML_NAME='grml'
366 371 [ -n "$HOSTNAME" ] || HOSTNAME='grml'
367 372 [ -n "$HYBRID_METHOD" ] || HYBRID_METHOD='isohybrid'
368   -[ -n "$NFSROOT_CONF" ] || NFSROOT_CONF="${GRML_FAI_CONFIG}/make-fai-nfsroot.conf"
369 373 [ -n "$RELEASENAME" ] || RELEASENAME='grml-live rocks'
370 374 [ -n "$SQUASHFS_EXCLUDES_FILE" ] || SQUASHFS_EXCLUDES_FILE="${GRML_FAI_CONFIG}/config/grml/squashfs-excludes"
371 375 [ -n "$SUITE" ] || SUITE='testing'
@@ -560,9 +564,6 @@ extract_iso
560 564 # }}}
561 565
562 566 # on-the-fly configuration {{{
563   -if [ -n "$FAI_DEBOOTSTRAP" ] ; then
564   - sed "s#^FAI_DEBOOTSTRAP=.*#FAI_DEBOOTSTRAP=\"$FAI_DEBOOTSTRAP\"#" "$NFSROOT_CONF" | sponge "$NFSROOT_CONF"
565   -fi
566 567
567 568 # does this suck? YES!
568 569 # /usr/share/debootstrap/scripts/unstable does not exist, instead use 'sid':
@@ -572,12 +573,6 @@ case $SUITE in
572 573 esac
573 574 export SUITE # make sure it's available in FAI scripts
574 575
575   -for file in "$LIVE_CONF" "$LOCAL_CONFIG" "$NFSROOT_CONF" ; do
576   - if [ -n "$file" ] ; then
577   - sed "s|^FAI_DEBOOTSTRAP=\"[a-z]* |FAI_DEBOOTSTRAP=\"$SUITE |" "$file" | sponge "$file"
578   - fi
579   -done
580   -
581 576 # validate whether the specified architecture class matches the
582 577 # architecture (option), otherwise installation of kernel will fail
583 578 if echo $CLASSES | grep -qi i386 ; then
@@ -598,11 +593,22 @@ elif echo $CLASSES | grep -qi amd64 ; then
598 593 fi
599 594 fi
600 595
601   -if grep -q -- 'FAI_DEBOOTSTRAP_OPTS.*--arch' "$NFSROOT_CONF" ; then
602   - sed "s/--arch [a-z0-9]* /--arch $ARCH /" "$NFSROOT_CONF" | sponge "$NFSROOT_CONF"
603   -else
604   - sed "s|^FAI_DEBOOTSTRAP_OPTS=\"\(.*\)|FAI_DEBOOTSTRAP_OPTS=\"--arch $ARCH \1|" "$NFSROOT_CONF" | sponge "$NFSROOT_CONF"
  596 +# generate nfsroot configuration for FAI on the fly
  597 +if [ -z "$FAI_DEBOOTSTRAP" ] ; then
  598 + FAI_DEBOOTSTRAP="$SUITE http://cdn.debian.net/debian"
  599 +fi
  600 +
  601 +if [ -z "$FAI_DEBOOTSTRAP_OPTS" ] ; then
  602 + FAI_DEBOOTSTRAP_OPTS="--exclude=info,tasksel,tasksel-data --arch $ARCH"
605 603 fi
  604 +
  605 +echo "# This is an automatically generated file by grml-live.
  606 +# Do NOT edit this file, your changes will be lost.
  607 +FAI_DEBOOTSTRAP=\"$FAI_DEBOOTSTRAP\"
  608 +FAI_DEBOOTSTRAP_OPTS=\"$FAI_DEBOOTSTRAP_OPTS\"
  609 +# EOF " > "${GRML_FAI_CONFIG}/nfsroot.conf"
  610 +# support FAI <=3.4.8, versions >=4.0 use nfsroot.conf
  611 +( cd ${GRML_FAI_CONFIG} && ln -sf nfsroot.conf make-fai-nfsroot.conf )
606 612 # }}}
607 613
608 614 # CHROOT_OUTPUT - execute FAI {{{
@@ -672,6 +678,10 @@ else
672 678 mkdir -p "$LOG_OUTPUT"/fai/
673 679 cp -r "$CHROOT_OUTPUT"/var/log/fai/"$HOSTNAME"/last/* "$LOG_OUTPUT"/fai/
674 680 rm -rf "$CHROOT_OUTPUT"/var/log/fai
  681 +
  682 + # store copy of autogenerated configuration file
  683 + cp ${GRML_FAI_CONFIG}/nfsroot.conf "$LOG_OUTPUT"/fai/
  684 +
675 685 # copy fai package list
676 686 cp "$CHROOT_OUTPUT"/var/log/install_packages.list "$LOG_OUTPUT"/fai/
677 687 # fixup owners

0 comments on commit 9e1c043

Please sign in to comment.
Something went wrong with that request. Please try again.