[oe-commits] Andreas Oberritter : busybox: port improvements to simple. script from Debian (udhcpc)

git at git.openembedded.org git at git.openembedded.org
Sun May 6 09:15:45 UTC 2012


Module: openembedded-core.git
Branch: master-next
Commit: 3d4ccf98b83fe662f375cd5b029fdd602824c0e8
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=3d4ccf98b83fe662f375cd5b029fdd602824c0e8

Author: Andreas Oberritter <obi at opendreambox.org>
Date:   Fri May  4 15:09:38 2012 +0200

busybox: port improvements to simple.script from Debian (udhcpc)

* Support resolvconf
* Avoid bashism $((metric++))
* Use 'domain' instead of 'search' for domain parameter

Signed-off-by: Andreas Oberritter <obi at opendreambox.org>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 meta/recipes-core/busybox/busybox_1.19.4.bb   |    2 +-
 meta/recipes-core/busybox/files/simple.script |   27 ++++++++++++++++++------
 2 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/meta/recipes-core/busybox/busybox_1.19.4.bb b/meta/recipes-core/busybox/busybox_1.19.4.bb
index 0b1e787..a797ac9 100644
--- a/meta/recipes-core/busybox/busybox_1.19.4.bb
+++ b/meta/recipes-core/busybox/busybox_1.19.4.bb
@@ -1,5 +1,5 @@
 require busybox.inc
-PR = "r4"
+PR = "r5"
 
 SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
            file://B921600.patch \
diff --git a/meta/recipes-core/busybox/files/simple.script b/meta/recipes-core/busybox/files/simple.script
index 5cc21b9..27368f0 100644
--- a/meta/recipes-core/busybox/files/simple.script
+++ b/meta/recipes-core/busybox/files/simple.script
@@ -20,6 +20,9 @@ fi
 
 case "$1" in
 	deconfig)
+		if [ -x /sbin/resolvconf ]; then
+			/sbin/resolvconf -d "${interface}.udhcpc"
+		fi
 		if ! root_is_nfs ; then
                         if [ $have_bin_ip -eq 1 ]; then
                                 ip addr flush dev $interface
@@ -53,19 +56,29 @@ case "$1" in
 			metric=0
 			for i in $router ; do
                                 if [ $have_bin_ip -eq 1 ]; then
-                                        ip route add default via $i metric $((metric++))
+                                        ip route add default via $i metric $metric
                                 else
-                                        route add default gw $i dev $interface metric $((metric++)) 2>/dev/null
+                                        route add default gw $i dev $interface metric $metric 2>/dev/null
                                 fi
+                                metric=$(($metric + 1))
 			done
 		fi
 
-		echo -n > $RESOLV_CONF
-		[ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
-		for i in $dns ; do
-			echo adding dns $i
-			echo nameserver $i >> $RESOLV_CONF
+		# Update resolver configuration file
+		R=""
+		[ -n "$domain" ] && R="domain $domain
+"
+		for i in $dns; do
+			echo "$0: Adding DNS $i"
+			R="${R}nameserver $i
+"
 		done
+
+		if [ -x /sbin/resolvconf ]; then
+			echo -n "$R" | /sbin/resolvconf -a "${interface}.udhcpc"
+		else
+			echo -n "$R" > "$RESOLV_CONF"
+		fi
 		;;
 esac
 





More information about the Openembedded-commits mailing list