Use live-boot.log instead of live.log for debug output.
[live-boot-grml.git] / debian / patches / 26_support_dns_bootoption.dpatch
1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## 26_support_dns_bootoption.dpatch by Michael Prokop <mika@grml.org>
3 ##
4 ## All lines beginning with `## DP:' are a description of the patch.
5 ## DP: Support dns bootoption. Usage examples: dns=8.8.8.8 / dns=8.8.8.8,1.2.3.4
6
7 @DPATCH@
8 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
9 --- live-boot-grml~/scripts/live        2011-05-03 17:03:57.483541293 +0200
10 +++ live-boot-grml/scripts/live 2011-05-03 17:03:57.576874626 +0200
11 @@ -73,6 +73,18 @@
12                                 export DEFCONSOLE
13                                 ;;
14  
15 +                       dns=*)
16 +                               DNSSERVER="${ARGUMENT#*=}"
17 +                               if echo "${DNSSERVER}" | grep -q , ; then
18 +                                       DNSSERVER1="${DNSSERVER%,*}"
19 +                                       DNSSERVER2="${DNSSERVER#*,}"
20 +                                       export DNSSERVER1 DNSSERVER2
21 +                               else
22 +                                       DNSSERVER1="$DNSSERVER"
23 +                                       export DNSSERVER1
24 +                               fi
25 +                               unset DNSSERVER
26 +                               ;;
27                         debug)
28                                 DEBUG="Yes"
29                                 export DEBUG
30 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
31 --- live-boot-grml~/scripts/live-bottom/23networking_grml       2011-05-03 17:03:57.426874629 +0200
32 +++ live-boot-grml/scripts/live-bottom/23networking_grml        2011-05-03 17:05:11.820206602 +0200
33 @@ -44,7 +44,12 @@
34  
35  # prepare a new /etc/network/interfaces file (and, possibly, a new /etc/resolv.conf)
36  IFFILE="/root/etc/network/interfaces"
37 -RESOLVCONF="/root/etc/resolv.conf"
38 +if [ -L /root/etc/resolv.conf ] ; then
39 +  # assume we have resolvconf
40 +  RESOLVCONF=/root/etc/resolvconf/resolv.conf.d/base
41 +else
42 +  RESOLVCONF="/root/etc/resolv.conf"
43 +fi
44  
45  # config for loopback networking
46  cat > $IFFILE << EOF
47 @@ -105,3 +110,17 @@
48  
49      echo>> $IFFILE
50  done
51 +
52 +# dns bootoption
53 +if [ -n "$DNSSERVER1" ]
54 +then
55 +       # disable any existing entries
56 +       if [ -r $RESOLVCONF ]
57 +       then
58 +               sed -i 's/nameserver/# nameserver/' $RESOLVCONF
59 +       fi
60 +       for i in $DNSSERVER1 $DNSSERVER2
61 +       do
62 +               echo "nameserver $i" >> $RESOLVCONF
63 +       done
64 +fi