From: hackbard Date: Tue, 7 Dec 2004 10:11:05 +0000 (+0000) Subject: more fai stuff X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e75bb527068d620fe1811b09bb09e76ab29e856;p=hdw-linux%2Fhdw-linux.git more fai stuff --- diff --git a/doc/CHANGELOG b/doc/CHANGELOG index f461cc8..f61aaff 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -1,4 +1,9 @@ -*) 2004-12-6 +*) 2004-12-07 + +- added fai directory including new rc_fai.sh script +- some modifications in fai nfsroot creation + +*) 2004-12-06 - further work on fai - updated tftp-hpa and syslinux package diff --git a/fai/scripts/rc_fai.sh b/fai/scripts/rc_fai.sh new file mode 100755 index 0000000..e297052 --- /dev/null +++ b/fai/scripts/rc_fai.sh @@ -0,0 +1,54 @@ +#!/bin/bash +# +# author: hackbard@hackdaworld.dyndns.org +# +# automated install rc_fai.sh script +# + +root=/trg +croot=/fai/config +myip="`ifconfig eth0 | grep inet\ addr | awk '{ print $2 }' | awk -F: '{ print $2 }'`" +myconf=$croot/$myip + +if [ ! -d $myconf ] ; then + echo "no config found, aborting fai" + exit +fi + +disk=0 +disk=`grep '#\ disk' $myconf/disk | awk '{ print $3 }'` +if [ ! -b $disk ] ; then + echo "disk $disk not found, aborting fai" + exit +fi +swap=0 +swap=`grep '#\ swap' $myconf/disk | awk '{ print $3 }'` +if [ "$swap" != "0" -a -b ${disk}${swap} ] ; then + echo "creating swap device ..." + mkswap ${disk}${swap} + echo "done" +fi + +cat $myconf/disk | grep -v '^#' | while read nr mp; do + if [ -b ${disk}${nr} ] ; then + echo "making filesystem for $mp" + mke2fs -j ${disk}${nr} + if [ "$mp" = "/" ] ; then + echo "mounting root partition" + mount ${disk}${nr} $root + fi + fi +done + +cat $myconf/disk | grep -v '^#' | while read nr mp; do + if [ "$mp" != "/" ] ; then + if [ -b ${disk}${nr} ] ; then + mkdir -p $root/$mp + mount ${disk}${nr} $root/$mp + fi + fi +done + +echo "to be continued ...." + +exit 0 diff --git a/scripts/Create-FAI b/scripts/Create-FAI index 1b3366e..046b1d3 100755 --- a/scripts/Create-FAI +++ b/scripts/Create-FAI @@ -6,7 +6,7 @@ # fairoot="$1" -myip="`ifconfig eth0 | grep inet\ addr | awk '{ print $3 }' | awk -F: '{ print $2 }'`" +myip="`ifconfig eth0 | grep inet\ addr | awk '{ print $2 }' | awk -F: '{ print $2 }'`" home_dir=$PWD usage() { @@ -27,11 +27,6 @@ if [ ! -f ./Config ] ; then fi . ./Config -if [ ! -d ./fai ] ; then - echo "creating fai directory" - mkdir ./fai -fi - if [ ! -f ./fai/nfsroot-packages ] ; then echo "storing $hdw_target as original target" hdw_orig_target=$hdw_target @@ -67,24 +62,27 @@ else echo "(del $fairoot/packages_installed to recreate it)" fi - -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 + 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 + mkdir -p ./trg + for i in sysklogd network inetd nscd; do + rm -f etc/init.d/rc2.d/*${i} + done + sed "s%^exit\ 0%mount -tnfs $myip:/$home_dir/fai /fai%" \ + etc/init.d/rc > tmp~ + mv tmp~ etc/init.d/rc + chmod 755 etc/init.d/rc + echo "/fai/scripts/rc_fai.sh" >> etc/init.d/rc + echo "shutdown -r now" >> etc/init.d/rc + cd $home_dir + echo "done" + touch $fairoot/prepared_nfsroot +fi echo "checking pxe/nfs environment ..." mkdir -p /tftpboot @@ -98,15 +96,11 @@ fi mkdir -p /tftpboot/pxelinux.cfg echo -e "LABEL fai" > /tftpboot/pxelinux.cfg/fai echo -e "\tKERNEL vmlinuz_hdw" >> /tftpboot/pxelinux.cfg/fai -echo -e "\tAPPEND root=/dev/nfs nfsroot=$myip:$fairoot \\" >> \ +echo -e "\tAPPEND root=/dev/nfs nfsroot=$myip:$fairoot ip=dhcp" >> \ /tftpboot/pxelinux.cfg/fai -echo -e "\tip=dhcp" >> /tftpboot/pxelinux.cfg/fai echo -e "\tPROMPT 1" >> /tftpboot/pxelinux.cfg/fai echo -e "$fairoot\tfoobar(async,ro,no_root_squash)" >> /etc/exports - -echo "mounting configuration dir to nfsroot export ..." -mkdir -p $fairoot/fai-config -mount --bind $PWD/fai $fairoot/fai-config +echo -e "$home_dir/fai\tfoobar(async,ro,no_root_squash)" >> /etc/exports echo "everything should work now. now do the following:" echo "1) edit /etc/exports to allow your clients to mount the nfsroot" @@ -115,7 +109,7 @@ echo "3) tell your dhcpd (see syslinux docs for more help)" echo "4) make sure inetd/nfs/dhcpd are up running" echo "5) do the configuration stuff (see doc/FAI)" echo -echo "note: tftp must support tsize option (use e.g. tftp-hpa package) +echo "note: tftp must support tsize option (use e.g. tftp-hpa package)" echo echo "done"