Support dns bootoption.
authorMichael Prokop <mika@grml.org>
Tue, 3 May 2011 15:38:33 +0000 (17:38 +0200)
committerMichael Prokop <mika@grml.org>
Tue, 3 May 2011 15:38:33 +0000 (17:38 +0200)
debian/patches/00list
debian/patches/26_support_dns_bootoption.dpatch [new file with mode: 0755]

index d880648..5ab6610 100644 (file)
@@ -13,3 +13,4 @@
 18_support_mtdblock_as_device_name.dpatch
 19_revert_toram_bootoption_to_expected_behaviour.dpatch
 25_support_lvm_for_live-media.dpatch
+26_support_dns_bootoption.dpatch
diff --git a/debian/patches/26_support_dns_bootoption.dpatch b/debian/patches/26_support_dns_bootoption.dpatch
new file mode 100755 (executable)
index 0000000..f79d962
--- /dev/null
@@ -0,0 +1,64 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 26_support_dns_bootoption.dpatch by Michael Prokop <mika@grml.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Support dns bootoption. Usage examples: dns=8.8.8.8 / dns=8.8.8.8,1.2.3.4
+
+@DPATCH@
+diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' live-boot-grml~/scripts/live live-boot-grml/scripts/live
+--- live-boot-grml~/scripts/live       2011-05-03 17:03:57.483541293 +0200
++++ live-boot-grml/scripts/live        2011-05-03 17:03:57.576874626 +0200
+@@ -73,6 +73,18 @@
+                               export DEFCONSOLE
+                               ;;
++                      dns=*)
++                              DNSSERVER="${ARGUMENT#*=}"
++                              if echo "${DNSSERVER}" | grep -q , ; then
++                                      DNSSERVER1="${DNSSERVER%,*}"
++                                      DNSSERVER2="${DNSSERVER#*,}"
++                                      export DNSSERVER1 DNSSERVER2
++                              else
++                                      DNSSERVER1="$DNSSERVER"
++                                      export DNSSERVER1
++                              fi
++                              unset DNSSERVER
++                              ;;
+                       debug)
+                               DEBUG="Yes"
+                               export DEBUG
+diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' live-boot-grml~/scripts/live-bottom/23networking_grml live-boot-grml/scripts/live-bottom/23networking_grml
+--- live-boot-grml~/scripts/live-bottom/23networking_grml      2011-05-03 17:03:57.426874629 +0200
++++ live-boot-grml/scripts/live-bottom/23networking_grml       2011-05-03 17:05:11.820206602 +0200
+@@ -44,7 +44,12 @@
+ # prepare a new /etc/network/interfaces file (and, possibly, a new /etc/resolv.conf)
+ IFFILE="/root/etc/network/interfaces"
+-RESOLVCONF="/root/etc/resolv.conf"
++if [ -L /root/etc/resolv.conf ] ; then
++  # assume we have resolvconf
++  RESOLVCONF=/root/etc/resolvconf/resolv.conf.d/base
++else
++  RESOLVCONF="/root/etc/resolv.conf"
++fi
+ # config for loopback networking
+ cat > $IFFILE << EOF
+@@ -105,3 +110,17 @@
+     echo>> $IFFILE
+ done
++
++# dns bootoption
++if [ -n "$DNSSERVER1" ]
++then
++      # disable any existing entries
++      if [ -r $RESOLVCONF ]
++      then
++              sed -i 's/nameserver/# nameserver/' $RESOLVCONF
++      fi
++      for i in $DNSSERVER1 $DNSSERVER2
++      do
++              echo "nameserver $i" >> $RESOLVCONF
++      done
++fi