summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/busybox/files/simple.script
diff options
context:
space:
mode:
authorTudor Florea <tudor.florea@enea.com>2014-10-16 03:05:19 +0200
committerTudor Florea <tudor.florea@enea.com>2014-10-16 03:05:19 +0200
commitc527fd1f14c27855a37f2e8ac5346ce8d940ced2 (patch)
treebb002c1fdf011c41dbd2f0927bed23ecb5f83c97 /meta/recipes-core/busybox/files/simple.script
downloadpoky-daisy-140929.tar.gz
initial commit for Enea Linux 4.0-140929daisy-140929
Migrated from the internal git server on the daisy-enea-point-release branch Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta/recipes-core/busybox/files/simple.script')
-rw-r--r--meta/recipes-core/busybox/files/simple.script86
1 files changed, 86 insertions, 0 deletions
diff --git a/meta/recipes-core/busybox/files/simple.script b/meta/recipes-core/busybox/files/simple.script
new file mode 100644
index 0000000000..78ac4242a8
--- /dev/null
+++ b/meta/recipes-core/busybox/files/simple.script
@@ -0,0 +1,86 @@
1#!/bin/sh
2
3# udhcpc script edited by Tim Riker <Tim@Rikers.org>
4
5[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
6
7RESOLV_CONF="/etc/resolv.conf"
8[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
9[ -n "$subnet" ] && NETMASK="netmask $subnet"
10
11# return 0 if root is mounted on a network filesystem
12root_is_nfs() {
13 sed -n 's/^[^ ]* \([^ ]*\) \([^ ]*\) .*$/\1 \2/p' /proc/mounts |
14 grep -q "^/ \(nfs\|smbfs\|ncp\|coda\)$"
15}
16
17have_bin_ip=0
18if [ -x /sbin/ip ]; then
19 have_bin_ip=1
20fi
21
22case "$1" in
23 deconfig)
24 if [ -x /sbin/resolvconf ]; then
25 /sbin/resolvconf -d "${interface}.udhcpc"
26 fi
27 if ! root_is_nfs ; then
28 if [ $have_bin_ip -eq 1 ]; then
29 ip addr flush dev $interface
30 ip link set dev $interface up
31 else
32 /sbin/ifconfig $interface 0.0.0.0
33 fi
34 fi
35 ;;
36
37 renew|bound)
38 if [ $have_bin_ip -eq 1 ]; then
39 ip addr add dev $interface local $ip/$mask $BROADCAST
40 else
41 /sbin/ifconfig $interface $ip $BROADCAST $NETMASK
42 fi
43
44 if [ -n "$router" ] ; then
45 if ! root_is_nfs ; then
46 if [ $have_bin_ip -eq 1 ]; then
47 while ip route del default 2>/dev/null ; do
48 :
49 done
50 else
51 while route del default gw 0.0.0.0 dev $interface 2>/dev/null ; do
52 :
53 done
54 fi
55 fi
56
57 metric=0
58 for i in $router ; do
59 if [ $have_bin_ip -eq 1 ]; then
60 ip route add default via $i metric $metric
61 else
62 route add default gw $i dev $interface metric $metric 2>/dev/null
63 fi
64 metric=$(($metric + 1))
65 done
66 fi
67
68 # Update resolver configuration file
69 R=""
70 [ -n "$domain" ] && R="domain $domain
71"
72 for i in $dns; do
73 echo "$0: Adding DNS $i"
74 R="${R}nameserver $i
75"
76 done
77
78 if [ -x /sbin/resolvconf ]; then
79 echo -n "$R" | /sbin/resolvconf -a "${interface}.udhcpc"
80 else
81 echo -n "$R" > "$RESOLV_CONF"
82 fi
83 ;;
84esac
85
86exit 0