From 8fb05540f6e90b99053176b1ddf49c784b1336ea Mon Sep 17 00:00:00 2001 From: Dirk von Suchodoletz Date: Thu, 11 May 2006 19:21:35 +0000 Subject: fixes and cleanups within installer, see #51 too git-svn-id: http://svn.openslx.org/svn/openslx/ld4@210 95ad53e4-c205-0410-b2fa-d234c58c8868 --- installer/ld4-inst | 49 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 16 deletions(-) (limited to 'installer/ld4-inst') diff --git a/installer/ld4-inst b/installer/ld4-inst index 75794cfe..beb71378 100755 --- a/installer/ld4-inst +++ b/installer/ld4-inst @@ -4,11 +4,11 @@ # cloning from rsync source for Diskless X Stations (v4.0) # # Author(s): Nico Dietrich, 04-04-2006 -# Dirk von Suchodoletz , 06-04-2006 +# Dirk von Suchodoletz , 11-06-2006 # # Copyright: (c) 2003, 2006 - RZ Universitaet Freiburg # -# Version: 0.2.0d +# Version: 0.2.0e DEBUG=0 header() { @@ -17,8 +17,8 @@ header() { echo } -# This function makes the directory of this script to the present working directory -# It is called within precheck() +# This function makes the directory of this script to the present working +# directory. It is called within precheck() # Does also work when called by a symbolic link. Even works for nested links. goto_script_dir() { @@ -27,7 +27,8 @@ goto_script_dir() [ $DEBUG -ge 2 ] && echo $calleddetails calleddir=${0%/*} # Strip the filename from path - [ $DEBUG -ge 2 ] && echo "Wechsele ins Verzeichnis des aufgerufenen scripts/links ($calleddir)" + [ $DEBUG -ge 2 ] && echo "Changing into directory of called scripts/links \ +($calleddir)" cd $calleddir while index=`expr index "$calleddetails" "l"`; @@ -77,8 +78,17 @@ precheck() { # nfs-kernel-server, atftpd # -> not needed for installation + # but should be checked here, so the admin has just to restart } +# bolean yes of different kinds of spelling +isyes () { +if [ "$1" = "yes" -o "$1" = "y" -o "$1" = "Y" -o "$1" = "Yes" ] ; then + return 0 +else + return 1 +fi +} # ask question variable_name default_value ask() { @@ -254,7 +264,7 @@ configure() { # nfs / nbd / squash-fs? ask "Would you like to use NBD? (y/N): " nbdyes $nbdyes - if [ "$nbdyes" = "yes" -o "$nbdyes" = "y" -o "$nbdyes" = "Y" ] ; then + if isyes $nbdyes ; then ask "Which kind of NBD export (ext2/squashfs)?: " nbdfs $nbdfs fi @@ -276,7 +286,9 @@ copy_system() { cat $file distro-specs/exclude-common|grep -e "^+ " > /tmp/dxs-exclude-list cat $file distro-specs/exclude-common|grep -e "^- " >> /tmp/dxs-exclude-list - echo -e "\n\nSyncing system now\nPlease enter root password of client machine\n" + test -d ${rootdir} || mkdir -p ${rootdir} + echo -e "\n\nSyncing system now\nPlease enter root password of client \ +machine\n" rsync -avDe ssh --delete --exclude-from=/tmp/dxs-exclude-list \ ${rsyncsource} ${rootdir} || { echo "Rsync failed" ; exit 1 ; } rm /tmp/dxs-exclude-list @@ -285,7 +297,7 @@ copy_system() { } create_nbd() { - if [ "$nbdyes" = "yes" -o "$nbdyes" = "y" -o "$nbdyes" = "Y" ] ; then + if isyes $nbdyes ; then # TODO: mksquashfs (background process) if [ "$nbdfs" = "squashfs" ] ; then echo -e "\nGenerating SquashFS image ${rootdir}.squashfs (ca. 30 min.)" @@ -338,7 +350,7 @@ create_initrd() { # add nfs modules -f if nfs is choosen fsmod=nfs # add nbd module and the selected filesystem ontop - [ -n "$nbdyes" ] && fsmod=$fsmod" nbd $nbdfs" + isyes "$nbdyes" && fsmod=$fsmod" nbd $nbdfs" fsmod=" -f \"$fsmod\"" # one big initrd or several smaller "specialized" ones!? @@ -369,19 +381,24 @@ setup_server () { [ -d ${dxs_conf}/${dir} ] || mkdir -p ${dxs_conf}/${dir} done - # copy the client configuration default file and replace root_pw - machine-setup - sed -e "s,@@@root_pw@@@,'${root_pw}'," \ - default_files/machine-setup.default > ${dxs_conf}/${dxs_client_conf}-${timestamp} + # copy the client configuration default file and replace root_pw - + # machine-setup + sed -e "s,@@@root_pw@@@,'${root_pw}'," default_files/machine-setup.default \ + > ${dxs_conf}/${dxs_client_conf}-${timestamp} # creating new configuration files in $dxs_conf # dhcp - sed -e "s,@@@server@@@,${server},g;s,@@@netname@@@,${netname},g" \ + sed -e "s,@@@server@@@,${server},g;s,@@@tftpbootdir@@@,${tftpbootdir},g" \ -e "s,@@@netmask@@@,${netmask},g;s,@@@broadcast@@@,${broadcast},g" \ + -e "s,@@@rootdir@@@,${rootdir},g;s,@@@netname@@@,${netname},g" \ default_files/dhcpd.conf > ${dxs_conf}/${dxs_dhcpd_conf}-${timestamp} - # TODO: sed -e @@@example1@@@, netname+1 etc. - which ip addresses are safe to use? + # TODO: sed -e @@@example1@@@, netname+1 etc. - which ip addresses are + # safe to use? # atftpd - sed -e "s,@@@tftpbootdir@@@,${tftpbootdir}," default_files/${atftpd_conf_name} > ${dxs_conf}/${dxs_atftpd_conf}-${timestamp} + sed -e "s,@@@tftpbootdir@@@,${tftpbootdir}," \ + default_files/${atftpd_conf_name} \ + > ${dxs_conf}/${dxs_atftpd_conf}-${timestamp} # nfs echo -e "#/etc/exports - file generated by $0\n\ @@ -418,7 +435,7 @@ ${rootdir} ${netname}/${netmask}(ro,no_root_squash,async)" \ apic dhcp noldsc debug=$debuglevel vci=DXS\n\ ipappend 1\n" >> ${dxs_conf}/${dxs_pxedefault_conf}-${timestamp} - if [ -n "$nbdyes" ] ; then + if isyes "$nbdyes" ; then j=$j+1 # create configs for nbd/squashfs kernels too echo -e "LABEL ${client_distro}-${current_kernel}-nbd\n\ -- cgit v1.2.3-55-g7522