[arch-releng] [RFC] [PATCH] [archiso] Add DNS resolver support to archiso_pxe_common

Gerardo Exequiel Pozzi vmlinuz386 at yahoo.com.ar
Wed Nov 23 21:25:02 EST 2011


[ramfs /]# cat /etc/resolv.conf
nameserver 192.168.0.77
[ramfs /]# curl -O http://releng.archlinux.org/pxeboot/README
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1129  100  1129    0     0   2191      0 --:--:-- --:--:-- --:--:--  4589
[ramfs /]#

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386 at yahoo.com.ar>
---
 archiso/hooks/archiso_pxe_common   |    8 ++++++++
 archiso/install/archiso_pxe_common |    8 ++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/archiso/hooks/archiso_pxe_common b/archiso/hooks/archiso_pxe_common
index cf9fce8..febb503 100644
--- a/archiso/hooks/archiso_pxe_common
+++ b/archiso/hooks/archiso_pxe_common
@@ -30,5 +30,13 @@ run_hook () {
         . /tmp/net-*.conf
 
         pxeserver=${ROOTSERVER}
+
+        # setup DNS resolver
+        if [[ "${IPV4DNS0}" != "0.0.0.0" ]]; then
+            echo "nameserver ${IPV4DNS0}" > /etc/resolv.conf
+        fi
+        if [[ "${IPV4DNS1}" != "0.0.0.0" ]]; then
+            echo "nameserver ${IPV4DNS1}" >> /etc/resolv.conf
+        fi
     fi
 }
diff --git a/archiso/install/archiso_pxe_common b/archiso/install/archiso_pxe_common
index ebf908e..b012aab 100644
--- a/archiso/install/archiso_pxe_common
+++ b/archiso/install/archiso_pxe_common
@@ -11,9 +11,17 @@ build ()
     FILES=""
     SCRIPT="archiso_pxe_common"
 
+    # Add here for now, but this should go to "install/base".
     add_dir /tmp
+    add_dir /etc
 
     add_binary "/lib/initcpio/ipconfig" "/bin/ipconfig"
+
+    # Add DNS resolver support
+    # Do not "add_binary /lib/libnss_dns.so.2", because will add libnss_dns-VERSION.so.2 as libnss_dns.so.2
+    # Is not an issue will work (nobody links directly to VERSION), but is not nice.
+    add_symlink $(readlink /lib/libnss_dns.so.2) /lib/libnss_dns.so.2
+    add_binary $(readlink -f /lib/libnss_dns.so.2)
 }
 
 help ()
-- 
1.7.7.4



More information about the arch-releng mailing list