diff options
author | Dirk von Suchodoletz | 2006-07-09 19:36:29 +0200 |
---|---|---|
committer | Dirk von Suchodoletz | 2006-07-09 19:36:29 +0200 |
commit | 4c56d7ac43028110ad5d313ffa422bb226d15114 (patch) | |
tree | a43cbcbb9ea9c1da092be035597f6e3a6170ea0c /initrd/initrd-stuff/etc/functions | |
parent | Fix for certain keyboard (inactivity) problem, introduction of keytable (diff) | |
download | core-4c56d7ac43028110ad5d313ffa422bb226d15114.tar.gz core-4c56d7ac43028110ad5d313ffa422bb226d15114.tar.xz core-4c56d7ac43028110ad5d313ffa422bb226d15114.zip |
Added "fileget" configuration (via tftp from ~/tftpboot/client-config/*),
see BootRootVerzeichnisse and ClientConfiguration, fix for dhclient
(multiple)
config entries in machine-setup ...
git-svn-id: http://svn.openslx.org/svn/openslx/ld4@280 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'initrd/initrd-stuff/etc/functions')
-rw-r--r-- | initrd/initrd-stuff/etc/functions | 56 |
1 files changed, 37 insertions, 19 deletions
diff --git a/initrd/initrd-stuff/etc/functions b/initrd/initrd-stuff/etc/functions index 0f07189f..2814e29c 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 <dirk@goe.net>, 08-07-2006 +# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 09-07-2006 # Felix Endres, 30-04-2006 # Tobias Maier # # Copyright: (c) 2006 - RZ Universitaet Freiburg # -# Version: 0.4.2e +# Version: 0.5.0b ####################################################################### # set of empty dummy functions (loaded before real functions in the @@ -165,10 +165,13 @@ case $ipcfg in if [ "$gw" != "0.0.0.0" ] ; then ip route add default via $gw fi + MAC=$(ip link show dev $if|sed -n "/ether [0-9e-f]\{2\}:.*/p" \ + | sed -e "s/.*ether //;s/ .*//") ;; ipconfig) # fixme: to be checked ipconfig $ip::$gw:$nm:$if:none + MAC="" ;; ifconfig) if [ "$ip" = "0.0.0.0" ]; then @@ -177,6 +180,8 @@ case $ipcfg in ifconfig $if $ip netmask $nm broadcast $bc fi [ "$gw" != "0.0.0.0" ] && route add default gw $gw + MAC=$(ifconfig $if|sed -n "/HWaddr [0-9A-F]\{2\}:.*/p" \ + | sed -e "s/.*HWaddr //;y/ABCDEF/abcdef/") ;; none) error "$error_iptool" @@ -265,8 +270,8 @@ case $dhcp in dhclient) mkdhclconf $vci ln -s /bin/dhcpmkconfig /bin/dhclient-script - dhclient -q -cf /etc/dhclient.conf -lf /var/lib/dhcp/dhclient.leases eth0 \ - 2>&1 >/dev/null || error "$error_dhclient" + dhclient -cf /etc/dhclient.conf -lf /var/lib/dhcp/dhclient.leases \ + -q eth0 2>&1 >/dev/null || error "$error_dhclient" ;; dhcpcd) [ -n $vci ] && vci="-i $vci" @@ -305,16 +310,23 @@ echo "dhcp finished" > /tmp/dhcp-done tftpget () { # $1 is type of tftp command, $2 is config file name to get, $3 IP of # server to get file from +local dst=/tmp/$(basename $2) case "$1" in - atftp) - atftp -g -r $2 $3 + */atftp) + atftp -g -r $2 -l $dst $3 2> /dev/null ;; - tftp) - echo "get $2" | tftp $3 + */tftp) + # distinguish between busybox tftp and standalone (in.tftp) client + if [ -x /bin/busybox ] ; then + tftp -g -r $2 -l $dst $3 2> /dev/null + else + echo "get $2 $dst" | tftp $3 2> /dev/null + fi ;; esac } fileget () { +# get type of tftp available for tftp in /bin/atftp /bin/tftp ; do test -x $tftp && break done @@ -324,17 +336,23 @@ if [ -n "$FILESRC" ] ; then tftpserver=${FILESRC%:*} tftpget $tftp $cfgfile $tftpserver else - 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"." + cfgdir="/tftpboot/client-config/" + local tftpserver=$serverip + # try to get configuration files successively; start with first most + # generic file (global default), then global client, then distro default + # last distro client ... + echo -e "\n## Configuration via fileget: Hierarchy is first most \ +generic file\n# (global default), then global client, then distro default \ +and as last\n# distro/client" >> /tmp/confviafile + mac=$(echo $MAC|sed "s/:/-/g") + for cfgfile in $cfgdir/default $cfgdir/01-$mac \ + $cfgdir/$DISTRO/default $cfgdir/$DISTRO/01-$mac ; do + echo "# -> $cfgfile" >> /tmp/confviafile + if tftpget $tftp $cfgfile $tftpserver ; then + cat /tmp/$(basename $cfgfile) >> /tmp/confviafile + else + echo -e "# ... this file does not exist on server." >> /tmp/confviafile + fi done fi echo "tftp finished" > /tmp/file-done |