[OE-core] [oe-core][RFC 0/2] busybox:udhcpc: add option for modify resolv.conf
Henning Heinold
henning at itconsulting-heinold.de
Tue Sep 8 15:47:34 UTC 2015
* add a default file for udhcpc which is sourced
in simple.script
* add a configuration option to the default file
and simple.script for enable/disable the
modification of /etc/resolv.conf
* the default behavior was not changed
This work was sponsored by sysmocom GmbH
Signed-off-by: Henning Heinold <henning at itconsulting-heinold.de>
---
meta/recipes-core/busybox/busybox.inc | 4 +++-
meta/recipes-core/busybox/busybox_1.23.2.bb | 1 +
meta/recipes-core/busybox/busybox_git.bb | 1 +
meta/recipes-core/busybox/files/simple.script | 28 +++++++++++++++-----------
meta/recipes-core/busybox/files/udhcpc.default | 2 ++
5 files changed, 23 insertions(+), 13 deletions(-)
create mode 100644 meta/recipes-core/busybox/files/udhcpc.default
diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
index ed8f9fe..71605be 100644
--- a/meta/recipes-core/busybox/busybox.inc
+++ b/meta/recipes-core/busybox/busybox.inc
@@ -25,7 +25,7 @@ FILES_${PN}-httpd = "${sysconfdir}/init.d/busybox-httpd /srv/www"
FILES_${PN}-syslog = "${sysconfdir}/init.d/syslog* ${sysconfdir}/syslog-startup.conf* ${sysconfdir}/syslog.conf* ${systemd_unitdir}/system/syslog.service ${sysconfdir}/default/busybox-syslog"
FILES_${PN}-mdev = "${sysconfdir}/init.d/mdev ${sysconfdir}/mdev.conf ${sysconfdir}/mdev/*"
FILES_${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd"
-FILES_${PN}-udhcpc = "${sysconfdir}/udhcpc.d ${datadir}/udhcpc"
+FILES_${PN}-udhcpc = "${sysconfdir}/udhcpc.d ${datadir}/udhcpc ${datadir}/default/udhcpc"
FILES_${PN}-hwclock = "${sysconfdir}/init.d/hwclock.sh"
INITSCRIPT_PACKAGES = "${PN}-httpd ${PN}-syslog ${PN}-udhcpd ${PN}-mdev ${PN}-hwclock"
@@ -259,8 +259,10 @@ do_install () {
if grep "CONFIG_UDHCPC=y" ${B}/.config; then
install -d ${D}${sysconfdir}/udhcpc.d
install -d ${D}${datadir}/udhcpc
+ install -d ${D}${sysconfdir}/default
install -m 0755 ${WORKDIR}/simple.script ${D}${sysconfdir}/udhcpc.d/50default
install -m 0755 ${WORKDIR}/default.script ${D}${datadir}/udhcpc/default.script
+ install -m 0644 ${WORKDIR}/udhcpc.default ${D}${sysconfdir}/default/udhcpc
fi
if grep "CONFIG_INETD=y" ${B}/.config; then
install -m 0755 ${WORKDIR}/inetd ${D}${sysconfdir}/init.d/inetd.${BPN}
diff --git a/meta/recipes-core/busybox/busybox_1.23.2.bb b/meta/recipes-core/busybox/busybox_1.23.2.bb
index 8a4bae6..b904cf7 100644
--- a/meta/recipes-core/busybox/busybox_1.23.2.bb
+++ b/meta/recipes-core/busybox/busybox_1.23.2.bb
@@ -10,6 +10,7 @@ SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
file://busybox-udhcpd \
file://default.script \
file://simple.script \
+ file://udhcpc.default \
file://hwclock.sh \
file://mount.busybox \
file://syslog \
diff --git a/meta/recipes-core/busybox/busybox_git.bb b/meta/recipes-core/busybox/busybox_git.bb
index ade72f4..4c04557 100644
--- a/meta/recipes-core/busybox/busybox_git.bb
+++ b/meta/recipes-core/busybox/busybox_git.bb
@@ -16,6 +16,7 @@ SRC_URI = "git://busybox.net/busybox.git \
file://busybox-udhcpd \
file://default.script \
file://simple.script \
+ file://udhcpc.default \
file://hwclock.sh \
file://mount.busybox \
file://syslog \
diff --git a/meta/recipes-core/busybox/files/simple.script b/meta/recipes-core/busybox/files/simple.script
index 22168b0..216a56f 100644
--- a/meta/recipes-core/busybox/files/simple.script
+++ b/meta/recipes-core/busybox/files/simple.script
@@ -4,6 +4,8 @@
[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
+[ -r /etc/default/udhcpc ] && . /etc/default/udhcpc
+
RESOLV_CONF="/etc/resolv.conf"
[ -n "$subnet" ] && NETMASK="netmask $subnet"
@@ -67,22 +69,24 @@ case "$1" in
done
fi
- # Update resolver configuration file
- R=""
- [ -n "$domain" ] && R="domain $domain
+ if [ "$STATIC_DNS" != "yes" ]; then
+ # Update resolver configuration file
+ R=""
+ [ -n "$domain" ] && R="domain $domain
"
- for i in $dns; do
- echo "$0: Adding DNS $i"
- R="${R}nameserver $i
+ for i in $dns; do
+ echo "$0: Adding DNS $i"
+ R="${R}nameserver $i
"
- done
+ done
- if [ -x /sbin/resolvconf ]; then
- echo -n "$R" | /sbin/resolvconf -a "${interface}.udhcpc"
- else
- echo -n "$R" > "$RESOLV_CONF"
+ if [ -x /sbin/resolvconf ]; then
+ echo -n "$R" | /sbin/resolvconf -a "${interface}.udhcpc"
+ else
+ echo -n "$R" > "$RESOLV_CONF"
+ fi
+ ;;
fi
- ;;
esac
exit 0
diff --git a/meta/recipes-core/busybox/files/udhcpc.default b/meta/recipes-core/busybox/files/udhcpc.default
new file mode 100644
index 0000000..2c42cf0
--- /dev/null
+++ b/meta/recipes-core/busybox/files/udhcpc.default
@@ -0,0 +1,2 @@
+# Uncomment the following line, if udhcpc should not touch /etc/resolv.conf
+#STATIC_DNS="yes"
--
1.9.1
More information about the Openembedded-core
mailing list