summaryrefslogtreecommitdiffstats
path: root/remote
diff options
context:
space:
mode:
authorJonathan Bauer2013-07-31 17:25:22 +0200
committerJonathan Bauer2013-07-31 17:25:22 +0200
commit91c66e022325637b577eb6f2d9046c1ce8b42d00 (patch)
tree34473e1e83e781ed8a8ab6ffa43c167cf8b194ac /remote
parentrestructuring (diff)
downloadtm-scripts-91c66e022325637b577eb6f2d9046c1ce8b42d00.tar.gz
tm-scripts-91c66e022325637b577eb6f2d9046c1ce8b42d00.tar.xz
tm-scripts-91c66e022325637b577eb6f2d9046c1ce8b42d00.zip
restructing
Diffstat (limited to 'remote')
-rwxr-xr-xremote/modules/german/data/opt/openslx/bin/load_german_keymaps22
-rwxr-xr-xremote/modules/redsocks/data/opt/openslx/bin/setup_proxy51
l---------remote/rootfs/rootfs-stage32/data/etc/systemd/system/sysinit.target.wants/download-config.service1
-rwxr-xr-xremote/rootfs/rootfs-stage32/data/opt/openslx/bin/activate-sysconfig28
-rwxr-xr-xremote/rootfs/rootfs-stage32/data/opt/openslx/bin/analyse-disk111
-rwxr-xr-xremote/rootfs/rootfs-stage32/data/opt/openslx/bin/dhcp++11
-rwxr-xr-xremote/rootfs/rootfs-stage32/data/opt/openslx/bin/load-gfx-driver16
-rwxr-xr-xremote/rootfs/rootfs-stage32/data/opt/openslx/scripts/mountexport17
-rwxr-xr-xremote/rootfs/rootfs-stage32/data/opt/openslx/scripts/nettime22
-rwxr-xr-xremote/rootfs/rootfs-stage32/data/opt/openslx/scripts/udhcpc-openslx-script174
10 files changed, 213 insertions, 240 deletions
diff --git a/remote/modules/german/data/opt/openslx/bin/load_german_keymaps b/remote/modules/german/data/opt/openslx/bin/load_german_keymaps
deleted file mode 100755
index c7dbbb33..00000000
--- a/remote/modules/german/data/opt/openslx/bin/load_german_keymaps
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash
-# Script serves as container script for a systemd-call due to the buggyness of several
-# loadkeys-implementations <= kbd (Linux keyboard tools) 1.15.3.
-# This bug can be detected through failure of the command pipe 'dumpkeys|loadkeys' yielding
-# the message "unknown keysym 'compose'.
-
-# So we first try to insert a keymap including compose-lines:
-loadkeys /opt/openslx/keymaps/german_qwertz_compose_keyboard_translation.map
-ERR=$?
-
-# ... if this fails we enter a keymap without compose-lines:
-if [[ "$ERR" -eq 0 ]]; then
- exit 0 # in that case everything went smooth - exit.
-else
- loadkeys /opt/openslx/keymaps/german_qwertz_keyboard_translation.map # insert a keymap without compose lines
- ERR=$?
-fi
-
-# if at this point the second keymap insertion failed we pass the errorlevel to
-# systemd - we cannot do more at this point.
-
-exit $ERR
diff --git a/remote/modules/redsocks/data/opt/openslx/bin/setup_proxy b/remote/modules/redsocks/data/opt/openslx/bin/setup_proxy
deleted file mode 100755
index 6c39c077..00000000
--- a/remote/modules/redsocks/data/opt/openslx/bin/setup_proxy
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/bin/bash
-
-for wait in 1 1 2 3 4 6 8 10 end; do
- grep '^#_RCONFIG_TAG$' /opt/openslx/config > /dev/null && echo "Config found!" && break
- [ "$wait" == "end" ] && echo "Giving up!" && exit 1
- echo "No config yet..."
- sleep $wait
-done
-
-. /opt/openslx/config || echo "Error sourcing config for setup_proxy"
-
-[ -z "$SLX_PROXY_MODE" -o "x$SLX_PROXY_MODE" == "xoff" ] && echo "proxy mode disabled." && exit 0
-
-PROXY=off
-if [ "$SLX_PROXY_MODE" == "on" ]; then
- PROXY=on
-elif [ "$SLX_PROXY_MODE" == "auto" -a -n "$SLX_PXE_CLIENT_IP" ]; then
- [[ "$SLX_PXE_CLIENT_IP" =~ ^10\. ]] && PROXY=on
- [[ "$SLX_PXE_CLIENT_IP" =~ ^192\.168\. ]] && PROXY=on
- [[ "$SLX_PXE_CLIENT_IP" =~ ^172\.[123] ]] && PROXY=on
-fi
-
-[ "$PROXY" == "off" ] && echo "Proxy mode not required." && exit 0
-
-sed -i "s/%%PROXY_IP%%/$SLX_PROXY_IP/g;s/%%PROXY_PORT%%/$SLX_PROXY_PORT/g;s/%%PROXY_TYPE%%/$SLX_PROXY_TYPE/g" /etc/redsocks.conf
-
-mkdir -p /run/redsocks
-chown redsocks:redsocks /run/redsocks
-systemctl start redsocks
-
-iptables -t nat -N REDSOCKS
-iptables -t nat -A REDSOCKS -d "$SLX_PROXY_IP" -j RETURN
-iptables -t nat -A REDSOCKS -d 0.0.0.0/8 -j RETURN
-iptables -t nat -A REDSOCKS -d 10.0.0.0/8 -j RETURN
-iptables -t nat -A REDSOCKS -d 127.0.0.0/8 -j RETURN
-iptables -t nat -A REDSOCKS -d 169.254.0.0/16 -j RETURN
-iptables -t nat -A REDSOCKS -d 172.16.0.0/12 -j RETURN
-iptables -t nat -A REDSOCKS -d 192.168.0.0/16 -j RETURN
-iptables -t nat -A REDSOCKS -d 224.0.0.0/4 -j RETURN
-iptables -t nat -A REDSOCKS -d 240.0.0.0/4 -j RETURN
-if [ -n "$SLX_PROXY_BLACKLIST" ]; then
- for ADDR in $SLX_PROXY_BLACKLIST; do
- iptables -t nat -A REDSOCKS -d "$ADDR" -j RETURN
- done
-fi
-iptables -t nat -A REDSOCKS -p tcp -j REDIRECT --to-port 12345
-iptables -t nat -A PREROUTING -p tcp -j REDSOCKS
-iptables -t nat -A OUTPUT -p tcp -j REDSOCKS
-iptables -t nat -A POSTROUTING -o br0 -j MASQUERADE
-iptables -A INPUT -i br0 -p tcp --dport 12345 -j DROP
-
diff --git a/remote/rootfs/rootfs-stage32/data/etc/systemd/system/sysinit.target.wants/download-config.service b/remote/rootfs/rootfs-stage32/data/etc/systemd/system/sysinit.target.wants/download-config.service
deleted file mode 120000
index a7d51e0b..00000000
--- a/remote/rootfs/rootfs-stage32/data/etc/systemd/system/sysinit.target.wants/download-config.service
+++ /dev/null
@@ -1 +0,0 @@
-../download-config.service \ No newline at end of file
diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/activate-sysconfig b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/activate-sysconfig
deleted file mode 100755
index dbe23b21..00000000
--- a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/activate-sysconfig
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/bash
-
-if [ $# -gt 0 ]; then
- CONFIG="$1/opt/openslx/config"
-else
- CONFIG="/opt/openslx/config"
-fi
-
-[ -e "$CONFIG" ] && grep '^#_RCONFIG_TAG$' "$CONFIG" > /dev/null && echo "Config already fetched." && exit 0
-
-URL="$(grep -o -E "slxconfig=\S+" /proc/cmdline | cut -c 11-)"
-
-if [ -z "$URL" ]; then
- echo "Error - 'slxconfig=' not found in command line, or empty"
- exit 1
-fi
-
-wget -T 5 -q -O "${CONFIG}-remote" "$URL"
-RET=$?
-if [ "x$RET" != "x0" ]; then
- echo "Error - downloading '$URL' via wget failed. Exit Code: $RET"
- exit 1
-fi
-echo "# Config fetched from $URL" >> "$CONFIG"
-echo "#_RCONFIG_TAG" >> "$CONFIG"
-cat "${CONFIG}-remote" >> "$CONFIG"
-exit 0
-
diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/analyse-disk b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/analyse-disk
deleted file mode 100755
index f162ec3a..00000000
--- a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/analyse-disk
+++ /dev/null
@@ -1,111 +0,0 @@
-#!/bin/bash
-# Copyright (c) 2013 - OpenSLX GmbH
-#
-# This program is free software distributed under the GPL version 2.
-# See http://openslx.org/COPYING
-#
-# If you have any feedback please consult http://openslx.org/feedback and
-# send your feedback to feedback@openslx.org
-#
-# General information about OpenSLX can be found under http://openslx.org
-#
-# Local hard disk autodetection script for OpenSLX linux stateless clients,
-# detecting swap and special partitions
-
-#############################################################################
-
-
-# General formatter for the /tmp partition on a local harddisk
-diskfm () {
-local target="$1"
-local fs
-local path
-for fs in xfs ext3 ext2 ; do
- unset available
- case $(cat /proc/filesystems) in
- *${fs}*) available=yes;;
- *) modprobe "${fs}" && available=yes;;
- esac
- if [ -n "${available}" ]; then
- unset found
- if which "mkfs.$fs" ; then
- found=yes
- case "mkfs.$fs" in
- mkfs.xfs)
- fopt="-f"
- mopt="-o noexec"
- ;;
- mkfs.ext2)
- fopt="-Fq"
- mopt="-o nocheck,noexec"
- ;;
- mkfs.reiserfs)
- fopt="-f"
- mopt="-o noexec"
- ;;
- esac
- mkfs.$fs ${fopt} "${target}"
- fi
- [ -n "$found" ] && break
- fi
-done
-}
-
-# Check for local harddisks and appropriate partitions
-for waiting in 1 1 2 3 4; do
- fdisk -l | sed -n "/^\/dev\//p" > "/etc/disk.partition"
- [ -s "/etc/disk.partition" ] && break
- sleep "$waiting"
-done
-echo "Partitions:"
-cat "/etc/disk.partition"
-
-# Check for standard swap partitions and make them available to the system
-for hdpartnr in $(sed -n -e "/ 82 /p" "/etc/disk.partition" | sed -e "s/[[:space:]].*//"); do
- echo -e "$hdpartnr\tswap\t\tswap\t\tdefaults\t 0 0" >> "/etc/fstab"
- swapon "$hdpartnr"
-done
-
-# We use special non assigned partition type (id44) for harddisk scratch
-# space, thus no normal filesystem will be incidentally deleted or
-# corrupted
-for hdpartnr in $(sed -n -e "/ 44 /p" "/etc/disk.partition" | sed -e "s/[[:space:]].*//"); do
- # check for supported filesystem and formatter
- if diskfm "$hdpartnr"; then
- # echo "$hdpartnr is mounted to /mnt/tmp at $(sysup)" >/tmp/tmpready
- echo -e "$hdpartnr\t/tmp\t\tnoauto\t\tdefaults\t 0 0" >> "/etc/fstab"
- mkdir -p /tmptmp
- mv /tmp/* /tmp/.* /tmptmp/
- mount "$hdpartnr" /tmp
- chmod a+rwxt /tmp
- mv /tmptmp/* /tmptmp/.* /tmp/
- rmdir /tmptmp
- break
- else
- echo "formatting failed for some reason"
- fi # Made this non-forking, systemd should handle it - 2013-05-28
-done
-
-# Put detected linux partitions (83) into /etc/fstab with "noauto", special
-# partition 45 (persistent scratch) to /var/scratch and 46 to /var/openslx
-for partid in 83 45 46 ; do
- for hdpartnr in $(sed -n -e "/ ${partid} /p" "/etc/disk.partition" | sed -e "s/[[:space:]].*//"); do
- mkdir -p "/media/${hdpartnr#/dev/*}"
- if [ "${partid}" -eq 83 ]; then
- echo -e "$hdpartnr\t/media/${hdpartnr#/dev/*}\tauto\t\tnoauto,noexec\t 0 0" >> "/etc/fstab"
- elif [ "${partid}" -eq 45 ]; then
- #mount -t auto ${hdpartnr} /media/${hdpartnr#/dev/*}
- #ln -sf /media/${hdpartnr#/dev/*} /var/scratch
- echo -e "${hdpartnr}\t/media/${hdpartnr#/dev/*}\tauto\t\tnoauto\t\t 0 0" >> "/etc/fstab"
- elif [ "${partid}" -eq 46 ]; then
- # Mount a home directory to (/mnt)/var/home
- #mount -t auto ${hdpartnr} /mnt/media/${hdpartnr#/dev/*} \n\
- #test -d /mnt/media/${hdpartnr#/dev/*}/home && \
- # ln -sf /media/${hdpartnr#/dev/*} /var/home
- echo -e "${hdpartnr}\t/media/${hdpartnr#/dev/*}\tauto\t\tnoauto\t\t 0 0" >> "/etc/fstab"
- fi
- done
-done
-
-mount -a
-
diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/dhcp++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/dhcp++
deleted file mode 100755
index 45984032..00000000
--- a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/dhcp++
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-NET_IF="$1"
-NET_IP="$(ip addr show dev "${NET_IF}" | grep "inet " | awk -F " " '{print $2}' | awk -F "/" '{print $1}')"
-
-UDHCPC_OPTS=""
-[ ! -z "$NET_IP" ] && UDHCPC_OPTS=" -r $NET_IP "
-echo "udhcp++: running on $NET_IF with additional params $UDHCPC_OPTS" >> "/tmp/udhcpclog"
-mkdir -p /run/udhcpc
-/opt/openslx/sbin/udhcpc $UDHCPC_OPTS -O domain -O nissrv -O nisdomain -O wpad -t 8 -s /opt/openslx/bin/udhcpc.openslx.script -i "$NET_IF" -p "/run/udhcpc/udhcpc.$NET_IF.pid"
-
diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/load-gfx-driver b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/load-gfx-driver
deleted file mode 100755
index 04fbea6e..00000000
--- a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/load-gfx-driver
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-
-PCIFILE=/tmp/lspci-output
-
-if ! lspci -n > "$PCIFILE"; then
- echo "lspci -n failed..."
- exit 1
-fi
-
-if grep -E ' 8086:0152( |$)' "$PCIFILE" > /dev/null; then
- echo "i915 - enable 3D"
- echo -e "# Written by load-gfx-driver\nSLX_VMWARE_3D=yes" >> "/opt/openslx/config"
-fi
-
-exit 0
-
diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/mountexport b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/mountexport
new file mode 100755
index 00000000..64d5f485
--- /dev/null
+++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/mountexport
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+export PATH=$PATH:/opt/openslx/usr/sbin:/opt/openslx/usr/bin:/opt/openslx/sbin:/opt/openslx/bin
+
+if grep "Ubuntu 13.04" "/etc/issue" >/dev/null; then
+ EXPORT="132.230.8.113:/srv/ubuntu1304"
+elif grep "SUSE" "/etc/issue" >/dev/null; then
+ EXPORT="132.230.8.113:/srv/suse"
+else
+ echo "Could not determine System"
+ exit 1
+fi
+
+echo "Mounting ${EXPORT} to /opt/openslx/mnt"
+mount -t nfs -o ro,async,nolock,vers=3 "$EXPORT" /opt/openslx/mnt || { echo "Fail." && exit 1; }
+echo "Appending /opt/openslx/mnt to /"
+mount -o remount,append:/opt/openslx/mnt=ro / || { echo "Fail." && exit 1; }
diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/nettime b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/nettime
new file mode 100755
index 00000000..3ca13931
--- /dev/null
+++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/nettime
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+. /opt/openslx/config || { echo "Could not source config!"; exit 1; }
+SLX_NTP_SERVER="$SLX_NTP_SERVER time.uni-freiburg.de 0.de.pool.ntp.org"
+for SERVER in $SLX_NTP_SERVER; do
+ if ntpdate -u -b "$SERVER"; then
+ echo "Successfully queried $SERVER for time."
+ if [ "x$SLX_BIOS_CLOCK" = "xlocal" ]; then
+ sleep 1
+ hwclock -l -w || echo "... but could not set BIOS clock to localtime"
+ elif [ "x$SLX_BIOS_CLOCK" = "xutc" ]; then
+ sleep 1
+ hwclock -u -w || echo "... but could not set BIOS clock to UTC"
+ fi
+ exit 0
+ fi
+ echo "Error querying $SERVER for current time"
+done
+
+echo "No more servers to try. No NTP server was reachable." >&2
+exit 1
+
diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/udhcpc-openslx-script b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/udhcpc-openslx-script
new file mode 100755
index 00000000..1bbf6e80
--- /dev/null
+++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/udhcpc-openslx-script
@@ -0,0 +1,174 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+#
+# Copyright (c) 2011 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+#
+# Mini-Linux Toolkit
+#
+# -----------------------------------------------------------------------------
+
+. /opt/openslx/config
+
+RESOLV_CONF="/etc/resolv.conf"
+THISFILE="/run/udhcpc/${interface}.resolv"
+
+echo "$interface [$1] $ip" >> "/tmp/udhcpclog"
+
+rebuild_resolv_conf () {
+ # Maybe make this smarter some time, if anyone is using client's that are on multiple networks at once etc...
+ # This is a little braindead but should work most of the time
+ sort -u /run/udhcpc/*.resolv > "$RESOLV_CONF"
+}
+
+escape_search() {
+ echo "$@" | sed -e 's/[]\/()$*.^|[]/\\&/g'
+}
+
+escape_replace() {
+ echo "$@" | sed -e 's/[\/&]/\\&/g'
+}
+
+case "$1" in
+ bound|renew)
+ ip addr add "$ip/$(ipcalc -s -p $ip $subnet|sed s/.*=//)" dev "$interface"
+ if [ -n "$router" ]; then
+ ip route add default via "$router"
+ fi
+
+ # Update resolver configuration file
+ CONF=""
+ if [ -n "$domain" ]; then
+ printf -v CONF "domain $domain\nsearch $domain\n"
+ elif [ -n "$SLX_NET_DOMAIN" ]; then
+ printf -v CONF "domain $SLX_NET_DOMAIN\nsearch $SLX_NET_DOMAIN\n"
+ fi
+ for i in $dns; do
+ echo "$0: Adding DNS $i"
+ printf -v CONF "${CONF}nameserver $i\n"
+ done
+
+ if [ -x /sbin/resolvconf ]; then
+ # Automatic handling :-)
+ echo -n "$CONF" | resolvconf -a "${interface}.udhcpc"
+ else
+ # Manual handling required :-(
+ mkdir -p "/run/udhcpc"
+ echo -n "$CONF" > "$THISFILE"
+ rebuild_resolv_conf
+ fi
+
+ # Things that should only happen for the main interface that was used for booting
+ if [ "$interface" == "br0" ]; then
+ #update ip
+ sed -i "s/^\(SLX_PXE_CLIENT_IP=\).*$/\1'$ip'/" /opt/openslx/config
+
+ #update hostname
+ dns_host=$(rdns "$ip")
+ if [ -z "$dns_host" ]; then
+ # fallback to what the dhcp told us
+ dns_host="$hostname"
+ fi
+ if [ -n "$dns_host" ]; then
+ echo "$dns_host" > "/proc/sys/kernel/hostname"
+ echo "$dns_host" > "/etc/hostname"
+ if grep '^SLX_HOSTNAME=' /opt/openslx/config 2>/dev/null; then
+ sed -i "s/^\(SLX_HOSTNAME=\).*$/\1'$dns_host'/" /opt/openslx/config
+ else
+ echo "# Config written by openslx-dhcp-script (1)" >> /opt/openslx/config
+ echo "SLX_HOSTNAME='$dns_host'" >> /opt/openslx/config
+ fi
+ fi
+ fi
+
+ # Hostname in /etc/hosts
+ touch /etc/hosts
+ if [ -n "$dns_host" ]; then
+ short="${dns_host%%.*}"
+ [ "x$short" = "x$dns_host" ] && short=""
+ sed -i -r "s/\s$(escape_search "$dns_host")(\s|$)/ /g" /etc/hosts
+ [ -n "$short" ] && sed -i -r "s/\s$(escape_search "$short")(\s|$)/ /g" /etc/hosts
+ if grep -q -E "^$ip\s" /etc/hosts; then
+ sed -i "s/^$(escape_search "$ip")\s/$(escape_replace "$ip $dns_host $short ")/g" /etc/hosts
+ else
+ echo "$ip $dns_host $short" >> /etc/hosts
+ fi
+ fi
+ if [ -n "$hostname" -a "x$hostname" != "x$dns_host" ]; then
+ short="${hostname%%.*}"
+ [ "x$short" = "x$hostname" ] && short=""
+ sed -i -r "s/\s$(escape_search "$hostname")(\s|$)/ /g" /etc/hosts
+ [ -n "$short" ] && sed -i -r "s/\s$(escape_search "$short")(\s|$)/ /g" /etc/hosts
+ if grep -q -E "^$ip\s" /etc/hosts; then
+ sed -i "s/^$(escape_search "$ip")\s/$(escape_replace "$ip $hostname $short ")/g" /etc/hosts
+ else
+ echo "$ip $hostname $short" >> /etc/hosts
+ fi
+ fi
+ sed -i -r '/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\s*$/d' /etc/hosts
+
+ # We consider the network setup to be complete if an interface is being configured that
+ # has a default route and some dns servers set.
+ if [ -n "$router" ] && [ -n "$dns" ] && [ ! -e "/run/udhcpc/network-ready" ]; then
+ touch "/run/udhcpc/network-ready"
+ # Write to openslx-config
+ echo "# Config written by openslx-dhcp-script (2)" >> /opt/openslx/config
+ echo "SLX_DNS='$dns'" >> /opt/openslx/config
+
+ # TODO: This mounts stage4. Current method is for testing purposes only.
+ # when going productive, this has to happen after user login, if the
+ # user selects a native linux session.
+ if [ "x$(grep -ci mount /proc/cmdline)" != "x0" ]; then
+ systemctl start nfs-mount.service &
+ fi
+ # Mark network target as reached
+ systemctl start network.target
+ 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
+
+ if [ -x /sbin/resolvconf ]; then
+ # Automatic handling :-)
+ resolvconf -d "${interface}.udhcpc"
+ else
+ # Manual handling required :-(
+ rm -f "$THISFILE"
+ rebuild_resolv_conf
+ fi
+
+ ;;
+
+ leasefail)
+ echo "$0: Lease failed: $message"
+
+ ;;
+
+ nak)
+ echo "$0: Received a NAK: $message"
+
+ ;;
+
+ *)
+ echo "$0: Unknown udhcpc command: $1";
+ exit 1;
+
+ ;;
+esac
+