diff options
author | Michael Neves | 2013-06-20 13:57:07 +0200 |
---|---|---|
committer | Michael Neves | 2013-06-20 13:57:07 +0200 |
commit | d558c206a4f4310ec96d92b2481e0226f6bff809 (patch) | |
tree | e81fdc71e3b199cfb8379ecc16335f68d2427934 /remote/rootfs/rootfs-stage32/data/opt/openslx/bin | |
parent | [udhcpc] keep udhcpc in foreground (diff) | |
download | tm-scripts-d558c206a4f4310ec96d92b2481e0226f6bff809.tar.gz tm-scripts-d558c206a4f4310ec96d92b2481e0226f6bff809.tar.xz tm-scripts-d558c206a4f4310ec96d92b2481e0226f6bff809.zip |
[udhcpc] remove old IP adress if new one is obtained. Update hostname if obtained
Diffstat (limited to 'remote/rootfs/rootfs-stage32/data/opt/openslx/bin')
-rwxr-xr-x | remote/rootfs/rootfs-stage32/data/opt/openslx/bin/udhcpc.openslx.script | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/udhcpc.openslx.script b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/udhcpc.openslx.script index 1cfd3036..ab0f0d48 100755 --- a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/udhcpc.openslx.script +++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/udhcpc.openslx.script @@ -69,12 +69,26 @@ search lp.ruf.uni-freiburg.de # Write to openslx-config echo "# Config written by openslx-dhcp-script" >> /opt/openslx/config echo "SLX_DNS='$dns'" >> /opt/openslx/config - echo "SLX_HOSTNAME='$(hostname)'" >> /opt/openslx/config + echo "SLX_HOSTNAME='$hostname'" >> /opt/openslx/config + #update ip + sed -i "s/^\(SLX_PXE_CLIENT_IP=\).*$/\1'$ip'/" /opt/openslx/config + + #update hostname + if [ -n "$hostname" ]; then + echo "$hostname" > /proc/sys/kernel/hostname + echo "$hostname" > /etc/hostname + fi ;; deconfig) - + if [ $(grep -c "nfs=" /proc/cmdline) == 0 ]; then + echo 1 > /proc/sys/net/ipv4/conf/$interface/promote_secondaries + clientip=${ip%%:*} + ip addr del $clientip/$(ipcalc -s -p $clientip $subnet|sed s/.*=//) dev $interface + else + echo "NFS is active, not removing old ip adress. warning: lease may expire after a while." + fi ;; leasefail) |