Merge lp:~lamont/cloud-initramfs-tools/yakkety-ipv6 into lp:cloud-initramfs-tools

Proposed by LaMont Jones
Status: Merged
Merged at revision: 119
Proposed branch: lp:~lamont/cloud-initramfs-tools/yakkety-ipv6
Merge into: lp:cloud-initramfs-tools
Diff against target: 172 lines (+89/-26)
2 files modified
debian/changelog (+1/-1)
dyn-netconf/scripts/init-bottom/cloud-initramfs-dyn-netconf (+88/-25)
To merge this branch: bzr merge lp:~lamont/cloud-initramfs-tools/yakkety-ipv6
Reviewer Review Type Date Requested Status
cloud-initramfs-tools Pending
Review via email: mp+307629@code.launchpad.net

Commit message

Initrd scripts are set -e, "A && action" is fatal.

Description of the change

Initrd scripts are set -e, "A && action" is fatal.

To post a comment you must log in.
120. By LaMont Jones

cleanup whitespace

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2016-09-28 14:15:51 +0000
3+++ debian/changelog 2016-10-04 20:22:45 +0000
4@@ -1,6 +1,6 @@
5 cloud-initramfs-tools (0.29ubuntu2) UNRELEASED; urgency=medium
6
7- [ Lamont Jones ]
8+ [ LaMont Jones ]
9 * Add IPV6 support to cloud-initramfs-dyn-netconf. (LP: #1621615)
10
11 -- Scott Moser <smoser@ubuntu.com> Tue, 27 Sep 2016 16:07:48 -0600
12
13=== modified file 'dyn-netconf/scripts/init-bottom/cloud-initramfs-dyn-netconf'
14--- dyn-netconf/scripts/init-bottom/cloud-initramfs-dyn-netconf 2016-09-28 14:15:51 +0000
15+++ dyn-netconf/scripts/init-bottom/cloud-initramfs-dyn-netconf 2016-10-04 20:22:45 +0000
16@@ -30,13 +30,46 @@
17 #DHCPLEASETIME='3600'
18 #DOMAINSEARCH=''
19
20+# superseded by isc-dhcp and such writing the file and supporting IPv6:
21+#DEVICE=eno1
22+#HOSTNAME=
23+#DNSDOMAIN=
24+#reason='PREINIT'
25+#interface='eno1'
26+#DEVICE=eno1
27+#HOSTNAME=
28+#DNSDOMAIN=
29+#reason='FAIL'
30+#interface='eno1'
31+#DEVICE=eno1
32+#HOSTNAME=
33+#DNSDOMAIN=
34+#reason='PREINIT6'
35+#interface='eno1'
36+#DEVICE=eno1
37+#IPV6PROTO=dhcp6
38+#IPV6ADDR=2001:67c:1562:8010:1::4324
39+#IPV6NETMASK=64
40+#IPV6DNS0=2001:67c:1562:8010::2:1
41+#IPV6DOMAINSEARCH=
42+#HOSTNAME=
43+#DNSDOMAIN=
44+#reason='BOUND6'
45+#interface='eno1'
46+#new_ip6_address='2001:67c:1562:8010:1::4324'
47+#new_ip6_prefixlen='64'
48+#new_dhcp6_name_servers='2001:67c:1562:8010::2:1'
49+
50+
51 error() { echo "${0##*/}:" "$@" 1>&2; }
52 configure_net_if_needed() {
53 # we want to call configure_networking if and only if ip= was seen
54 # on the command line (LP: #1463846)
55 local ip="$1"
56 # empty 'ip' or ip=none or ip=off specifically mean do not bring up
57- [ -z "$ip" ] && return 0
58+ if [ -z "$ip" ]; then
59+ return 0
60+ fi
61 case "$ip" in
62 none|off) return 0;;
63 esac
64@@ -47,7 +80,9 @@
65 # configure_networking does a check like this. however, its check is
66 # broken in the event that BOOTIF is not found on the command line.
67 for f in /run/net-*.conf /tmp/net-*.conf; do
68- [ -f "$f" ] && return 0
69+ if [ -f "$f" ]; then
70+ return 0
71+ fi
72 done
73
74 configure_networking
75@@ -85,46 +120,74 @@
76 error "WARNING: $f had no 'DEVICE' set"
77 continue
78 fi
79+ # If IPv6 is supported, we get both of these, and at least one of them
80+ # is set. If we get both, use IPv4.
81+ # Prior to that, PROTO was used, so we know it's IPv4 we want.
82+ if [ -z "$IPV4PROTO" -a -z "$IPV6PROTO" ]; then
83+ IPV4PROTO="$PROTO"
84+ fi
85 # ipconfig on precise does not write PROTO.
86- if [ -z "$PROTO" ]; then
87+ if [ -z "$IPV4PROTO" -a -z "$IPV6PROTO" ]; then
88 if [ -n "$filename" ]; then
89- PROTO="dhcp"
90+ IPV4PROTO="dhcp"
91 else
92- PROTO="static"
93+ IPV4PROTO="static"
94 fi
95 fi
96
97+ # We need to use care, since the script is running set -e.
98 echo "manual $DEVICE"
99- if [ "$PROTO" = "dhcp" ]; then
100+ if [ "$IPV4PROTO" = "dhcp" ]; then
101 echo "iface $DEVICE inet dhcp"
102- elif [ "$PROTO" = "static" ]; then
103+ elif [ "$IPV4PROTO" = "static" ]; then
104 echo "iface $DEVICE inet static"
105- [ -n "$IPV4ADDR" ] && printf "\t%s\n" "address $IPV4ADDR"
106- [ -n "$IPV4NETMASK" ] && printf "\t%s\n" "netmask $IPV4NETMASK"
107- [ -n "$IPV4GATEWAY" ] && printf "\t%s\n" "gateway $IPV4GATEWAY"
108- fi
109- if [ "$IPV6PROTO" = "dhcp" ]; then
110+ if [ -n "$IPV4ADDR" ]; then
111+ printf "\t%s\n" "address $IPV4ADDR"
112+ else
113+ error "WARNING: $f static with no address"
114+ fi
115+ if [ -n "$IPV4NETMASK" ]; then
116+ printf "\t%s\n" "netmask $IPV4NETMASK"
117+ else
118+ error "WARNING: $f static with no netmask"
119+ fi
120+ if [ -n "$IPV4GATEWAY" ]; then
121+ printf "\t%s\n" "gateway $IPV4GATEWAY"
122+ fi
123+ elif [ "$IPV6PROTO" = "dhcp6" ]; then
124 echo "iface $DEVICE inet6 dhcp"
125 elif [ "$IPV6PROTO" = "static" ]; then
126 echo "iface $DEVICE inet6 static"
127- [ -n "$IPV6ADDR" ] && printf "\t%s\n" "address $IPV6ADDR"
128- [ -n "$IPV6NETMASK" ] && printf "\t%s\n" "netmask $IPV6NETMASK"
129- [ -n "$IPV6GATEWAY" ] && printf "\t%s\n" "gateway $IPV6GATEWAY"
130+ if [ -n "$IPV6ADDR" ]; then
131+ printf "\t%s\n" "address $IPV6ADDR"
132+ else
133+ error "WARNING: $f static with no address"
134+ fi
135+ if [ -n "$IPV6NETMASK" ]; then
136+ printf "\t%s\n" "netmask $IPV6NETMASK"
137+ else
138+ error "WARNING: $f static with no netmask"
139+ fi
140+ if [ -n "$IPV6GATEWAY" ]; then
141+ printf "\t%s\n" "gateway $IPV6GATEWAY"
142+ fi
143 fi
144+
145+ nsline=""
146 if [ -n "$IPV4DNS0" -a "$IPV4DNS0" != "0.0.0.0" ]; then
147 nsline="${IPV4DNS0}"
148- [ -n "$IPV4DNS1" -a "$IPV4DNS1" != "0.0.0.0" ] &&
149+ if [ -n "$IPV4DNS1" -a "$IPV4DNS1" = "0.0.0.0" ]; then
150 nsline="${nsline} ${IPV4DNS1}"
151- fi
152- if [ -n "$IPV6DNS0" -a "$IPV6DNS0" != "0.0.0.0" ]; then
153- nsline="${IPV6DNS0}"
154- [ -n "$IPV6DNS1" -a "$IPV6DNS1" != "0.0.0.0" ] &&
155- nsline="${nsline} ${IPV6DNS1}"
156- fi
157- [ -n "$nsline" ] && printf "\tdns-nameservers %s\n" "$nsline"
158- [ -n "$DNSDOMAIN" -o -n "$DOMAINSEARCH" -o -n $IPV6DOMAINSEARCH] &&
159- SEARCH=" ${DNSDOMAIN} ${DOMAINSEARCH} ${IPV6DOMAINSEARCH}" &&
160+ fi
161+ elif [ -n "$IPV6DNS0" ]; then
162+ nsline="${nsline} ${IPV6DNS0}"
163+ [ -z "$IPV6DNS1" ] || nsline="${nsline} ${IPV6DNS1}"
164+ fi
165+ [ -z "$nsline" ] || printf "\tdns-nameservers %s\n" "$nsline"
166+ if [ -n "${DNSDOMAIN}${DOMAINSEARCH}${IPV6DOMAINSEARCH}" ]; then
167+ SEARCH=" ${DNSDOMAIN} ${DOMAINSEARCH} ${IPV6DOMAINSEARCH}"
168 printf "\tdns-search %s\n" "${SEARCH}"
169+ fi
170 done >> "$tmpf"
171
172 [ -d /run/network ] || mkdir /run/network

Subscribers

People subscribed via source and target branches