Fix patch offsets for quilt patches
[live-boot-grml.git] / debian / patches / 26_support_dns_bootoption.patch
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 --- a/scripts/live
9 +++ b/scripts/live
10 @@ -77,6 +77,18 @@
11                                 BOOTIF="${x#BOOTIF=}"
12                                 ;;
13  
14 +                       dns=*)
15 +                               DNSSERVER="${ARGUMENT#*=}"
16 +                               if echo "${DNSSERVER}" | grep -q , ; then
17 +                                       DNSSERVER1="${DNSSERVER%,*}"
18 +                                       DNSSERVER2="${DNSSERVER#*,}"
19 +                                       export DNSSERVER1 DNSSERVER2
20 +                               else
21 +                                       DNSSERVER1="$DNSSERVER"
22 +                                       export DNSSERVER1
23 +                               fi
24 +                               unset DNSSERVER
25 +                               ;;
26                         debug)
27                                 DEBUG="Yes"
28                                 export DEBUG
29 --- a/scripts/live-bottom/23networking_grml
30 +++ b/scripts/live-bottom/23networking_grml
31 @@ -44,7 +44,12 @@
32  
33  # prepare a new /etc/network/interfaces file (and, possibly, a new /etc/resolv.conf)
34  IFFILE="/root/etc/network/interfaces"
35 -RESOLVCONF="/root/etc/resolv.conf"
36 +if [ -L /root/etc/resolv.conf ] ; then
37 +  # assume we have resolvconf
38 +  RESOLVCONF=/root/etc/resolvconf/resolv.conf.d/base
39 +else
40 +  RESOLVCONF="/root/etc/resolv.conf"
41 +fi
42  
43  # config for loopback networking
44  cat > $IFFILE << EOF
45 @@ -105,3 +110,17 @@
46  
47      echo>> $IFFILE
48  done
49 +
50 +# dns bootoption
51 +if [ -n "$DNSSERVER1" ]
52 +then
53 +       # disable any existing entries
54 +       if [ -r $RESOLVCONF ]
55 +       then
56 +               sed -i 's/nameserver/# nameserver/' $RESOLVCONF
57 +       fi
58 +       for i in $DNSSERVER1 $DNSSERVER2
59 +       do
60 +               echo "nameserver $i" >> $RESOLVCONF
61 +       done
62 +fi