Package: fai Version: 3.2.6 Severity: wishlist Tags: patch The currently shipped simple examples cannot be immediately used with softupdates as some actions cannot be performed are would be errornous if run multiple times and/or on an already installed system.
The attached patch is supposed to fix this, but should be carefully reviewed. Best, Michael
Index: examples/simple/class/20-hwdetect.source
===================================================================
--- examples/simple/class/20-hwdetect.source (revision 4793)
+++ examples/simple/class/20-hwdetect.source (working copy)
@@ -5,7 +5,8 @@
# NOTE: Files named *.source will be evaluated, but their output ignored.
Instead
# the contents of $newclasses will be added to the list of defined classes.
-[ "$action" = "dirinstall" ] && return 0 # Do not execute when doing dirinstall
+# Do not execute when doing dirinstall or softupdate
+[ "$action" = "dirinstall" -o "$action" = "softupdate" ] && return 0
echo 0 > /proc/sys/kernel/printk
Index: examples/simple/scripts/GRUB/10-setup
===================================================================
--- examples/simple/scripts/GRUB/10-setup (revision 4793)
+++ examples/simple/scripts/GRUB/10-setup (working copy)
@@ -2,7 +2,7 @@
error=0 ; trap "error=$((error|1))" ERR
-fcopy -Uv boot/grub/menu.lst
+fcopy -v /boot/grub/menu.lst
exit $error
Index: examples/simple/scripts/LAST/50-misc
===================================================================
--- examples/simple/scripts/LAST/50-misc (revision 4793)
+++ examples/simple/scripts/LAST/50-misc (working copy)
@@ -11,7 +11,7 @@
done
[ "$FAI_DEBMIRROR" ] &&
-echo "#$FAI_DEBMIRROR $MNTPOINT nfs ro 0 0" >> $target/etc/fstab
+ainsl $target/etc/fstab "#$FAI_DEBMIRROR $MNTPOINT nfs ro 0 0"
# set bios clock
if [ $do_init_tasks -eq 1 ] ; then
Index: examples/simple/scripts/DEMO/10-misc
===================================================================
--- examples/simple/scripts/DEMO/10-misc (revision 4793)
+++ examples/simple/scripts/DEMO/10-misc (working copy)
@@ -9,6 +9,9 @@
# perl -pi.orig -pe "s/%%VIDEODRIVER%%/$VIDEODRIVER/"
$target/etc/X11/xorg.conf
}
-# add a demo user account
-$ROOTCMD adduser --disabled-login --gecos "fai demo user" demo
-echo "demo:$ROOTPW" | $ROOTCMD chpasswd --encrypted
+if ! $ROOTCMD getent passwd demo ; then
+ # add a demo user account
+ $ROOTCMD adduser --disabled-login --gecos "fai demo user" demo
+ echo "demo:$ROOTPW" | $ROOTCMD chpasswd --encrypted
+fi
+
Index: examples/simple/scripts/FAISERVER/10-conffiles
===================================================================
--- examples/simple/scripts/FAISERVER/10-conffiles (revision 4793)
+++ examples/simple/scripts/FAISERVER/10-conffiles (working copy)
@@ -5,10 +5,16 @@
#/etc/fai/fai.conf /etc/fai/make-fai-nfsroot.conf
fcopy /etc/apt-proxy/apt-proxy-v2.conf /etc/fai/apt/sources.list
-# use the same sources.list for the server itself and the clients
-cp -a $target/etc/fai/apt $target/etc/
-rm -f $target/etc/resolv.conf
+# Michael T: actually I absolutely don't understand the following, but I guess
+# it must not happen on softupdates
+if [ $FAI_ACTION != "softupdate" ] ; then
+ # use the same sources.list for the server itself and the clients
+ cp -a $target/etc/fai/apt $target/etc/
-# create some host entries
-perl -e 'for (1..25) {printf "192.168.1.%s atom%02s\n",$_,$_;}' >>
$target/etc/hosts
+ rm -f $target/etc/resolv.conf
+
+ # create some host entries
+ perl -e 'for (1..25) {printf "192.168.1.%s atom%02s\n",$_,$_;}' >>
$target/etc/hosts
+fi
+
Index: examples/simple/scripts/FAIBASE/30-interface
===================================================================
--- examples/simple/scripts/FAIBASE/30-interface (revision 4793)
+++ examples/simple/scripts/FAIBASE/30-interface (working copy)
@@ -2,7 +2,7 @@
error=0 ; trap "error=$((error|1))" ERR
-if ifclass DHCPC
+if ifclass DHCPC && [ $FAI_ACTION != "softupdate" ]
then
cat > $target/etc/network/interfaces <<-EOF
# generated by FAI
@@ -23,11 +23,11 @@
EOF
[ -n "$NETWORK" ] && echo "localnet $NETWORK" > $target/etc/networks
[ -s /etc/resolv.conf ] && cp -p /etc/resolv.conf $target/etc
- fcopy -i /etc/resolv.conf
fi
# here fcopy is mostly used, when installing a client for running in a
# different subnet than during the installation
+fcopy -i /etc/resolv.conf
fcopy -iM /etc/network/interfaces /etc/networks
exit $error
Index: examples/simple/scripts/FAIBASE/10-misc
===================================================================
--- examples/simple/scripts/FAIBASE/10-misc (revision 4793)
+++ examples/simple/scripts/FAIBASE/10-misc (working copy)
@@ -10,12 +10,14 @@
ainsl -a $target/etc/modules "^$module$"
done
-# disable fsck on ext3 filesystems
-for part in $(mount|grep $target |grep "type ext3"|perl -ane 'print "$F[0] "')
-do
- echo "Disable periodic fsck on $part"
- tune2fs -c 0 -i 0 $part
-done
+if [ $do_init_tasks -eq 1 ] ; then
+ # disable fsck on ext3 filesystems
+ for part in $(mount|grep $target |grep "type ext3"|perl -ane 'print "$F[0]
"')
+ do
+ echo "Disable periodic fsck on $part"
+ tune2fs -c 0 -i 0 $part
+ done
+fi
fcopy /etc/hostname || echo $HOSTNAME > $target/etc/hostname
echo $TIMEZONE > $target/etc/timezone
pgp7ZPY6323Df.pgp
Description: PGP signature

