-
-echo "preparing nfsroot for automated install routine ..."
-
-cd $fairoot
-
-mknod -m 0666 dev/null c 1 3
-mknod -m 0600 dev/console c 5 1
-
-grep -v swap etc/fstab > tmp~
-mv tmp~ etc/fstab
-
-for i in sysklogd network inetd nscd; do
- rm -f etc/init.d/rc2.d/*${i}
-done
-
-cd $home_dir
-
-echo "done"
+if [ ! -f $fairoot/prepared_nfsroot ] ; then
+ echo "preparing nfsroot for automated install routine ..."
+ cd $fairoot
+ # special files (null & console)
+ [ ! -c dev/null ] && mknod -m 0666 dev/null c 1 3
+ [ ! -c dev/console ] && mknod -m 0600 dev/console c 5 1
+ # fstab
+ cp $home_dir/misc/sysfiles/etc/fstab ./etc
+ # the target directory
+ mkdir -p ./trg
+ # dir for mounting fai config
+ mkdir -p fai
+ # removing some services
+ for i in sysklogd network inetd nscd; do
+ rm -f etc/init.d/rc2.d/*${i}
+ done
+ # modified inittab, rc and bootscript
+ sed "s%| /sbin/btee .*%%g" $home_dir/misc/sysfiles/etc/inittab > \
+ etc/inittab
+ cp $home_dir/misc/fai/fai_boot ./etc/init.d/boot
+ sed "s%^FAI_MOUNT_LINE%mount -tnfs $myip:/$home_dir/fai /fai%" \
+ $home_dir/misc/fai/fai_rc > etc/init.d/rc
+ chmod 755 etc/init.d/rc
+ # modify hdw-get.conf
+ sed "s%hdw_arch_opt=.*%hdw_arch_opt=$hdw_arch_opt%" etc/hdw-get.conf > \
+ tmp~
+ mv tmp~ etc/hdw-get.conf
+ # get to home_dir again
+ cd $home_dir
+ echo "done"
+ touch $fairoot/prepared_nfsroot
+else
+ echo "nfsroot seems to be prepared already"
+ echo "(del $fairoot/prepared_nfsroot to recreate it)"
+fi