Merge lp:~ubuntu-desktop/livecd-rootfs/desktop-next into lp:livecd-rootfs
- desktop-next
- Merge into trunk
Proposed by
Didier Roche-Tolomelli
Status: | Merged |
---|---|
Merged at revision: | 1119 |
Proposed branch: | lp:~ubuntu-desktop/livecd-rootfs/desktop-next |
Merge into: | lp:livecd-rootfs |
Diff against target: |
704 lines (+583/-4) 17 files modified
debian/changelog (+7/-0) live-build/auto/build (+13/-3) live-build/auto/config (+10/-1) live-build/ubuntu-desktop-next/hooks/00-uid-gid-fix.chroot_early (+241/-0) live-build/ubuntu-desktop-next/hooks/01-setup_user.chroot (+37/-0) live-build/ubuntu-desktop-next/hooks/02-add_user_to_groups.chroot (+8/-0) live-build/ubuntu-desktop-next/hooks/03-boot_with_systemd.chroot (+11/-0) live-build/ubuntu-desktop-next/hooks/04-configure_network.chroot (+9/-0) live-build/ubuntu-desktop-next/hooks/05-create_minimal_fstab.chroot (+6/-0) live-build/ubuntu-desktop-next/hooks/07-configure-system-image-client.chroot (+7/-0) live-build/ubuntu-desktop-next/hooks/08-etc-writable.chroot (+15/-0) live-build/ubuntu-desktop-next/hooks/10-remove-documentation.binary (+22/-0) live-build/ubuntu-desktop-next/hooks/14-set-motd.chroot (+14/-0) live-build/ubuntu-desktop-next/hooks/15-remove-grub-common.chroot (+4/-0) live-build/ubuntu-desktop-next/hooks/400-create-apt-get-warning.binary (+19/-0) live-build/ubuntu-desktop-next/hooks/500-move-kernel-to-device-tar.binary (+108/-0) live-build/ubuntu-desktop-next/hooks/99zz-check-uid-gid.chroot (+52/-0) |
To merge this branch: | bzr merge lp:~ubuntu-desktop/livecd-rootfs/desktop-next |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Colin Watson | Approve | ||
Review via email: mp+257056@code.launchpad.net |
Commit message
Description of the change
Experimenting transforming ubuntu-desktop-next to a system-image base
To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) : | # |
review:
Approve
- 1109. By Didier Roche-Tolomelli
-
fix some typo and take colin's feedback into account
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 2015-04-17 19:29:50 +0000 |
3 | +++ debian/changelog 2015-04-22 13:13:47 +0000 |
4 | @@ -1,3 +1,10 @@ |
5 | +livecd-rootfs (2.299+desktopnext3) vivid; urgency=medium |
6 | + |
7 | + * Create hooks and image build config for the ubuntu-desktop-next |
8 | + new based on snappy image. |
9 | + |
10 | + -- Didier Roche <didrocks@ubuntu.com> Wed, 22 Apr 2015 09:32:15 +0100 |
11 | + |
12 | livecd-rootfs (2.299) vivid; urgency=medium |
13 | |
14 | * Fix snappy motd to not reference 'development', which isn't always true. |
15 | |
16 | === modified file 'live-build/auto/build' |
17 | --- live-build/auto/build 2015-04-08 08:34:15 +0000 |
18 | +++ live-build/auto/build 2015-04-22 13:13:47 +0000 |
19 | @@ -329,10 +329,11 @@ |
20 | fi |
21 | fi |
22 | |
23 | -# ubuntu-core splits kernel stuff into a "device" tarball so at this point |
24 | -# we reset it to "none" as all the work to extract it was done already |
25 | +# ubuntu-core and ubuntu-desktop-next splits kernel stuff into a "device" tarball so |
26 | +# at this point we reset it to "none" as all the work to extract it was done already |
27 | # in a binary hook |
28 | -if [ "$PROJECT" = "ubuntu-core" ] && [ "$SUBPROJECT" = "system-image" ]; then |
29 | +case $PROJECT:$SUBPROJECT in |
30 | + ubuntu-core:system-image|ubuntu-desktop-next:system-image) |
31 | LB_LINUX_FLAVOURS=none |
32 | |
33 | # rename to have the right prefix etc |
34 | @@ -342,6 +343,15 @@ |
35 | if [ -e device-azure.tar.gz ]; then |
36 | mv device-azure.tar.gz "$PREFIX.azure.device.tar.gz" |
37 | fi |
38 | + ;; |
39 | +esac |
40 | + |
41 | +if [ "$PROJECT" = "ubuntu-desktop-next" ] && [ "$SUBPROJECT" = "system-image" ]; then |
42 | + LB_LINUX_FLAVOURS=none |
43 | + |
44 | + # rename to have the right prefix etc |
45 | + mv device.tar.gz "$PREFIX.device.tar.gz" |
46 | + |
47 | fi |
48 | |
49 | for FLAVOUR in $LB_LINUX_FLAVOURS; do |
50 | |
51 | === modified file 'live-build/auto/config' |
52 | --- live-build/auto/config 2015-04-15 22:02:57 +0000 |
53 | +++ live-build/auto/config 2015-04-22 13:13:47 +0000 |
54 | @@ -162,7 +162,7 @@ |
55 | ubuntu-server) |
56 | add_package live oem-config-debconf ubiquity-frontend-debconf |
57 | ;; |
58 | - ubuntu-core|base|ubuntu-touch|ubuntu-cpc) |
59 | + ubuntu-core|base|ubuntu-touch|ubuntu-cpc|ubuntu-desktop-next) |
60 | ;; |
61 | *) |
62 | add_package live oem-config-gtk ubiquity-frontend-gtk |
63 | @@ -210,6 +210,15 @@ |
64 | case $ARCH in |
65 | amd64) add_package live linux-signed-generic ;; |
66 | esac |
67 | + |
68 | + # system image snappy desktop next image |
69 | + # mvo: This is for cron.daily-preinstalled |
70 | + # CDIMAGE_PREINSTALLED is not passed from build.py |
71 | + # and PREINSTALLED means something different. So |
72 | + # we use SUBPROJECT to pass on the information |
73 | + if [ "$SUBPROJECT" = "system-image" ]; then |
74 | + OPTS="${OPTS:+$OPTS }--linux-packages=linux-image" |
75 | + fi |
76 | ;; |
77 | |
78 | kubuntu|kubuntu-dvd) |
79 | |
80 | === added directory 'live-build/ubuntu-desktop-next' |
81 | === added directory 'live-build/ubuntu-desktop-next/hooks' |
82 | === added file 'live-build/ubuntu-desktop-next/hooks/00-uid-gid-fix.chroot_early' |
83 | --- live-build/ubuntu-desktop-next/hooks/00-uid-gid-fix.chroot_early 1970-01-01 00:00:00 +0000 |
84 | +++ live-build/ubuntu-desktop-next/hooks/00-uid-gid-fix.chroot_early 2015-04-22 13:13:47 +0000 |
85 | @@ -0,0 +1,241 @@ |
86 | +#!/bin/sh -eu |
87 | + |
88 | +ERRCNT="" |
89 | + |
90 | +# Known good post-debootstrap values |
91 | +passwd_bootstrap="af34a24499223f08ab713138bec7ff54" |
92 | +shadow_bootstrap="1fd73103260cbe5a13a4a38320de4129" |
93 | +group_bootstrap="9edf30f181a6fd1d860cc7f4a71aa640" |
94 | +gshadow_bootstrap="b9db51ef767ab98db963db69844635dd" |
95 | + |
96 | +# Current post-debootstrap values |
97 | +passwd_hash=$(set -- $(md5sum /etc/passwd) && echo $1) |
98 | +shadow_hash=$(set -- $(cat /etc/shadow | sed "s/:.*:0:99999:/:0:99999:/g" | md5sum) && echo $1) |
99 | +group_hash=$(set -- $(md5sum /etc/group) && echo $1) |
100 | +gshadow_hash=$(set -- $(md5sum /etc/gshadow) && echo $1) |
101 | + |
102 | +# /etc/passwd |
103 | +if [ "$passwd_bootstrap" = "$passwd_hash" ]; then |
104 | + cat > /etc/passwd <<EOF |
105 | +root:x:0:0:root:/root:/bin/bash |
106 | +daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin |
107 | +bin:x:2:2:bin:/bin:/usr/sbin/nologin |
108 | +sys:x:3:3:sys:/dev:/usr/sbin/nologin |
109 | +sync:x:4:65534:sync:/bin:/bin/sync |
110 | +games:x:5:60:games:/usr/games:/usr/sbin/nologin |
111 | +man:x:6:12:man:/var/cache/man:/usr/sbin/nologin |
112 | +lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin |
113 | +mail:x:8:8:mail:/var/mail:/usr/sbin/nologin |
114 | +news:x:9:9:news:/var/spool/news:/usr/sbin/nologin |
115 | +uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin |
116 | +proxy:x:13:13:proxy:/bin:/usr/sbin/nologin |
117 | +www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin |
118 | +backup:x:34:34:backup:/var/backups:/usr/sbin/nologin |
119 | +list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin |
120 | +irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin |
121 | +gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin |
122 | +nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin |
123 | +messagebus:x:100:103::/var/run/dbus:/bin/false |
124 | +clickpkg:x:101:104::/nonexistent:/bin/false |
125 | +sshd:x:102:65534::/var/run/sshd:/usr/sbin/nologin |
126 | +systemd-timesync:x:103:108:systemd Time Synchronization,,,:/run/systemd:/bin/false |
127 | +systemd-network:x:104:109:systemd Network Management,,,:/run/systemd/netif:/bin/false |
128 | +systemd-resolve:x:105:110:systemd Resolver,,,:/run/systemd/resolve:/bin/false |
129 | +systemd-bus-proxy:x:106:111:systemd Bus Proxy,,,:/run/systemd:/bin/false |
130 | +docker:x:107:113::/nonexistent:/bin/false |
131 | +syslog:x:108:114::/home/syslog:/bin/false |
132 | +EOF |
133 | +else |
134 | + echo "/etc/passwd post-debootstrap hash doesn't match record" >&2 |
135 | + echo "The output below might help to resolve the issue" >&2 |
136 | + cat /etc/passwd |
137 | + echo "passwd md5sum: $passwd_hash" >&2 |
138 | + ERRCNT=1 |
139 | +fi |
140 | + |
141 | +# /etc/shadow |
142 | +if [ "$shadow_bootstrap" = "$shadow_hash" ]; then |
143 | + cat > /etc/shadow <<EOF |
144 | +root:*:16329:0:99999:7::: |
145 | +daemon:*:16329:0:99999:7::: |
146 | +bin:*:16329:0:99999:7::: |
147 | +sys:*:16329:0:99999:7::: |
148 | +sync:*:16329:0:99999:7::: |
149 | +games:*:16329:0:99999:7::: |
150 | +man:*:16329:0:99999:7::: |
151 | +lp:*:16329:0:99999:7::: |
152 | +mail:*:16329:0:99999:7::: |
153 | +news:*:16329:0:99999:7::: |
154 | +uucp:*:16329:0:99999:7::: |
155 | +proxy:*:16329:0:99999:7::: |
156 | +www-data:*:16329:0:99999:7::: |
157 | +backup:*:16329:0:99999:7::: |
158 | +list:*:16329:0:99999:7::: |
159 | +irc:*:16329:0:99999:7::: |
160 | +gnats:*:16329:0:99999:7::: |
161 | +nobody:*:16329:0:99999:7::: |
162 | +messagebus:*:16413:0:99999:7::: |
163 | +clickpkg:*:16413:0:99999:7::: |
164 | +sshd:*:16413:0:99999:7::: |
165 | +systemd-timesync:*:16413:0:99999:7::: |
166 | +systemd-network:*:16413:0:99999:7::: |
167 | +systemd-resolve:*:16413:0:99999:7::: |
168 | +systemd-bus-proxy:*:16413:0:99999:7::: |
169 | +docker:*:16413:0:99999:7::: |
170 | +syslog:*:16521:0:99999:7::: |
171 | +EOF |
172 | +else |
173 | + echo "/etc/shadow post-debootstrap hash doesn't match record" >&2 |
174 | + echo "The output below might help to resolve the issue" >&2 |
175 | + cat /etc/shadow |
176 | + echo "shadow md5sum: $shadow_hash" >&2 |
177 | + ERRCNT=1 |
178 | +fi |
179 | + |
180 | +# /etc/group |
181 | +if [ "$group_bootstrap" = "$group_hash" ]; then |
182 | + cat > /etc/group <<EOF |
183 | +root:x:0: |
184 | +daemon:x:1: |
185 | +bin:x:2: |
186 | +sys:x:3: |
187 | +adm:x:4:syslog |
188 | +tty:x:5: |
189 | +disk:x:6: |
190 | +lp:x:7: |
191 | +mail:x:8: |
192 | +news:x:9: |
193 | +uucp:x:10: |
194 | +man:x:12: |
195 | +proxy:x:13: |
196 | +kmem:x:15: |
197 | +dialout:x:20: |
198 | +fax:x:21: |
199 | +voice:x:22: |
200 | +cdrom:x:24: |
201 | +floppy:x:25: |
202 | +tape:x:26: |
203 | +sudo:x:27:ubuntu |
204 | +audio:x:1005: |
205 | +dip:x:30: |
206 | +www-data:x:33: |
207 | +backup:x:34: |
208 | +operator:x:37: |
209 | +list:x:38: |
210 | +irc:x:39: |
211 | +src:x:40: |
212 | +gnats:x:41: |
213 | +shadow:x:42: |
214 | +utmp:x:43: |
215 | +video:x:44: |
216 | +sasl:x:45: |
217 | +plugdev:x:46: |
218 | +staff:x:50: |
219 | +games:x:60: |
220 | +users:x:100: |
221 | +nogroup:x:65534: |
222 | +netdev:x:101: |
223 | +crontab:x:102: |
224 | +messagebus:x:103: |
225 | +clickpkg:x:104: |
226 | +ssh:x:105: |
227 | +systemd-journal:x:106: |
228 | +systemd-journal-remote:x:107: |
229 | +systemd-timesync:x:108: |
230 | +systemd-network:x:109: |
231 | +systemd-resolve:x:110: |
232 | +systemd-bus-proxy:x:111: |
233 | +input:x:112: |
234 | +docker:x:113:ubuntu |
235 | +syslog:x:114: |
236 | +EOF |
237 | +else |
238 | + echo "/etc/group post-debootstrap hash doesn't match record" >&2 |
239 | + echo "The output below might help to resolve the issue" >&2 |
240 | + cat /etc/group |
241 | + echo "group md5sum: $group_hash" >&2 |
242 | + ERRCNT=1 |
243 | +fi |
244 | + |
245 | +# /etc/gshadow |
246 | +if [ "$gshadow_bootstrap" = "$gshadow_hash" ]; then |
247 | + cat > /etc/gshadow <<EOF |
248 | +root:*:: |
249 | +daemon:*:: |
250 | +bin:*:: |
251 | +sys:*:: |
252 | +adm:*::syslog |
253 | +tty:*:: |
254 | +disk:*:: |
255 | +lp:*:: |
256 | +mail:*:: |
257 | +news:*:: |
258 | +uucp:*:: |
259 | +man:*:: |
260 | +proxy:*:: |
261 | +kmem:*:: |
262 | +dialout:*:: |
263 | +fax:*:: |
264 | +voice:*:: |
265 | +cdrom:*:: |
266 | +floppy:*:: |
267 | +tape:*:: |
268 | +sudo:*::ubuntu |
269 | +audio:*::pulse |
270 | +dip:*:: |
271 | +www-data:*:: |
272 | +backup:*:: |
273 | +operator:*:: |
274 | +list:*:: |
275 | +irc:*:: |
276 | +src:*:: |
277 | +gnats:*:: |
278 | +shadow:*:: |
279 | +utmp:*:: |
280 | +video:*:: |
281 | +sasl:*:: |
282 | +plugdev:*:: |
283 | +staff:*:: |
284 | +games:*:: |
285 | +users:*:: |
286 | +nogroup:*:: |
287 | +netdev:!:: |
288 | +crontab:!:: |
289 | +messagebus:!:: |
290 | +clickpkg:!:: |
291 | +ssh:!:: |
292 | +systemd-journal:!:: |
293 | +systemd-journal-remote:!:: |
294 | +systemd-timesync:!:: |
295 | +systemd-network:!:: |
296 | +systemd-resolve:!:: |
297 | +systemd-bus-proxy:!:: |
298 | +input:!:: |
299 | +docker:!::ubuntu |
300 | +syslog:!:: |
301 | +EOF |
302 | +else |
303 | + echo "/etc/gshadow post-debootstrap hash doesn't match record" >&2 |
304 | + echo "The output below might help to resolve the issue" >&2 |
305 | + cat /etc/gshadow |
306 | + echo "gshadow md5sum: $gshadow_hash" >&2 |
307 | + ERRCNT=1 |
308 | +fi |
309 | + |
310 | +if [ -n "$ERRCNT" ]; then |
311 | + echo "There were changes to the password database," >&2 |
312 | + echo "please adjust the values in the livecd-rootfs source in the file:" >&2 |
313 | + echo "live-build/ubuntu-core/hooks/00-uid-gid-fix.chroot_early" >&2 |
314 | + echo >&2 |
315 | + echo "Please check also if a maintainer script of the package" >&2 |
316 | + echo "that added these entries perhaps created a home directory and," >&2 |
317 | + echo "if needed, add code for creation of it to the above hook" >&2 |
318 | + exit 1 |
319 | +fi |
320 | + |
321 | + |
322 | +# Record the current state for later comparison |
323 | +for file in /etc/passwd /etc/shadow /etc/group /etc/gshadow; do |
324 | + rm -f ${file}- |
325 | + cp ${file} ${file}.orig |
326 | +done |
327 | |
328 | === added file 'live-build/ubuntu-desktop-next/hooks/01-setup_user.chroot' |
329 | --- live-build/ubuntu-desktop-next/hooks/01-setup_user.chroot 1970-01-01 00:00:00 +0000 |
330 | +++ live-build/ubuntu-desktop-next/hooks/01-setup_user.chroot 2015-04-22 13:13:47 +0000 |
331 | @@ -0,0 +1,37 @@ |
332 | +#!/bin/sh -x |
333 | + |
334 | +set -e |
335 | + |
336 | +USER=ubuntu |
337 | +UGID=1000 |
338 | + |
339 | +echo "I: creating default user $USER" |
340 | +adduser --gecos $USER --disabled-login $USER --uid $UGID |
341 | + |
342 | +chown -R $UGID:$UGID /home/$USER |
343 | + |
344 | +# Enable libnss-extrusers |
345 | +sed -i 's/^group:.*compat/\0 extrausers/' /etc/nsswitch.conf |
346 | +sed -i 's/^passwd:.*compat/\0 extrausers/' /etc/nsswitch.conf |
347 | +sed -i 's/^shadow:.*compat/\0 extrausers/' /etc/nsswitch.conf |
348 | + |
349 | +# Move user from /etc to extrausers location |
350 | +grep "^$USER" /etc/group >> /var/lib/extrausers/group |
351 | +grep "^$USER" /etc/passwd >> /var/lib/extrausers/passwd |
352 | +grep "^$USER" /etc/shadow >> /var/lib/extrausers/shadow |
353 | +grep "^$USER" /etc/gshadow >> /var/lib/extrausers/gshadow |
354 | +chmod 0644 /var/lib/extrausers/group |
355 | +chmod 0644 /var/lib/extrausers/passwd |
356 | +chmod 0640 /var/lib/extrausers/shadow |
357 | +chmod 0640 /var/lib/extrausers/gshadow |
358 | +chown root:shadow /var/lib/extrausers/shadow |
359 | +chown root:shadow /var/lib/extrausers/gshadow |
360 | +sed -i "/^$USER/d" /etc/group |
361 | +sed -i "/^$USER/d" /etc/passwd |
362 | +sed -i "/^$USER/d" /etc/shadow |
363 | +sed -i "/^$USER/d" /etc/gshadow |
364 | + |
365 | +# needs to run *after* the user was moved out to /var/lib/extrausers |
366 | +echo "I: set user $USER password to $USER" |
367 | +echo "$USER:$USER" | chpasswd |
368 | + |
369 | |
370 | === added file 'live-build/ubuntu-desktop-next/hooks/02-add_user_to_groups.chroot' |
371 | --- live-build/ubuntu-desktop-next/hooks/02-add_user_to_groups.chroot 1970-01-01 00:00:00 +0000 |
372 | +++ live-build/ubuntu-desktop-next/hooks/02-add_user_to_groups.chroot 2015-04-22 13:13:47 +0000 |
373 | @@ -0,0 +1,8 @@ |
374 | +#!/bin/sh -x |
375 | + |
376 | +USER=ubuntu |
377 | + |
378 | +DEFGROUPS="docker,sudo" |
379 | + |
380 | +echo "I: add $USER to ($DEFGROUPS) group(s)" |
381 | +usermod -a -G ${DEFGROUPS} ${USER} |
382 | |
383 | === added file 'live-build/ubuntu-desktop-next/hooks/03-boot_with_systemd.chroot' |
384 | --- live-build/ubuntu-desktop-next/hooks/03-boot_with_systemd.chroot 1970-01-01 00:00:00 +0000 |
385 | +++ live-build/ubuntu-desktop-next/hooks/03-boot_with_systemd.chroot 2015-04-22 13:13:47 +0000 |
386 | @@ -0,0 +1,11 @@ |
387 | +#!/bin/sh -x |
388 | + |
389 | +# Boot using systemd and disable quiet boot |
390 | +# to see what is happening. |
391 | +systemd=/lib/systemd/systemd |
392 | +if [ -f /etc/default/grub ]; then |
393 | + sed -i \ |
394 | + -e "s,^\\([ ]*GRUB_CMDLINE_LINUX\\)=\"\"$,\\1=\"init=$systemd\",g" \ |
395 | + -e 's,^\([ ]*GRUB_CMDLINE_LINUX_DEFAULT\)="quiet splash",\1="",g' \ |
396 | + /etc/default/grub |
397 | +fi |
398 | |
399 | === added file 'live-build/ubuntu-desktop-next/hooks/04-configure_network.chroot' |
400 | --- live-build/ubuntu-desktop-next/hooks/04-configure_network.chroot 1970-01-01 00:00:00 +0000 |
401 | +++ live-build/ubuntu-desktop-next/hooks/04-configure_network.chroot 2015-04-22 13:13:47 +0000 |
402 | @@ -0,0 +1,9 @@ |
403 | +#!/bin/sh -x |
404 | + |
405 | +if=eth0 |
406 | + |
407 | +# Manually configure the first ethernet device |
408 | +cat >/etc/network/interfaces.d/"$if"<<EOT |
409 | +allow-hotplug $if |
410 | +iface $if inet dhcp |
411 | +EOT |
412 | |
413 | === added file 'live-build/ubuntu-desktop-next/hooks/05-create_minimal_fstab.chroot' |
414 | --- live-build/ubuntu-desktop-next/hooks/05-create_minimal_fstab.chroot 1970-01-01 00:00:00 +0000 |
415 | +++ live-build/ubuntu-desktop-next/hooks/05-create_minimal_fstab.chroot 2015-04-22 13:13:47 +0000 |
416 | @@ -0,0 +1,6 @@ |
417 | +#!/bin/sh -x |
418 | + |
419 | +cat >>/etc/fstab<<EOT |
420 | +# Minimal setup required for systemd to provide a r/w FS |
421 | +/dev/root / rootfs defaults 0 0 |
422 | +EOT |
423 | |
424 | === added file 'live-build/ubuntu-desktop-next/hooks/07-configure-system-image-client.chroot' |
425 | --- live-build/ubuntu-desktop-next/hooks/07-configure-system-image-client.chroot 1970-01-01 00:00:00 +0000 |
426 | +++ live-build/ubuntu-desktop-next/hooks/07-configure-system-image-client.chroot 2015-04-22 13:13:47 +0000 |
427 | @@ -0,0 +1,7 @@ |
428 | +#!/bin/sh -x |
429 | + |
430 | +# Change default cache partition (until LP: #1373467 is fixed). |
431 | +if [ -f /etc/system-image/client.ini ]; then |
432 | + sed -ie 's!cache_partition: /android/cache/recovery!cache_partition: /userdata/cache!g' \ |
433 | + /etc/system-image/client.ini |
434 | +fi |
435 | |
436 | === added file 'live-build/ubuntu-desktop-next/hooks/08-etc-writable.chroot' |
437 | --- live-build/ubuntu-desktop-next/hooks/08-etc-writable.chroot 1970-01-01 00:00:00 +0000 |
438 | +++ live-build/ubuntu-desktop-next/hooks/08-etc-writable.chroot 2015-04-22 13:13:47 +0000 |
439 | @@ -0,0 +1,15 @@ |
440 | +#!/bin/sh |
441 | +set -e |
442 | + |
443 | +mkdir -p /etc/writable |
444 | + |
445 | +# cloud-init needs to be able to modify hostname and has the ability to |
446 | +# set the other two. |
447 | +for f in timezone localtime hostname; do |
448 | + if [ -e /etc/$f ]; then |
449 | + echo "I: Moving /etc/$f to /etc/writable/" |
450 | + mv /etc/$f /etc/writable/$f |
451 | + fi |
452 | + echo "I: Linking /etc/$f to /etc/writable/" |
453 | + ln -s writable/$f /etc/$f |
454 | +done |
455 | |
456 | === added file 'live-build/ubuntu-desktop-next/hooks/10-remove-documentation.binary' |
457 | --- live-build/ubuntu-desktop-next/hooks/10-remove-documentation.binary 1970-01-01 00:00:00 +0000 |
458 | +++ live-build/ubuntu-desktop-next/hooks/10-remove-documentation.binary 2015-04-22 13:13:47 +0000 |
459 | @@ -0,0 +1,22 @@ |
460 | +#!/bin/sh -x |
461 | + |
462 | +echo "I: Remove unneeded files from /usr/share/doc " |
463 | +find binary/boot/filesystem.dir/usr/share/doc -depth -type f ! -name copyright|xargs rm -f || true |
464 | +find binary/boot/filesystem.dir/usr/share/doc -empty|xargs rmdir || true |
465 | +find binary/boot/filesystem.dir/usr/share/doc -type f -exec gzip -9 {} \; |
466 | + |
467 | +echo "I: Remove man/info pages" |
468 | +rm -rf binary/boot/filesystem.dir/usr/share/man \ |
469 | + binary/boot/filesystem.dir/usr/share/groff \ |
470 | + binary/boot/filesystem.dir/usr/share/info \ |
471 | + binary/boot/filesystem.dir/usr/share/lintian \ |
472 | + binary/boot/filesystem.dir/usr/share/linda \ |
473 | + binary/boot/filesystem.dir/var/cache/man |
474 | + |
475 | + |
476 | +echo "I: Removing /var/lib/apt/lists/*" |
477 | +find binary/boot/filesystem.dir/var/lib/apt/lists/ -type f | xargs rm -f |
478 | + |
479 | +echo "I: Removing /var/cache/apt/*.bin" |
480 | +rm -f binary/boot/filesystem.dir/var/cache/apt/*.bin |
481 | + |
482 | |
483 | === added file 'live-build/ubuntu-desktop-next/hooks/14-set-motd.chroot' |
484 | --- live-build/ubuntu-desktop-next/hooks/14-set-motd.chroot 1970-01-01 00:00:00 +0000 |
485 | +++ live-build/ubuntu-desktop-next/hooks/14-set-motd.chroot 2015-04-22 13:13:47 +0000 |
486 | @@ -0,0 +1,14 @@ |
487 | +#!/bin/sh |
488 | + |
489 | +cat >/etc/motd<<EOF |
490 | +Welcome to snappy Ubuntu Desktop Next, a transactionally updated Ubuntu. |
491 | + |
492 | + * See https://ubuntu.com/snappy |
493 | + |
494 | +It's a brave new world here in snappy Ubuntu Desktop Next! This machine |
495 | +does not use apt-get or deb packages. Please see 'snappy --help' |
496 | +for app installation and transactional updates. |
497 | + |
498 | +This is a *highly* experimental image. |
499 | + |
500 | +EOF |
501 | |
502 | === added file 'live-build/ubuntu-desktop-next/hooks/15-remove-grub-common.chroot' |
503 | --- live-build/ubuntu-desktop-next/hooks/15-remove-grub-common.chroot 1970-01-01 00:00:00 +0000 |
504 | +++ live-build/ubuntu-desktop-next/hooks/15-remove-grub-common.chroot 2015-04-22 13:13:47 +0000 |
505 | @@ -0,0 +1,4 @@ |
506 | +#!/bin/sh |
507 | + |
508 | +# see bug https://bugs.launchpad.net/snappy-ubuntu/+bug/1442231 |
509 | +rm -f /etc/init.d/grub-common |
510 | \ No newline at end of file |
511 | |
512 | === added file 'live-build/ubuntu-desktop-next/hooks/400-create-apt-get-warning.binary' |
513 | --- live-build/ubuntu-desktop-next/hooks/400-create-apt-get-warning.binary 1970-01-01 00:00:00 +0000 |
514 | +++ live-build/ubuntu-desktop-next/hooks/400-create-apt-get-warning.binary 2015-04-22 13:13:47 +0000 |
515 | @@ -0,0 +1,19 @@ |
516 | +#!/bin/sh |
517 | + |
518 | +set -ex |
519 | + |
520 | +echo "I: Creating warning to use snappy when apt-get is used" |
521 | + |
522 | +PREFIX=binary/boot/filesystem.dir |
523 | + |
524 | +mkdir -p $PREFIX/usr/local/bin |
525 | +cat >$PREFIX/usr/local/bin/no-apt <<EOF |
526 | +#!/bin/sh |
527 | +cat <<EOF |
528 | +Ubuntu Core does not use apt-get, see 'snappy --help'! |
529 | +EOF |
530 | +chmod 755 $PREFIX/usr/local/bin/no-apt |
531 | + |
532 | +for cmd in apt apt-cache apt-get; do |
533 | + ln -s no-apt $PREFIX/usr/local/bin/$cmd |
534 | +done |
535 | |
536 | === added file 'live-build/ubuntu-desktop-next/hooks/500-move-kernel-to-device-tar.binary' |
537 | --- live-build/ubuntu-desktop-next/hooks/500-move-kernel-to-device-tar.binary 1970-01-01 00:00:00 +0000 |
538 | +++ live-build/ubuntu-desktop-next/hooks/500-move-kernel-to-device-tar.binary 2015-04-22 13:13:47 +0000 |
539 | @@ -0,0 +1,108 @@ |
540 | +#!/bin/sh |
541 | +# |
542 | +# move the kernel out into a new device tarfile with system/boot |
543 | + |
544 | +set -ex |
545 | + |
546 | +echo "I: Moving kernel into device tarball" |
547 | + |
548 | +HERE="$(pwd)" |
549 | +TMPDIR="$(mktemp -d)" |
550 | +ARCH=$(dpkg --print-architecture) |
551 | +mkdir -p $TMPDIR/system/ |
552 | +mkdir -p $TMPDIR/assets/ |
553 | + |
554 | +# cp files, we can't simply use tar --transform as it changes the symlink target |
555 | +( |
556 | + cd binary/boot/filesystem.dir |
557 | + |
558 | + # for compatibility with current grub/u-d-f |
559 | + cp -ar --parent boot/vmlinu?-* boot/initrd.img-* boot/abi-* boot/System.map-* $TMPDIR/system/ |
560 | + if [ -e vmlinu? ] && [ -e initrd.img ]; then |
561 | + cp -ar --parent vmlinu? initrd.img $TMPDIR/system |
562 | + fi |
563 | + cp -ar --parent lib/modules/ $TMPDIR/system/ |
564 | + cp -ar --parent lib/firmware/ $TMPDIR/system/ |
565 | + |
566 | + # new assets handling |
567 | + cp -ar boot/vmlinu?-* $TMPDIR/assets/vmlinuz |
568 | + cp -ar boot/initrd.img-* $TMPDIR/assets/initrd.img |
569 | + cp -ar boot/vmlinu?-* boot/initrd.img-* boot/abi-* boot/System.map-* $TMPDIR/assets/ |
570 | + |
571 | + dtbs=$(find lib/firmware -type d -name 'device-tree' -print0) |
572 | + [ -n "$dtbs" ] && mv "$dtbs" $TMPDIR/assets/dtbs |
573 | + |
574 | + if [ -e vmlinu? ] && [ -e initrd.img ]; then |
575 | + cp -ar --parent vmlinu? initrd.img $TMPDIR/assets |
576 | + cp -ar --parent vmlinu? initrd.img $TMPDIR/assets |
577 | + fi |
578 | +) |
579 | +# create hardware.yaml for u-boot |
580 | +# this assumes armh == u-boot |
581 | +# and all others grub |
582 | +( |
583 | +# common bits |
584 | + cat > $TMPDIR/hardware.yaml << EOF |
585 | +kernel: assets/vmlinuz |
586 | +initrd: assets/initrd.img |
587 | +partiton-layout: system-AB |
588 | +EOF |
589 | + |
590 | +# arch specific ones |
591 | +if [ "$ARCH" = "armhf" ]; then |
592 | + cat >> $TMPDIR/hardware.yaml << EOF |
593 | +dtbs: assets/dtbs |
594 | +bootloader: u-boot |
595 | +EOF |
596 | +else |
597 | + cat >> $TMPDIR/hardware.yaml << EOF |
598 | +bootloader: grub |
599 | +EOF |
600 | +fi |
601 | +) |
602 | + |
603 | +# and tar it up |
604 | +( |
605 | + cd $TMPDIR |
606 | + tar -c -z -f $HERE/device.tar.gz system assets hardware.yaml |
607 | +) |
608 | + |
609 | +# now build the azure device tarball by adding walinuxagent |
610 | +if [ -e binary/boot/filesystem.dir/var/lib/dpkg/info/walinuxagent.list ]; |
611 | +then |
612 | +( |
613 | + cd binary/boot/filesystem.dir |
614 | + while read line; do |
615 | + line=$(echo $line |cut -d/ -f2-) |
616 | + if [ -e "$line" ] && [ ! -d "$line" ]; then |
617 | + cp -ar --parent $line $TMPDIR/system |
618 | + fi |
619 | + done < var/lib/dpkg/info/walinuxagent.list |
620 | + # created by walinuxagent postinst/dh-systemd |
621 | + cp -ar --parent var/lib/systemd/deb-systemd-helper-enabled/walinuxagent* $TMPDIR/system |
622 | + cp -ar --parent etc/systemd/system/multi-user.target.wants/walinuxagent* $TMPDIR/system |
623 | + mkdir -p $TMPDIR/system/var/lib/waagent |
624 | +) |
625 | +# and tar it up |
626 | +( |
627 | + cd $TMPDIR |
628 | + tar -c -z -f $HERE/device-azure.tar.gz system assets hardware.yaml |
629 | +) |
630 | +fi |
631 | +rm -rf $TMPDIR |
632 | + |
633 | +# remove files from the root filesystem |
634 | +(cd binary/boot/filesystem.dir |
635 | + rm -f boot/vmlinu?-* |
636 | + rm -f boot/initrd.img-* |
637 | + rm -f boot/abi-* |
638 | + rm -f boot/System.map-* |
639 | + rm -f initrd.img |
640 | + rm -f vmlinu? |
641 | + rm -rf lib/modules |
642 | + rm -rf lib/firmware |
643 | + # remove walinuxagent |
644 | + if [ -e var/lib/dpkg/info/walinuxagent.list ]; then |
645 | + chroot . dpkg --purge walinuxagent || true |
646 | + fi |
647 | +) |
648 | |
649 | === added file 'live-build/ubuntu-desktop-next/hooks/99zz-check-uid-gid.chroot' |
650 | --- live-build/ubuntu-desktop-next/hooks/99zz-check-uid-gid.chroot 1970-01-01 00:00:00 +0000 |
651 | +++ live-build/ubuntu-desktop-next/hooks/99zz-check-uid-gid.chroot 2015-04-22 13:13:47 +0000 |
652 | @@ -0,0 +1,52 @@ |
653 | +#!/bin/sh -eu |
654 | + |
655 | +ERRCNT="" |
656 | + |
657 | +passwd_hash=$(set -- $(md5sum /etc/passwd) && echo $1) |
658 | +shadow_hash=$(set -- $(cat /etc/shadow | sed "s/:.*:0:99999:/:0:99999:/g" | md5sum) && echo $1) |
659 | +group_length=$(cat /etc/group | wc -l) |
660 | +gshadow_length=$(cat /etc/gshadow | wc -l) |
661 | + |
662 | +passwd_orig_hash=$(set -- $(md5sum /etc/passwd.orig) && echo $1) |
663 | +shadow_orig_hash=$(set -- $(cat /etc/shadow.orig | sed "s/:.*:0:99999:/:0:99999:/g" | md5sum) && echo $1) |
664 | +group_orig_length=$(cat /etc/group.orig | wc -l) |
665 | +gshadow_orig_length=$(cat /etc/gshadow.orig | wc -l) |
666 | + |
667 | +if [ "$passwd_hash" != "$passwd_orig_hash" ]; then |
668 | + echo "/etc/passwd has changed during setup." >&2 |
669 | + echo "The new /etc/passwd md5sum is: $passwd_hash" >&2 |
670 | + diff -Nrup /etc/passwd.orig /etc/passwd >&2 || true |
671 | + ERRCNT=1 |
672 | +fi |
673 | + |
674 | +if [ "$shadow_hash" != "$shadow_orig_hash" ]; then |
675 | + echo "/etc/shadow has changed during setup." >&2 |
676 | + echo "The new /etc/shadow md5sum is: $shadow_hash" >&2 |
677 | + diff -Nrup /etc/shadow.orig /etc/shadow >&2 || true |
678 | + ERRCNT=1 |
679 | +fi |
680 | + |
681 | +if [ "$group_length" != "$group_orig_length" ]; then |
682 | + echo "/etc/group has changed during setup." >&2 |
683 | + diff -Nrup /etc/group.orig /etc/group >&2 || true |
684 | + ERRCNT=1 |
685 | +fi |
686 | + |
687 | +if [ "$gshadow_length" != "$gshadow_orig_length" ]; then |
688 | + echo "/etc/gshadow has changed during setup." >&2 |
689 | + diff -Nrup /etc/gshadow.orig /etc/gshadow >&2 || true |
690 | + ERRCNT=1 |
691 | +fi |
692 | + |
693 | +if [ -n "$ERRCNT" ]; then |
694 | + echo "There were changes to the password database," >&2 |
695 | + echo "please adjust the values in the livecd-rootfs source in the file:" >&2 |
696 | + echo "live-build/ubuntu-core/hooks/00-uid-gid-fix.chroot_early" >&2 |
697 | + echo >&2 |
698 | + echo "Please check also if a maintainer script of the package" >&2 |
699 | + echo "that added these entries perhaps created a home directory and," >&2 |
700 | + echo "if needed, add code for creation of it to the above hook" >&2 |
701 | + exit 1 |
702 | +fi |
703 | + |
704 | +rm /etc/passwd.orig /etc/shadow.orig /etc/group.orig /etc/gshadow.orig |