summaryrefslogtreecommitdiffstats
path: root/remote/tools/base/data/etc/udhcpc.default.script
diff options
context:
space:
mode:
authorJonathan Bauer2012-12-20 15:33:34 +0100
committerJonathan Bauer2012-12-20 15:33:34 +0100
commitf6dad6269ab3228ead055291b846d2a9edb04564 (patch)
tree30096a5fbd037fe4f9f0a0ef2b68d04317883c8e /remote/tools/base/data/etc/udhcpc.default.script
parentstatic unit files for dbus, cleanup (diff)
downloadtm-scripts-f6dad6269ab3228ead055291b846d2a9edb04564.tar.gz
tm-scripts-f6dad6269ab3228ead055291b846d2a9edb04564.tar.xz
tm-scripts-f6dad6269ab3228ead055291b846d2a9edb04564.zip
mltk basic script :)
Diffstat (limited to 'remote/tools/base/data/etc/udhcpc.default.script')
-rwxr-xr-xremote/tools/base/data/etc/udhcpc.default.script64
1 files changed, 64 insertions, 0 deletions
diff --git a/remote/tools/base/data/etc/udhcpc.default.script b/remote/tools/base/data/etc/udhcpc.default.script
new file mode 100755
index 00000000..09442a5e
--- /dev/null
+++ b/remote/tools/base/data/etc/udhcpc.default.script
@@ -0,0 +1,64 @@
+#!/bin/sh
+# Busybox udhcpc dispatcher script. Copyright (C) 2009 by Axel Beckert.
+#
+# Based on the busybox example scripts and the old udhcp source
+# package default.* scripts.
+
+RESOLV_CONF="/etc/resolv.conf"
+
+case $1 in
+ bound|renew)
+ [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
+ [ -n "$subnet" ] && NETMASK="netmask $subnet"
+
+ ip addr add $ip/$(ipcalc -s -p $ip $subnet|sed s/.*=//) dev $interface
+ ip route add default via $router
+
+ # read filename from fbgui.conf where ip config should be saved.
+ ipconf=$(cat /etc/fbgui.conf | grep ip_config | cut -d '=' -f2)
+
+ echo "ip=$ip" > $ipconf
+ echo "subnet=$subnet" >> $ipconf
+ echo "broadcast=$broadcast" >> $ipconf
+ echo "gateway=$router" >> $ipconf
+ echo "$ip:132.230.4.3:$router:$subnet" > /tmp/ip_config_fbgui
+
+ # Update resolver configuration file
+ R=""
+ [ -n "$domain" ] && R="domain $domain
+"
+ count=1;
+ for i in $dns; do
+ echo "$0: Adding DNS $i"
+ R="${R}nameserver $i
+"
+ count=$((count+1));
+ done
+
+ if [ -x /sbin/resolvconf ]; then
+ echo -n "$R" | resolvconf -a "${interface}.udhcpc"
+ else
+ echo -n "$R" > "$RESOLV_CONF"
+ fi
+ trigger=$(cat /etc/fbgui.conf | grep file_trigger | cut -d '=' -f2)
+
+ echo "gogo" >> $trigger
+ ;;
+
+ deconfig)
+
+ ;;
+
+ leasefail)
+ echo "$0: Lease failed: $message"
+ ;;
+
+ nak)
+ echo "$0: Received a NAK: $message"
+ ;;
+
+ *)
+ echo "$0: Unknown udhcpc command: $1";
+ exit 1;
+ ;;
+esac