Patchwork [1/2] dhcp3: Making support for ro /etc - require /etc/resolv.conf to be a soft link to rw fs

login
register
mail settings
Submitter Kim Bøndergaard
Date Nov. 1, 2013, 8:55 a.m.
Message ID <fc3a07292c6fb2c376c4e5074dec5329449f1b45.1383295764.git.kibo@prevas.dk>
Download mbox | patch
Permalink /patch/287744/
State Accepted
Delegated to: Esben Haabendal
Headers show

Comments

Kim Bøndergaard - Nov. 1, 2013, 8:55 a.m.
---
 recipes/dhcp/dhcp3-3.1-ESV-R3/linux40.patch | 31 +++++++++++++++++++++++++++++
 recipes/dhcp/dhcp3.inc                      |  1 +
 2 files changed, 32 insertions(+)
 create mode 100644 recipes/dhcp/dhcp3-3.1-ESV-R3/linux40.patch
Esben Haabendal - Nov. 27, 2013, 1:07 p.m.
Kim Bøndergaard <kibo@prevas.dk> writes:

> ---
>  recipes/dhcp/dhcp3-3.1-ESV-R3/linux40.patch | 31 +++++++++++++++++++++++++++++
>  recipes/dhcp/dhcp3.inc                      |  1 +
>  2 files changed, 32 insertions(+)
>  create mode 100644 recipes/dhcp/dhcp3-3.1-ESV-R3/linux40.patch
>
> diff --git a/recipes/dhcp/dhcp3-3.1-ESV-R3/linux40.patch b/recipes/dhcp/dhcp3-3.1-ESV-R3/linux40.patch
> new file mode 100644
> index 0000000..cd3db92
> --- /dev/null
> +++ b/recipes/dhcp/dhcp3-3.1-ESV-R3/linux40.patch
> @@ -0,0 +1,31 @@
> +--- dhcp-3.1-ESV-R3/client/scripts/linux.org	2013-10-31 11:35:04.054062394 +0100
> ++++ dhcp-3.1-ESV-R3/client/scripts/linux	2013-10-31 12:07:22.070005132 +0100
> +@@ -24,21 +24,22 @@
> + 
> + make_resolv_conf() {
> +   if [ x"$new_domain_name_servers" != x ]; then
> +-    cat /dev/null > /etc/resolv.conf.dhclient
> +-    chmod 644 /etc/resolv.conf.dhclient
> ++    cat /dev/null > /tmp/$$.resolv.conf.dhclient
> ++    chmod 644 /tmp/$$.resolv.conf.dhclient
> +     if [ x"$new_domain_search" != x ]; then
> +-      echo search $new_domain_search >> /etc/resolv.conf.dhclient
> ++      echo search $new_domain_search >> /tmp/$$.resolv.conf.dhclient
> +     elif [ x"$new_domain_name" != x ]; then
> +       # Note that the DHCP 'Domain Name Option' is really just a domain
> +       # name, and that this practice of using the domain name option as
> +       # a search path is both nonstandard and deprecated.
> +-      echo search $new_domain_name >> /etc/resolv.conf.dhclient
> ++      echo search $new_domain_name >> /tmp/$$.resolv.conf.dhclient
> +     fi
> +     for nameserver in $new_domain_name_servers; do
> +-      echo nameserver $nameserver >>/etc/resolv.conf.dhclient
> ++      echo nameserver $nameserver >>/tmp/$$.resolv.conf.dhclient
> +     done
> + 
> +-    mv /etc/resolv.conf.dhclient /etc/resolv.conf
> ++    cp /tmp/$$.resolv.conf.dhclient /etc/resolv.conf
> ++    rm /tmp/$$.resolv.conf.dhclient
> +   fi
> + }
> + 
> diff --git a/recipes/dhcp/dhcp3.inc b/recipes/dhcp/dhcp3.inc
> index cab53c1..f90667a 100644
> --- a/recipes/dhcp/dhcp3.inc
> +++ b/recipes/dhcp/dhcp3.inc
> @@ -12,6 +12,7 @@ SRC_URI = "ftp://ftp.isc.org/isc/dhcp/dhcp-${PV}.tar.gz \
>      file://init-relay file://default-relay \
>      file://init-server file://default-server \
>      file://linux30.patch \
> +    file://linux40.patch \
>      file://dhclient.conf file://dhcpd.conf"
>  
>  S = "${SRCDIR}/dhcp-${PV}"

Merged to master.

I rephrased the commit message, as the change does not really require
resolv.conf to be a soft link, but merely allows it to be a soft link.

/Esben

Patch

diff --git a/recipes/dhcp/dhcp3-3.1-ESV-R3/linux40.patch b/recipes/dhcp/dhcp3-3.1-ESV-R3/linux40.patch
new file mode 100644
index 0000000..cd3db92
--- /dev/null
+++ b/recipes/dhcp/dhcp3-3.1-ESV-R3/linux40.patch
@@ -0,0 +1,31 @@ 
+--- dhcp-3.1-ESV-R3/client/scripts/linux.org	2013-10-31 11:35:04.054062394 +0100
++++ dhcp-3.1-ESV-R3/client/scripts/linux	2013-10-31 12:07:22.070005132 +0100
+@@ -24,21 +24,22 @@
+ 
+ make_resolv_conf() {
+   if [ x"$new_domain_name_servers" != x ]; then
+-    cat /dev/null > /etc/resolv.conf.dhclient
+-    chmod 644 /etc/resolv.conf.dhclient
++    cat /dev/null > /tmp/$$.resolv.conf.dhclient
++    chmod 644 /tmp/$$.resolv.conf.dhclient
+     if [ x"$new_domain_search" != x ]; then
+-      echo search $new_domain_search >> /etc/resolv.conf.dhclient
++      echo search $new_domain_search >> /tmp/$$.resolv.conf.dhclient
+     elif [ x"$new_domain_name" != x ]; then
+       # Note that the DHCP 'Domain Name Option' is really just a domain
+       # name, and that this practice of using the domain name option as
+       # a search path is both nonstandard and deprecated.
+-      echo search $new_domain_name >> /etc/resolv.conf.dhclient
++      echo search $new_domain_name >> /tmp/$$.resolv.conf.dhclient
+     fi
+     for nameserver in $new_domain_name_servers; do
+-      echo nameserver $nameserver >>/etc/resolv.conf.dhclient
++      echo nameserver $nameserver >>/tmp/$$.resolv.conf.dhclient
+     done
+ 
+-    mv /etc/resolv.conf.dhclient /etc/resolv.conf
++    cp /tmp/$$.resolv.conf.dhclient /etc/resolv.conf
++    rm /tmp/$$.resolv.conf.dhclient
+   fi
+ }
+ 
diff --git a/recipes/dhcp/dhcp3.inc b/recipes/dhcp/dhcp3.inc
index cab53c1..f90667a 100644
--- a/recipes/dhcp/dhcp3.inc
+++ b/recipes/dhcp/dhcp3.inc
@@ -12,6 +12,7 @@  SRC_URI = "ftp://ftp.isc.org/isc/dhcp/dhcp-${PV}.tar.gz \
     file://init-relay file://default-relay \
     file://init-server file://default-server \
     file://linux30.patch \
+    file://linux40.patch \
     file://dhclient.conf file://dhcpd.conf"
 
 S = "${SRCDIR}/dhcp-${PV}"