[arch-releng] [PATCH] add cmdline options for DNS settings

Thore Boedecker me at foxxx0.de
Thu Dec 17 23:01:07 UTC 2015


Signed-off-by: Thore Boedecker <me at foxxx0.de>
---
 archiso/initcpio/hooks/archiso_pxe_common | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/archiso/initcpio/hooks/archiso_pxe_common b/archiso/initcpio/hooks/archiso_pxe_common
index d3aa46f..edf8cfd 100644
--- a/archiso/initcpio/hooks/archiso_pxe_common
+++ b/archiso/initcpio/hooks/archiso_pxe_common
@@ -36,13 +36,27 @@ run_hook () {
 
         pxeserver=${ROOTSERVER}
 
-        # setup DNS resolver
-        if [[ "${IPV4DNS0}" != "0.0.0.0" ]]; then
+        # read DNS and DOMAIN cmdline arguments (if present), otherwise use
+        # addresses provided by ipconfig
+        if [[ -n "${DNS0}" ]]; then
+            echo "Using DNS Server from cmdline (DNS0): ${DNS0}"
+            echo "nameserver ${DNS0}" > /etc/resolv.conf
+        elif [[ "${IPV4DNS0}" != "0.0.0.0" ]]; then
             echo "nameserver ${IPV4DNS0}" > /etc/resolv.conf
         fi
-        if [[ "${IPV4DNS1}" != "0.0.0.0" ]]; then
+        if [[ -n "${DNS1}" ]]; then
+            echo "Using DNS Server from cmdline (DNS1): ${DNS1}"
+            echo "nameserver ${DNS1}" >> /etc/resolv.conf
+        elif [[ "${IPV4DNS1}" != "0.0.0.0" ]]; then
             echo "nameserver ${IPV4DNS1}" >> /etc/resolv.conf
         fi
+
+        # setup DNSDOMAIN
+        if [[ -n "${DOMAIN}" ]]; then
+            echo "Using DNSDOMAIN from cmdline (DOMAIN): ${DOMAIN}"
+            echo "domain ${DOMAIN}" >> /etc/resolv.conf
+        fi
+
     fi
 }
 
-- 
2.6.4


More information about the arch-releng mailing list