From: Jate Sujjavanich <jatedev@gmail.com>
To: sgw@linux.intel.com, openembedded-core@lists.openembedded.org
Subject: [PATCH] Change resolv.conf generation for sysvinit
Date: Wed, 25 Jun 2014 17:46:44 -0400 [thread overview]
Message-ID: <1403732804-32097-1-git-send-email-jatedev@gmail.com> (raw)
Move /etc/resolv.conf link generation a volatiles file. Then use
update-alternatives to choose the correct one. This is for sysvinit
and resolvconf.
---
.../resolvconf/files/volatiles_resolv-conf | 1 +
.../resolvconf/resolvconf_1.75.bb | 15 ++++++++++++++-
.../initscripts/initscripts-1.0/volatiles | 1 -
.../initscripts-1.0/volatiles_resolv-conf | 1 +
meta/recipes-core/initscripts/initscripts_1.0.bb | 9 ++++++++-
5 files changed, 24 insertions(+), 3 deletions(-)
create mode 100644 meta/recipes-connectivity/resolvconf/files/volatiles_resolv-conf
create mode 100644 meta/recipes-core/initscripts/initscripts-1.0/volatiles_resolv-conf
diff --git a/meta/recipes-connectivity/resolvconf/files/volatiles_resolv-conf b/meta/recipes-connectivity/resolvconf/files/volatiles_resolv-conf
new file mode 100644
index 0000000..e58993d
--- /dev/null
+++ b/meta/recipes-connectivity/resolvconf/files/volatiles_resolv-conf
@@ -0,0 +1 @@
+l root root 0644 /etc/resolv.conf /etc/resolvconf/run/resolv.conf
diff --git a/meta/recipes-connectivity/resolvconf/resolvconf_1.75.bb b/meta/recipes-connectivity/resolvconf/resolvconf_1.75.bb
index 7310c83..e108516 100644
--- a/meta/recipes-connectivity/resolvconf/resolvconf_1.75.bb
+++ b/meta/recipes-connectivity/resolvconf/resolvconf_1.75.bb
@@ -11,12 +11,16 @@ AUTHOR = "Thomas Hood"
HOMEPAGE = "http://packages.debian.org/resolvconf"
RDEPENDS_${PN} = "bash"
-SRC_URI = "${DEBIAN_MIRROR}/main/r/resolvconf/resolvconf_${PV}.tar.xz"
+SRC_URI = "\
+ ${DEBIAN_MIRROR}/main/r/resolvconf/resolvconf_${PV}.tar.xz \
+ file://volatiles_resolv-conf \
+"
SRC_URI[md5sum] = "4b8bc86a3cf070e3fd0e9aff7eaaba56"
SRC_URI[sha256sum] = "16167f37a77ef4bc4596dcbefece269b6a10d10fa448594ec55ed3303193086e"
inherit allarch
+inherit update-alternatives
do_compile () {
:
@@ -30,6 +34,10 @@ do_install () {
install -d ${D}${sysconfdir}/tmpfiles.d
echo "d /run/${BPN}/interface - - - -" \
> ${D}${sysconfdir}/tmpfiles.d/resolvconf.conf
+ else
+ # Use a volatiles script to install resolv.conf symlink
+ install -d install -d ${D}${libdir}/${BPN}
+ install -m 0755 ${WORKDIR}/volatiles_resolv-conf ${D}${libdir}/${BPN}/resolv-conf
fi
install -d ${D}${sysconfdir}/${BPN}
ln -snf ${localstatedir}/run/${BPN} ${D}${sysconfdir}/${BPN}/run
@@ -42,6 +50,11 @@ do_install () {
install -m 0644 man/resolvconf.8 ${D}${mandir}/man8/
}
+ALTERNATIVE_PRIORITY = "100"
+ALTERNATIVE_${PN}_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'resolvconf', d)}"
+ALTERNATIVE_LINK_NAME[resolv-conf] = "${sysconfdir}/default/volatiles/00_resolv-conf"
+ALTERNATIVE_TARGET[resolv-conf] = "${libdir}/${BPN}/resolv-conf"
+
pkg_postinst_${PN} () {
if [ -z "$D" ]; then
if command -v systemd-tmpfiles >/dev/null; then
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/volatiles b/meta/recipes-core/initscripts/initscripts-1.0/volatiles
index 297245d..cd5f1f1 100644
--- a/meta/recipes-core/initscripts/initscripts-1.0/volatiles
+++ b/meta/recipes-core/initscripts/initscripts-1.0/volatiles
@@ -32,5 +32,4 @@ l root root 1777 /tmp /var/tmp
d root root 0755 /var/lock/subsys none
f root root 0664 /var/log/wtmp none
f root root 0664 /var/run/utmp none
-l root root 0644 /etc/resolv.conf /var/run/resolv.conf
f root root 0644 /var/run/resolv.conf none
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/volatiles_resolv-conf b/meta/recipes-core/initscripts/initscripts-1.0/volatiles_resolv-conf
new file mode 100644
index 0000000..ce7122d
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/volatiles_resolv-conf
@@ -0,0 +1 @@
+l root root 0644 /etc/resolv.conf /var/run/resolv.conf
diff --git a/meta/recipes-core/initscripts/initscripts_1.0.bb b/meta/recipes-core/initscripts/initscripts_1.0.bb
index 7273a82..721e258 100644
--- a/meta/recipes-core/initscripts/initscripts_1.0.bb
+++ b/meta/recipes-core/initscripts/initscripts_1.0.bb
@@ -3,7 +3,7 @@ DESCRIPTION = "Initscripts provide the basic system startup initialization scrip
SECTION = "base"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
-PR = "r155"
+PR = "r156"
INHIBIT_DEFAULT_DEPS = "1"
@@ -29,6 +29,7 @@ SRC_URI = "file://functions \
file://populate-volatile.sh \
file://read-only-rootfs-hook.sh \
file://volatiles \
+ file://volatiles_resolv-conf \
file://save-rtc.sh \
file://GPLv2.patch \
file://dmesg.sh \
@@ -45,8 +46,14 @@ DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd-sys
PACKAGES =+ "${PN}-functions"
RDEPENDS_${PN} = "${PN}-functions"
+FILES_${PN} += "${libdir}/${BPN}/"
FILES_${PN}-functions = "${sysconfdir}/init.d/functions*"
+ALTERNATIVE_PRIORITY_${PN} = "90"
+ALTERNATIVE_${PN} = "resolv-conf"
+ALTERNATIVE_LINK_NAME[resolv-conf] = "${sysconfdir}/default/volatiles/00_resolv-conf"
+ALTERNATIVE_TARGET[resolv-conf] = "${libdir}/${BPN}/resolv-conf"
+
ALTERNATIVE_PRIORITY_${PN}-functions = "90"
ALTERNATIVE_${PN}-functions = "functions"
ALTERNATIVE_LINK_NAME[functions] = "${sysconfdir}/init.d/functions"
--
1.7.9.5
next reply other threads:[~2014-06-25 21:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-25 21:46 Jate Sujjavanich [this message]
2014-06-25 22:18 ` [PATCH] Change resolv.conf generation for sysvinit Saul Wold
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1403732804-32097-1-git-send-email-jatedev@gmail.com \
--to=jatedev@gmail.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=sgw@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.