summaryrefslogtreecommitdiff
path: root/packages/busybox/busybox-1.11.3/udhcpscript.patch
blob: 363f66e03ccd4b828681d78fb212542b394f1f15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

#
# Patch managed by http://www.holgerschurig.de/patcher.html
#

Index: busybox-1.11.3/examples/udhcp/simple.script
===================================================================
--- busybox-1.11.3.orig/examples/udhcp/simple.script	2008-06-25 14:51:33.000000000 +0200
+++ busybox-1.11.3/examples/udhcp/simple.script	2009-01-06 14:34:40.000000000 +0100
@@ -8,17 +8,23 @@
 [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
 [ -n "$subnet" ] && NETMASK="netmask $subnet"
 
+# return 0 if root is mounted on a network filesystem
+root_is_nfs() {
+	grep -qe '^/dev/root.*\(nfs\|smbfs\|ncp\|coda\) .*' /proc/mounts
+}
+
 case "$1" in
 	deconfig)
-		/sbin/ifconfig $interface 0.0.0.0
+		if ! root_is_nfs ; then
+			/sbin/ifconfig $interface 0.0.0.0
+		fi
 		;;
 
 	renew|bound)
 		/sbin/ifconfig $interface $ip $BROADCAST $NETMASK
 
 		if [ -n "$router" ] ; then
-			echo "deleting routers"
-			while route del default gw 0.0.0.0 dev $interface ; do
+			while route del default gw 0.0.0.0 dev $interface 2>/dev/null ; do
 				:
 			done