Rebase: adapt patch after deploy-config refactor.
[armband.git] / patches / opnfv-fuel / 000098-FIXME-build-fuel-main-Decouple-patches-Makefile.patch
1 From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
2 Date: Sat, 18 Jun 2016 01:09:27 +0200
3 Subject: [PATCH] WIP: build: fuel-main: Decouple patches, Makefile.
4
5 FIXME: Not tested, only a discussion starter.
6
7 Submitted upstream in Fuel@OPNFv, see change-id.
8
9 ARMBAND changes:
10 Upstream removed all mirrors but usa and cz, and changed
11 its default to mirror.fuel-infra.org in [1].
12
13 This allows us to drop patching of fuel-main/config.mk
14 with the Czech mirror.
15
16 If needed, USE_MIRROR=cz can be specified as an env var.
17
18 FIXME: Remove when Fuel@OPNFV pulls change and deals with it.
19
20 Use `git apply` and/or `git am` in favor of `patch`.
21 Change patches from old context format to unified diff.
22
23 This change allows us to decouple Makefile and patches.
24 This means we no longer have to manually stage touched files
25 before committing them to git.
26
27 Possible improvements:
28 - replace cz mirror patch with USE_MIRROR=cz makevar;
29 - move patches to separate dir and add ordering info (prefix);
30 - merge patches (currently we have one per touched file);
31
32 Remove obsolete (unused?) patch:
33 - fuel-main_docker_version.patch
34
35 [1] https://github.com/openstack/fuel-main/commit/
36     751d502cfe15d9c9df0ee89530ac3b0b73aa1638
37
38 Change-Id: I5b621370993b259779c813b47105f632948e6da7
39 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
40 ---
41  build/Makefile                       |  17 ++--
42  build/bootstrap_admin_node.sh.patch  | 167 +++++++++++++++--------------------
43  build/fuel-main_docker_version.patch |  20 -----
44  build/isolinux.cfg.patch             |  43 +++++----
45  5 files changed, 113 insertions(+), 166 deletions(-)
46  delete mode 100644 build/fuel-main_docker_version.patch
47
48 diff --git a/build/Makefile b/build/Makefile
49 index 956183c..69e5690 100644
50 --- a/build/Makefile
51 +++ b/build/Makefile
52 @@ -109,7 +109,7 @@ $(ISOCACHE):
53                 cd /tmp && git clone $(FUEL_MAIN_REPO); \
54         fi
55         cd /tmp/fuel-main && git checkout $(FUEL_MAIN_TAG)
56 -       @echo "fuel" `git -C /tmp/fuel-main show | grep commit | head -1 | cut -d " " -f2` >> $(VERSION_FILE)
57 +       @echo "fuel" `git -C /tmp/fuel-main rev-parse HEAD` >> $(VERSION_FILE)
58         # Remove Docker optimizations, otherwise multistrap will fail during
59         # Fuel build.
60         sudo rm -f /etc/apt/apt.conf.d/docker*
61 @@ -135,13 +135,10 @@ $(ISOCACHE):
62         # OPNFV patches at Fuel build time
63         # Need to be commited in order for them to be considered by the Fuel
64         # build system
65 -       cd /tmp/fuel-main/iso && git config user.name "Fuel OPNFV"
66 -       cd /tmp/fuel-main/iso && git config user.email "fuel@opnfv.org"
67 -       cd /tmp/fuel-main/iso && patch -p0 < $(TOPDIR)/bootstrap_admin_node.sh.patch
68 -       cd /tmp/fuel-main/iso && git add -u bootstrap_admin_node.sh
69 -       cd /tmp/fuel-main/iso/isolinux && patch -p0 <  $(TOPDIR)/isolinux.cfg.patch
70 -       cd /tmp/fuel-main/iso/isolinux && git add -u isolinux.cfg
71 -       cd /tmp/fuel-main/iso && git commit -m "Added OPNFV patches"
72 +       cd /tmp/fuel-main && git config user.name "Fuel OPNFV"
73 +       cd /tmp/fuel-main && git config user.email "fuel@opnfv.org"
74 +       cd /tmp/fuel-main && git am $(TOPDIR)/bootstrap_admin_node.sh.patch
75 +       cd /tmp/fuel-main && git am $(TOPDIR)/isolinux.cfg.patch
76         # Repeat build up to three times
77         sudo -E ./fuel_build_loop
78         cp /tmp/fuel-main/build/artifacts/fuel*.iso .
79 diff --git a/build/bootstrap_admin_node.sh.patch b/build/bootstrap_admin_node.sh.patch
80 index e137b74..8a2b69f 100644
81 --- a/build/bootstrap_admin_node.sh.patch
82 +++ b/build/bootstrap_admin_node.sh.patch
83 @@ -1,95 +1,72 @@
84 -*** bootstrap_admin_node.sh.orig       Mon May 30 06:31:38 2016
85 ---- bootstrap_admin_node.sh    Mon May 30 06:35:11 2016
86 -***************
87 -*** 339,346 ****
88 -  set +x
89 -  echo "Done!"
90 -  
91 -  if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then
92 -!   fuelmenu || fail
93 -  else
94 -    # Give user 15 seconds to enter fuelmenu or else continue
95 -    echo
96 ---- 339,360 ----
97 -  set +x
98 -  echo "Done!"
99 -  
100 -+ ### OPNFV addition BEGIN
101 -+ shopt -s nullglob
102 -+ for script in /opt/opnfv/bootstrap/pre.d/*.sh
103 -+ do
104 -+   echo "Pre script: $script" >> /root/pre.log 2>&1
105 -+   $script >> /root/pre.log 2>&1
106 -+ done
107 -+ shopt -u nullglob
108 -+ ### OPNFV addition END
109 -+ 
110 -+ # Enable sshd
111 -+ systemctl enable sshd
112 -+ systemctl start sshd
113 -+ 
114 -  if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then
115 -!   fuelmenu
116 -  else
117 -    # Give user 15 seconds to enter fuelmenu or else continue
118 -    echo
119 -***************
120 -*** 360,368 ****
121 -    fi
122 -  fi
123 +From: Fuel OPNFV <fuel@opnfv.org>
124 +Date: Mon, 13 Jun 2016 22:23:57 +0200
125 +Subject: OPNFV: Additions to bootstrap_admin_node.sh
126  
127 -  # Enable online base MOS repos (security, updates) if we run an ISO installation
128 -! [ -f /etc/fuel_build_id ] && \
129 -!   yum-config-manager --enable mos${FUEL_RELEASE}-security mos${FUEL_RELEASE}-updates --save
130 -
131 -  if [ ! -f "${ASTUTE_YAML}" ]; then
132 -    echo ${fuelmenu_fail_message}
133 ---- 360,369 ----
134 -    fi
135 -  fi
136 -
137 -+ # OPNFV: Disabled to speedup installation in offline env.
138 -  # Enable online base MOS repos (security, updates) if we run an ISO installation
139 -! #[ -f /etc/fuel_build_id ] && \
140 -! #  yum-config-manager --enable mos${FUEL_RELEASE}-security mos${FUEL_RELEASE}-updates --save
141 -
142 -  if [ ! -f "${ASTUTE_YAML}" ]; then
143 -    echo ${fuelmenu_fail_message}
144 -***************
145 -*** 374,382 ****
146 -  [ ! -f /etc/fuel_build_id ] && \
147 -    sed -i "s|127.0.0.1:8080/ubuntu/x86_64|mirror.fuel-infra.org/mos-repos/ubuntu/${FUEL_RELEASE}|g" "${ASTUTE_YAML}"
148 -  
149 -! # Enable sshd
150 -! systemctl enable sshd
151 -! systemctl start sshd
152 -  
153 -  # Enable iptables
154 -  systemctl enable iptables.service
155 ---- 388,394 ----
156 -  [ ! -f /etc/fuel_build_id ] && \
157 -    sed -i "s|127.0.0.1:8080/ubuntu/x86_64|mirror.fuel-infra.org/mos-repos/ubuntu/${FUEL_RELEASE}|g" "${ASTUTE_YAML}"
158 -  
159 -! systemctl reload sshd
160 -  
161 -  # Enable iptables
162 -  systemctl enable iptables.service
163 -***************
164 -*** 529,534 ****
165 ---- 541,556 ----
166 -  
167 -  bash /etc/rc.local
168 -  
169 -+ ### OPNFV addition BEGIN
170 -+ shopt -s nullglob
171 -+ for script in /opt/opnfv/bootstrap/post.d/*.sh
172 -+ do
173 -+   echo "Post script: $script" >> /root/post.log 2>&1
174 -+   $script >> /root/post.log 2>&1
175 -+ done
176 -+ shopt -u nullglob
177 -+ ### OPNFV addition END
178 -+ 
179 -  if [ "`get_bootstrap_skip`" = "False" ]; then
180 -    build_ubuntu_bootstrap bs_status || true
181 -  else
182 +---
183 +diff --git a/iso/bootstrap_admin_node.sh b/iso/bootstrap_admin_node.sh
184 +index 3197c91..e035145 100755
185 +--- a/iso/bootstrap_admin_node.sh
186 ++++ b/iso/bootstrap_admin_node.sh
187 +@@ -339,8 +339,22 @@ fuelmenu --save-only --iface=$ADMIN_INTERFACE || fail
188 + set +x
189 + echo "Done!"
190
191 ++### OPNFV addition BEGIN
192 ++shopt -s nullglob
193 ++for script in /opt/opnfv/bootstrap/pre.d/*.sh
194 ++do
195 ++  echo "Pre script: $script" >> /root/pre.log 2>&1
196 ++  $script >> /root/pre.log 2>&1
197 ++done
198 ++shopt -u nullglob
199 ++### OPNFV addition END
200 ++
201 ++# Enable sshd
202 ++systemctl enable sshd
203 ++systemctl start sshd
204 ++
205 + if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then
206 +-  fuelmenu || fail
207 ++  fuelmenu
208 + else
209 +   # Give user 15 seconds to enter fuelmenu or else continue
210 +   echo
211 +@@ -360,9 +374,10 @@ else
212 +   fi
213 + fi
214
215 ++# OPNFV: Disabled to speedup installation in offline env.
216 + # Enable online base MOS repos (security, updates) if we run an ISO installation
217 +-[ -f /etc/fuel_build_id ] && \
218 +-  yum-config-manager --enable mos${FUEL_RELEASE}-security mos${FUEL_RELEASE}-updates --save
219 ++#[ -f /etc/fuel_build_id ] && \
220 ++#  yum-config-manager --enable mos${FUEL_RELEASE}-security mos${FUEL_RELEASE}-updates --save
221
222 + if [ ! -f "${ASTUTE_YAML}" ]; then
223 +   echo ${fuelmenu_fail_message}
224 +@@ -377,7 +392,5 @@ if [ ! -f /etc/fuel_build_id ]; then
225
226 +-# Enable sshd
227 +-systemctl enable sshd
228 +-systemctl start sshd
229 ++systemctl reload sshd
230
231 + # Enable iptables
232 + systemctl enable iptables.service
233 +@@ -532,6 +545,16 @@ systemctl start ntpd
234
235 + bash /etc/rc.local
236
237 ++### OPNFV addition BEGIN
238 ++shopt -s nullglob
239 ++for script in /opt/opnfv/bootstrap/post.d/*.sh
240 ++do
241 ++  echo "Post script: $script" >> /root/post.log 2>&1
242 ++  $script >> /root/post.log 2>&1
243 ++done
244 ++shopt -u nullglob
245 ++### OPNFV addition END
246 ++
247 + if [ "`get_bootstrap_skip`" = "False" ]; then
248 +   build_ubuntu_bootstrap bs_status || true
249 + else
250 diff --git a/build/fuel-main_docker_version.patch b/build/fuel-main_docker_version.patch
251 deleted file mode 100644
252 index 22b5824..0000000
253 --- a/build/fuel-main_docker_version.patch
254 +++ /dev/null
255 @@ -1,20 +0,0 @@
256 -*** prepare-build-env.sh.orig  2016-01-11 14:55:50.615286910 +0100
257 ---- prepare-build-env.sh       2016-01-11 14:59:44.775308422 +0100
258 -***************
259 -*** 102,108 ****
260 -    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
261 -    # Install docker
262 -    sudo apt-get update
263 -!   sudo apt-get -y install lxc-docker-1.5.0
264 -  fi
265 -  
266 -  # Install software
267 ---- 102,109 ----
268 -    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
269 -    # Install docker
270 -    sudo apt-get update
271 -!   sudo sh -c 'echo DOCKER_OPTS=\"--bip 172.45.0.1/24\" > /etc/default/docker'
272 -!   sudo apt-get -y -o Dpkg::Options::="--force-confold" install lxc-docker-1.7.1
273 -  fi
274 -  
275 -  # Install software
276 diff --git a/build/isolinux.cfg.patch b/build/isolinux.cfg.patch
277 index ebd991b..7ca7a5c 100644
278 --- a/build/isolinux.cfg.patch
279 +++ b/build/isolinux.cfg.patch
280 @@ -1,24 +1,21 @@
281 -*** isolinux.cfg.orig  Tue May 10 10:13:21 2016
282 ---- isolinux.cfg       Tue May 10 10:15:12 2016
283 -***************
284 -*** 19,27 ****
285 -    menu label ^1. Fuel Install (Static IP)
286 -    menu default
287 -    kernel vmlinuz
288 -!   append initrd=initrd.img net.ifnames=0 biosdevname=0 inst.repo=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ inst.ks=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:eth0:off::: nameserver=10.20.0.1
289 -  
290 -  label nailgunifname
291 -    menu label ^2. Fuel Advanced Install (Static IP)
292 -    kernel vmlinuz
293 -!   append initrd=initrd.img inst.repo=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ inst.ks=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:adminif:off::: nameserver=10.20.0.1 ifname=adminif:XX:XX:XX:XX:XX:XX
294 ---- 19,27 ----
295 -    menu label ^1. Fuel Install (Static IP)
296 -    menu default
297 -    kernel vmlinuz
298 -!   append initrd=initrd.img net.ifnames=0 biosdevname=0 inst.repo=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ inst.ks=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:eth0:off::: nameserver=10.20.0.1 showmenu=yes
299 -  
300 -  label nailgunifname
301 -    menu label ^2. Fuel Advanced Install (Static IP)
302 -    kernel vmlinuz
303 -!   append initrd=initrd.img inst.repo=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ inst.ks=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:adminif:off::: nameserver=10.20.0.1 ifname=adminif:XX:XX:XX:XX:XX:XX showmenu=yes
304 +From: Fuel OPNFV <fuel@opnfv.org>
305 +Date: Mon, 13 Jun 2016 22:23:57 +0200
306 +Subject: OPNFV: showmenu=yes in isolinux.cfg
307  
308 +---
309 +diff --git a/iso/isolinux/isolinux.cfg b/iso/isolinux/isolinux.cfg
310 +index c6b1ed9..77a4b18 100644
311 +--- a/iso/isolinux/isolinux.cfg
312 ++++ b/iso/isolinux/isolinux.cfg
313 +@@ -19,9 +19,9 @@ label nailgun
314 +   menu label ^1. Fuel Install (Static IP)
315 +   menu default
316 +   kernel vmlinuz
317 +-  append initrd=initrd.img net.ifnames=0 biosdevname=0 inst.repo=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ inst.ks=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:eth0:off::: nameserver=10.20.0.1
318 ++  append initrd=initrd.img net.ifnames=0 biosdevname=0 inst.repo=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ inst.ks=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:eth0:off::: nameserver=10.20.0.1 showmenu=yes
319
320 + label nailgunifname
321 +   menu label ^2. Fuel Advanced Install (Static IP)
322 +   kernel vmlinuz
323 +-  append initrd=initrd.img inst.repo=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ inst.ks=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:adminif:off::: nameserver=10.20.0.1 ifname=adminif:XX:XX:XX:XX:XX:XX
324 ++  append initrd=initrd.img inst.repo=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ inst.ks=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:adminif:off::: nameserver=10.20.0.1 ifname=adminif:XX:XX:XX:XX:XX:XX showmenu=yes