Patchwork resolvconf/initscripts: Change resolv.conf generation for sysvinit

login
register
mail settings
Submitter Jate S
Date June 26, 2014, 2:03 p.m.
Message ID <1403791418-2125-1-git-send-email-jatedev@gmail.com>
Download mbox | patch
Permalink /patch/74411/
State New
Headers show

Comments

Jate S - June 26, 2014, 2:03 p.m.
The resolv.conf link generated by initscripts causes a warning with
resolvconf. The resolvconf script expects a different target.

Use the ALTERNATIVES system to create the link via populate-volatiles.sh.

Signed-off-by: Jate Sujjavanich <jatedev@gmail.com>
---
 .../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
Jate S - Aug. 11, 2014, 12:46 a.m.
Patch ping follow up


On Thu, Jun 26, 2014 at 10:03 AM, Jate Sujjavanich <jatedev@gmail.com>
wrote:

> The resolv.conf link generated by initscripts causes a warning with
> resolvconf. The resolvconf script expects a different target.
>
> Use the ALTERNATIVES system to create the link via populate-volatiles.sh.
>
> Signed-off-by: Jate Sujjavanich <jatedev@gmail.com>
> ---
>  .../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
>
>
Jate S - Sept. 3, 2014, 8:29 p.m.
Anybody using resolvconf?

Ping


On Sun, Aug 10, 2014 at 8:46 PM, Jate Sujjavanich <jatedev@gmail.com> wrote:

> Patch ping follow up
>
>
>
> On Thu, Jun 26, 2014 at 10:03 AM, Jate Sujjavanich <jatedev@gmail.com>
> wrote:
>
>> The resolv.conf link generated by initscripts causes a warning with
>> resolvconf. The resolvconf script expects a different target.
>>
>> Use the ALTERNATIVES system to create the link via populate-volatiles.sh.
>>
>> Signed-off-by: Jate Sujjavanich <jatedev@gmail.com>
>> ---
>>  .../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
>>
>>
>

Patch

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"