From 1ea77b35197a40aa9b90e9092473701c217ccbbf Mon Sep 17 00:00:00 2001 From: Dirk von Suchodoletz Date: Thu, 23 Mar 2006 20:26:02 +0000 Subject: stuff for tftp file get, path for vmsessions/*.desktop ... git-svn-id: http://svn.openslx.org/svn/openslx/ld4@117 95ad53e4-c205-0410-b2fa-d234c58c8868 --- initrd/initrd-stuff/etc/functions | 41 ++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) (limited to 'initrd/initrd-stuff/etc') diff --git a/initrd/initrd-stuff/etc/functions b/initrd/initrd-stuff/etc/functions index ea7243b4..3e5b7a8a 100644 --- a/initrd/initrd-stuff/etc/functions +++ b/initrd/initrd-stuff/etc/functions @@ -2,13 +2,13 @@ # linux diskless clients (included by init, hwautocfg, # servconfig, ... within initial ramdisk) # -# Author(s): Dirk von Suchodoletz , 21-03-2006 +# Author(s): Dirk von Suchodoletz , 23-03-2006 # Felix Endres, 21-03-2006 # Blub # # Copyright: (c) 2006 - RZ Universitaet Freiburg # -# Version: 0.4.2a +# Version: 0.4.2b ####################################################################### # generate events with the sysfs trigger @@ -257,7 +257,20 @@ echo "finished" > /tmp/dhcp-done ####################################################################### # function for retrieving configuration file (machine-setup) via tftp # from a predefined server or given source (file=tftp-server:/path via -# kernel command line) +# kernel command line) +# tftpget is helper function for fileget +tftpget () { +# $1 is type of tftp command, $2 is config file name to get, $3 IP of +# server to get file from +case "$1" in + atftp) + atftp -g -r $2 $3 + ;; + tftp) + echo "get $2" | tftp $3 + ;; +esac +} fileget () { for tftp in /bin/atftp /bin/tftp ; do test -x $tftp && break @@ -265,19 +278,21 @@ done if [ -n "$FILESRC" ] ; then cfgfile=${FILESRC#*:} tftpserver=${FILESRC%:*} + tftpget $tftp $cfgfile $tftpserver else - cfgfile="/tftpboot/dxs-config/$clientip.cfg" + cfgfile="/tftpboot/dxs-config" + # ensure that a / is at the end of path to config file + cfgfile=$cfgfile"/" tftpserver=$serverip + # try to get configuration files successively; start with first part + # of the servers IP, add second part ... + set `IFS="."; echo $serverip` + for i in $1 $2 $3 $4 ; do + cfgfile=$cfgfile$i + tftpget $tftp $cfgfile $tftpserver + cfgfile=$cfgfile"." + done fi -# -case "$tftp" in - atftp) - atftp -g -r $cfgfile $tftpserver - ;; - tftp) - echo "get $cfgfile" | tftp $tftpserver - ;; -esac echo "finished" > /tmp/file-done } -- cgit v1.2.3-55-g7522