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
=== modified file 'debian/changelog'
--- debian/changelog 2016-09-28 14:15:51 +0000
+++ debian/changelog 2016-10-04 20:22:45 +0000
@@ -1,6 +1,6 @@
1cloud-initramfs-tools (0.29ubuntu2) UNRELEASED; urgency=medium1cloud-initramfs-tools (0.29ubuntu2) UNRELEASED; urgency=medium
22
3 [ Lamont Jones ]3 [ LaMont Jones ]
4 * Add IPV6 support to cloud-initramfs-dyn-netconf. (LP: #1621615)4 * Add IPV6 support to cloud-initramfs-dyn-netconf. (LP: #1621615)
55
6 -- Scott Moser <smoser@ubuntu.com> Tue, 27 Sep 2016 16:07:48 -06006 -- Scott Moser <smoser@ubuntu.com> Tue, 27 Sep 2016 16:07:48 -0600
77
=== modified file 'dyn-netconf/scripts/init-bottom/cloud-initramfs-dyn-netconf'
--- dyn-netconf/scripts/init-bottom/cloud-initramfs-dyn-netconf 2016-09-28 14:15:51 +0000
+++ dyn-netconf/scripts/init-bottom/cloud-initramfs-dyn-netconf 2016-10-04 20:22:45 +0000
@@ -30,13 +30,46 @@
30#DHCPLEASETIME='3600'30#DHCPLEASETIME='3600'
31#DOMAINSEARCH=''31#DOMAINSEARCH=''
3232
33# superseded by isc-dhcp and such writing the file and supporting IPv6:
34#DEVICE=eno1
35#HOSTNAME=
36#DNSDOMAIN=
37#reason='PREINIT'
38#interface='eno1'
39#DEVICE=eno1
40#HOSTNAME=
41#DNSDOMAIN=
42#reason='FAIL'
43#interface='eno1'
44#DEVICE=eno1
45#HOSTNAME=
46#DNSDOMAIN=
47#reason='PREINIT6'
48#interface='eno1'
49#DEVICE=eno1
50#IPV6PROTO=dhcp6
51#IPV6ADDR=2001:67c:1562:8010:1::4324
52#IPV6NETMASK=64
53#IPV6DNS0=2001:67c:1562:8010::2:1
54#IPV6DOMAINSEARCH=
55#HOSTNAME=
56#DNSDOMAIN=
57#reason='BOUND6'
58#interface='eno1'
59#new_ip6_address='2001:67c:1562:8010:1::4324'
60#new_ip6_prefixlen='64'
61#new_dhcp6_name_servers='2001:67c:1562:8010::2:1'
62
63
33error() { echo "${0##*/}:" "$@" 1>&2; }64error() { echo "${0##*/}:" "$@" 1>&2; }
34configure_net_if_needed() {65configure_net_if_needed() {
35 # we want to call configure_networking if and only if ip= was seen66 # we want to call configure_networking if and only if ip= was seen
36 # on the command line (LP: #1463846)67 # on the command line (LP: #1463846)
37 local ip="$1"68 local ip="$1"
38 # empty 'ip' or ip=none or ip=off specifically mean do not bring up69 # empty 'ip' or ip=none or ip=off specifically mean do not bring up
39 [ -z "$ip" ] && return 070 if [ -z "$ip" ]; then
71 return 0
72 fi
40 case "$ip" in73 case "$ip" in
41 none|off) return 0;;74 none|off) return 0;;
42 esac75 esac
@@ -47,7 +80,9 @@
47 # configure_networking does a check like this. however, its check is80 # configure_networking does a check like this. however, its check is
48 # broken in the event that BOOTIF is not found on the command line.81 # broken in the event that BOOTIF is not found on the command line.
49 for f in /run/net-*.conf /tmp/net-*.conf; do82 for f in /run/net-*.conf /tmp/net-*.conf; do
50 [ -f "$f" ] && return 083 if [ -f "$f" ]; then
84 return 0
85 fi
51 done86 done
5287
53 configure_networking88 configure_networking
@@ -85,46 +120,74 @@
85 error "WARNING: $f had no 'DEVICE' set"120 error "WARNING: $f had no 'DEVICE' set"
86 continue121 continue
87 fi122 fi
123 # If IPv6 is supported, we get both of these, and at least one of them
124 # is set. If we get both, use IPv4.
125 # Prior to that, PROTO was used, so we know it's IPv4 we want.
126 if [ -z "$IPV4PROTO" -a -z "$IPV6PROTO" ]; then
127 IPV4PROTO="$PROTO"
128 fi
88 # ipconfig on precise does not write PROTO.129 # ipconfig on precise does not write PROTO.
89 if [ -z "$PROTO" ]; then130 if [ -z "$IPV4PROTO" -a -z "$IPV6PROTO" ]; then
90 if [ -n "$filename" ]; then131 if [ -n "$filename" ]; then
91 PROTO="dhcp"132 IPV4PROTO="dhcp"
92 else133 else
93 PROTO="static"134 IPV4PROTO="static"
94 fi135 fi
95 fi136 fi
96137
138 # We need to use care, since the script is running set -e.
97 echo "manual $DEVICE"139 echo "manual $DEVICE"
98 if [ "$PROTO" = "dhcp" ]; then140 if [ "$IPV4PROTO" = "dhcp" ]; then
99 echo "iface $DEVICE inet dhcp"141 echo "iface $DEVICE inet dhcp"
100 elif [ "$PROTO" = "static" ]; then142 elif [ "$IPV4PROTO" = "static" ]; then
101 echo "iface $DEVICE inet static"143 echo "iface $DEVICE inet static"
102 [ -n "$IPV4ADDR" ] && printf "\t%s\n" "address $IPV4ADDR"144 if [ -n "$IPV4ADDR" ]; then
103 [ -n "$IPV4NETMASK" ] && printf "\t%s\n" "netmask $IPV4NETMASK"145 printf "\t%s\n" "address $IPV4ADDR"
104 [ -n "$IPV4GATEWAY" ] && printf "\t%s\n" "gateway $IPV4GATEWAY"146 else
105 fi147 error "WARNING: $f static with no address"
106 if [ "$IPV6PROTO" = "dhcp" ]; then148 fi
149 if [ -n "$IPV4NETMASK" ]; then
150 printf "\t%s\n" "netmask $IPV4NETMASK"
151 else
152 error "WARNING: $f static with no netmask"
153 fi
154 if [ -n "$IPV4GATEWAY" ]; then
155 printf "\t%s\n" "gateway $IPV4GATEWAY"
156 fi
157 elif [ "$IPV6PROTO" = "dhcp6" ]; then
107 echo "iface $DEVICE inet6 dhcp"158 echo "iface $DEVICE inet6 dhcp"
108 elif [ "$IPV6PROTO" = "static" ]; then159 elif [ "$IPV6PROTO" = "static" ]; then
109 echo "iface $DEVICE inet6 static"160 echo "iface $DEVICE inet6 static"
110 [ -n "$IPV6ADDR" ] && printf "\t%s\n" "address $IPV6ADDR"161 if [ -n "$IPV6ADDR" ]; then
111 [ -n "$IPV6NETMASK" ] && printf "\t%s\n" "netmask $IPV6NETMASK"162 printf "\t%s\n" "address $IPV6ADDR"
112 [ -n "$IPV6GATEWAY" ] && printf "\t%s\n" "gateway $IPV6GATEWAY"163 else
164 error "WARNING: $f static with no address"
165 fi
166 if [ -n "$IPV6NETMASK" ]; then
167 printf "\t%s\n" "netmask $IPV6NETMASK"
168 else
169 error "WARNING: $f static with no netmask"
170 fi
171 if [ -n "$IPV6GATEWAY" ]; then
172 printf "\t%s\n" "gateway $IPV6GATEWAY"
173 fi
113 fi174 fi
175
176 nsline=""
114 if [ -n "$IPV4DNS0" -a "$IPV4DNS0" != "0.0.0.0" ]; then177 if [ -n "$IPV4DNS0" -a "$IPV4DNS0" != "0.0.0.0" ]; then
115 nsline="${IPV4DNS0}"178 nsline="${IPV4DNS0}"
116 [ -n "$IPV4DNS1" -a "$IPV4DNS1" != "0.0.0.0" ] &&179 if [ -n "$IPV4DNS1" -a "$IPV4DNS1" = "0.0.0.0" ]; then
117 nsline="${nsline} ${IPV4DNS1}"180 nsline="${nsline} ${IPV4DNS1}"
118 fi181 fi
119 if [ -n "$IPV6DNS0" -a "$IPV6DNS0" != "0.0.0.0" ]; then182 elif [ -n "$IPV6DNS0" ]; then
120 nsline="${IPV6DNS0}"183 nsline="${nsline} ${IPV6DNS0}"
121 [ -n "$IPV6DNS1" -a "$IPV6DNS1" != "0.0.0.0" ] &&184 [ -z "$IPV6DNS1" ] || nsline="${nsline} ${IPV6DNS1}"
122 nsline="${nsline} ${IPV6DNS1}"185 fi
123 fi186 [ -z "$nsline" ] || printf "\tdns-nameservers %s\n" "$nsline"
124 [ -n "$nsline" ] && printf "\tdns-nameservers %s\n" "$nsline"187 if [ -n "${DNSDOMAIN}${DOMAINSEARCH}${IPV6DOMAINSEARCH}" ]; then
125 [ -n "$DNSDOMAIN" -o -n "$DOMAINSEARCH" -o -n $IPV6DOMAINSEARCH] &&188 SEARCH=" ${DNSDOMAIN} ${DOMAINSEARCH} ${IPV6DOMAINSEARCH}"
126 SEARCH=" ${DNSDOMAIN} ${DOMAINSEARCH} ${IPV6DOMAINSEARCH}" &&
127 printf "\tdns-search %s\n" "${SEARCH}"189 printf "\tdns-search %s\n" "${SEARCH}"
190 fi
128done >> "$tmpf"191done >> "$tmpf"
129192
130[ -d /run/network ] || mkdir /run/network193[ -d /run/network ] || mkdir /run/network

Subscribers

People subscribed via source and target branches