Merge ~lihow731/ubuntu/+source/live-build:focal-devel into ubuntu/+source/live-build:ubuntu/focal-devel

Proposed by Leon Liao
Status: Superseded
Proposed branch: ~lihow731/ubuntu/+source/live-build:focal-devel
Merge into: ubuntu/+source/live-build:ubuntu/focal-devel
Diff against target: 1270 lines (+462/-182)
35 files modified
debian/changelog (+7/-0)
debian/patches/series (+1/-0)
debian/patches/ubuntu-make-genisoimage-more-flexible.patch (+31/-0)
functions/defaults.sh (+23/-14)
functions/losetup.sh (+1/-1)
functions/packagelists.sh (+9/-1)
functions/releases.sh (+3/-0)
scripts/build/lb_binary_debian-installer (+9/-2)
scripts/build/lb_binary_disk (+5/-15)
scripts/build/lb_binary_hooks (+6/-5)
scripts/build/lb_binary_includes (+5/-1)
scripts/build/lb_binary_linux-image (+2/-2)
scripts/build/lb_binary_package-lists (+35/-13)
scripts/build/lb_binary_rootfs (+12/-5)
scripts/build/lb_binary_syslinux (+23/-0)
scripts/build/lb_bootstrap_debootstrap (+12/-1)
scripts/build/lb_chroot (+7/-0)
scripts/build/lb_chroot_archives (+9/-11)
scripts/build/lb_chroot_devpts (+1/-1)
scripts/build/lb_chroot_dpkg (+5/-9)
scripts/build/lb_chroot_early_hooks (+70/-0)
scripts/build/lb_chroot_hacks (+13/-29)
scripts/build/lb_chroot_hooks (+8/-6)
scripts/build/lb_chroot_hostname (+7/-11)
scripts/build/lb_chroot_includes (+5/-1)
scripts/build/lb_chroot_linux-image (+18/-0)
scripts/build/lb_chroot_live-packages (+0/-14)
scripts/build/lb_chroot_package-lists (+33/-17)
scripts/build/lb_chroot_resolv (+16/-1)
scripts/build/lb_chroot_sysv-rc (+7/-7)
scripts/build/lb_chroot_upstart (+8/-14)
scripts/build/lb_clean (+1/-0)
scripts/build/lb_config (+31/-1)
share/hooks/004-remove-dbus-machine-id.chroot (+3/-0)
share/hooks/100-build-wubildr.binary (+36/-0)
Reviewer Review Type Date Requested Status
Canonical Mainstream Pending
Dimitri John Ledkov Pending
Review via email: mp+379717@code.launchpad.net

This proposal has been superseded by a proposal from 2020-02-24.

Commit message

Add GENISOIMAGE_OPTIONS_EXTRA

Make the genisoimage option more flexible.

LP: 1864426

Description of the change

When we want to build a uefi bootable image, the mkisoimage needs extra options.
But, in live-build 3, the option of mkisoimage is fixed and can not be customized.

To post a comment you must log in.

Unmerged commits

c050806... by Leon Liao

Add GENISOIMAGE_OPTIONS_EXTRA

Make the genisoimage option more flexible.

9d36b57... by Dimitri John Ledkov

Import patches-applied version 3.0~a57-1ubuntu38 to applied/ubuntu/eoan-proposed

Imported using git-ubuntu import.

Changelog parent: 45e2efdbc1d947019bcfcebab81b550f7a705c96
Unapplied parent: 27926ed23f5fcafd24bf6989b1d32c7691873417

New changelog entries:
  * Stop setting LB_INITRAMFS_COMPRESSION default, and instead fallback to
    using initramfs-tools default. LB_INITRAMFS_COMPRESSION is now only to
    override whatever initramfs-tools' default compression is. This thus
    makes live-build default to lz4. LP: #1831736

27926ed... by Dimitri John Ledkov

* Stop setting LB_INITRAMFS_COMPRESSION default, and instead fallback to

Gbp-Pq: drop-default-initramfs-compression-override.patch.

b72521c... by Dimitri John Ledkov

[PATCH] Handle includes.chroot files installed over symlinked

Gbp-Pq: 0001-Handle-includes.chroot-files-installed-over-symlinke.patch.

9d12091... by Dimitri John Ledkov

Use initramfs-tools to work with initrds instead of being silly.

Gbp-Pq: ubuntu-initramfs-handling.patch.

d969ea5... by Dimitri John Ledkov

Handle late installation of systemd/resolvconf gracefully, by not

Gbp-Pq: late-resolv.conf-symlink.patch.

e61dc04... by Dimitri John Ledkov

Stop using apt-key to setup secure apt, and instead copy the gpg key snippet.

Gbp-Pq: no-apt-key.patch.

96fbf54... by Dimitri John Ledkov

Don't force inclusion of gnupg in debootstrap

Gbp-Pq: ubuntu-no-gnupg-hardcode.patch.

42c721f... by Dimitri John Ledkov

Skip installing missing initrd

Gbp-Pq: skip-missing-initrd.patch.

b1d007f... by Dimitri John Ledkov

Drop fix-up code for sysvinit

Gbp-Pq: ubuntu-no-sysvinit-fixups.patch.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index c604dbd..a17011a 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+live-build (3.0~a57-1ubuntu39) focal; urgency=medium
7+
8+ * Add GENISOIMAGE_OPTIONS_EXTRA
9+ Make the genisoimage option more flexible.
10+
11+ -- Li-Hao Liao (Leon Liao) <leon.liao@canonical.com> Fri, 21 Feb 2020 17:57:54 +0800
12+
13 live-build (3.0~a57-1ubuntu38) eoan; urgency=medium
14
15 * Stop setting LB_INITRAMFS_COMPRESSION default, and instead fallback to
16diff --git a/debian/patches/series b/debian/patches/series
17index 525fa1f..a5d9dd3 100644
18--- a/debian/patches/series
19+++ b/debian/patches/series
20@@ -40,3 +40,4 @@ late-resolv.conf-symlink.patch
21 ubuntu-initramfs-handling.patch
22 0001-Handle-includes.chroot-files-installed-over-symlinke.patch
23 drop-default-initramfs-compression-override.patch
24+ubuntu-make-genisoimage-more-flexible.patch
25diff --git a/debian/patches/ubuntu-make-genisoimage-more-flexible.patch b/debian/patches/ubuntu-make-genisoimage-more-flexible.patch
26new file mode 100644
27index 0000000..ccf861c
28--- /dev/null
29+++ b/debian/patches/ubuntu-make-genisoimage-more-flexible.patch
30@@ -0,0 +1,31 @@
31+Description: Make genisoimage more flexible.
32+ Originally, we can not customize the opiton of the genisoimage. Now, the "GENISOIMAGE_OPTIONS_EXTRA" will be genisoimage option and make more flexible. This modification come from "live-build 2.0.12-2cesg34", but I can not find the git repository.
33+Author: Li-Hao Liao (Leon Liao)
34+Last-Update: 2020-02-21
35+---
36+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
37+Index: live-build/scripts/build/lb_binary_iso
38+===================================================================
39+--- live-build.orig/scripts/build/lb_binary_iso
40++++ live-build/scripts/build/lb_binary_iso
41+@@ -193,7 +193,7 @@ fi
42+
43+ cat >> binary.sh << EOF
44+
45+-genisoimage ${GENISOIMAGE_OPTIONS} -o ${IMAGE} binary
46++genisoimage ${GENISOIMAGE_OPTIONS} ${GENISOIMAGE_OPTIONS_EXTRA} -o ${IMAGE} binary
47+ EOF
48+
49+ if [ "${LB_BINARY_IMAGES}" = "iso-hybrid" ]
50+Index: live-build/scripts/build/lb_config
51+===================================================================
52+--- live-build.orig/scripts/build/lb_config
53++++ live-build/scripts/build/lb_config
54+@@ -1089,6 +1089,7 @@ APT_OPTIONS="${APT_OPTIONS}"
55+ APTITUDE_OPTIONS="${APTITUDE_OPTIONS}"
56+ GZIP_OPTIONS="${GZIP_OPTIONS}"
57+ ISOHYBRID_OPTIONS="${ISOHYBRID_OPTIONS}"
58++GENISOIMAGE_OPTIONS_EXTRA="${GENISOIMAGE_OPTIONS_EXTRA}"
59+ EOF
60+
61+ # Creating lb_bootstrap_* configuration
62diff --git a/functions/defaults.sh b/functions/defaults.sh
63index 08da782..713190b 100755
64--- a/functions/defaults.sh
65+++ b/functions/defaults.sh
66@@ -220,8 +220,6 @@ Set_defaults ()
67 ;;
68 esac
69
70- LB_INITRAMFS_COMPRESSION="${LB_INITRAMFS_COMPRESSION:-gzip}"
71-
72 # Setting initsystem
73 case "${LB_MODE}" in
74 ubuntu|kubuntu)
75@@ -377,14 +375,6 @@ Set_defaults ()
76 fi
77 fi
78
79- # Include packages on base
80- case "${LB_MODE}" in
81- ubuntu|kubuntu)
82- LB_BOOTSTRAP_INCLUDE="${LB_BOOTSTRAP_INCLUDE:-gnupg}"
83- ;;
84-
85- esac
86-
87 # Exclude packages on base
88 # LB_BOOTSTRAP_EXCLUDE
89
90@@ -596,7 +586,7 @@ Set_defaults ()
91 ;;
92 esac
93
94- LB_PARENT_MIRROR_BINARY_VOLATILE="${LB_PARENT_MIRROR_BINARY_VOLATILE:-${LB_PARENT_MIRROR}}"
95+ LB_PARENT_MIRROR_BINARY_VOLATILE="${LB_PARENT_MIRROR_BINARY_VOLATILE:-${LB_PARENT_MIRROR_BINARY}}"
96 ;;
97
98 *)
99@@ -702,6 +692,10 @@ Set_defaults ()
100
101 # Setting linux flavour string
102 case "${LB_ARCHITECTURES}" in
103+ arm64)
104+ # Assume we'll have a generic kernel for arm64 some day:
105+ LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-generic}"
106+ ;;
107 armel)
108 case "${LB_MODE}" in
109 ubuntu|kubuntu)
110@@ -748,7 +742,14 @@ Set_defaults ()
111 ;;
112
113 ubuntu|kubuntu)
114- LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-generic}"
115+ case "${LB_DISTRIBUTION}" in
116+ precise)
117+ LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-generic-pae}"
118+ ;;
119+ *)
120+ LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-generic}"
121+ ;;
122+ esac
123 ;;
124
125 *)
126@@ -796,11 +797,11 @@ Set_defaults ()
127 ubuntu|kubuntu)
128 case "${LIST}" in
129 stripped|minimal)
130- LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-powerpc}"
131+ LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-powerpc-smp}"
132 ;;
133
134 *)
135- LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-powerpc powerpc64-smp}"
136+ LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-powerpc-smp generic}"
137 ;;
138 esac
139 ;;
140@@ -819,6 +820,14 @@ Set_defaults ()
141 esac
142 ;;
143
144+ ppc64el)
145+ LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-generic}"
146+ ;;
147+
148+ s390x)
149+ LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-generic}"
150+ ;;
151+
152 s390)
153 case "${LB_MODE}" in
154 progress|ubuntu|kubuntu)
155diff --git a/functions/losetup.sh b/functions/losetup.sh
156index b62cc16..fb7ebef 100755
157--- a/functions/losetup.sh
158+++ b/functions/losetup.sh
159@@ -68,7 +68,7 @@ Calculate_partition_size ()
160
161 case "${FILESYSTEM}" in
162 ext2|ext3|ext4)
163- PERCENT="5"
164+ PERCENT="${LB_EXT_FUDGEFACTOR:-5}"
165 ;;
166 *)
167 PERCENT="3"
168diff --git a/functions/packagelists.sh b/functions/packagelists.sh
169index 8a6141b..aad1ea2 100755
170--- a/functions/packagelists.sh
171+++ b/functions/packagelists.sh
172@@ -43,7 +43,15 @@ Expand_packagelist ()
173 \!*)
174 _EXEC="$(echo ${_LB_LINE} | sed -e 's|^!||')"
175
176- chroot chroot ${_EXEC}
177+ case "${LB_BUILD_WITH_CHROOT}" in
178+ true)
179+ chroot chroot sh -c "${_EXEC}"
180+ ;;
181+
182+ false)
183+ eval ${_EXEC}
184+ ;;
185+ esac
186 ;;
187
188 \#if\ *)
189diff --git a/functions/releases.sh b/functions/releases.sh
190index 6871c12..78bf4fe 100755
191--- a/functions/releases.sh
192+++ b/functions/releases.sh
193@@ -26,3 +26,6 @@ RELEASE_natty="11.04" # 2012-10-01
194 RELEASE_oneiric="11.10" # 2013-04-01
195 RELEASE_precise="12.04" # LTS: 2017-04-01
196 RELEASE_quantal="12.10" # 2014-04-01
197+RELEASE_raring="13.04" # 2014-01-01
198+RELEASE_saucy="13.10" # 2014-07-01
199+RELEASE_trusty="14.04" # LTS: 2019-04-01
200diff --git a/scripts/build/lb_binary_debian-installer b/scripts/build/lb_binary_debian-installer
201index 667887a..1414075 100755
202--- a/scripts/build/lb_binary_debian-installer
203+++ b/scripts/build/lb_binary_debian-installer
204@@ -362,7 +362,14 @@ then
205
206 case "${LB_MODE}" in
207 ubuntu|kubuntu)
208- DI_PACKAGES="${DI_REQ_PACKAGES} linux-generic"
209+ case "${LB_DISTRIBUTION}" in
210+ precise)
211+ DI_PACKAGES="${DI_REQ_PACKAGES} linux-generic-pae"
212+ ;;
213+ *)
214+ DI_PACKAGES="${DI_REQ_PACKAGES} linux-generic"
215+ ;;
216+ esac
217 ;;
218
219 *)
220@@ -388,7 +395,7 @@ then
221 DI_REQ_PACKAGES="yaboot"
222 case "${LB_MODE}" in
223 ubuntu|kubuntu)
224- DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-powerpc linux-image-powerpc64-smp"
225+ DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-powerpc-smp linux-image-generic"
226 ;;
227
228 *)
229diff --git a/scripts/build/lb_binary_disk b/scripts/build/lb_binary_disk
230index ce11019..29ce048 100755
231--- a/scripts/build/lb_binary_disk
232+++ b/scripts/build/lb_binary_disk
233@@ -97,24 +97,14 @@ case "${LB_INITRAMFS}" in
234 do
235 mkdir -p binary/uuid
236 cd binary/uuid
237-
238- case "${LB_INITRAMFS_COMPRESSION}" in
239- gzip)
240- zcat "../../${INITRD}" | cpio --quiet -id conf/uuid.conf
241- ;;
242-
243- bzip2)
244- bzcat "../../${INITRD}" | cpio --quiet -id conf/uuid.conf
245- ;;
246-
247- lzma)
248- lzcat -S "" "../../${INITRD}" | cpio --quiet -id conf/uuid.conf
249- ;;
250- esac
251-
252+ unmkinitramfs "../../${INITRD}" .
253 if [ -e conf/uuid.conf ]
254 then
255 mv conf/uuid.conf "../.disk/casper-uuid${INITRD#binary/casper/initrd.img}"
256+ # Multipart gets extracted as early/main:
257+ elif [ -e main/conf/uuid.conf ]
258+ then
259+ mv main/conf/uuid.conf "../.disk/casper-uuid${INITRD#binary/casper/initrd.img}"
260 else
261 Echo_warning "Failed to find casper uuid.conf in '${INITRD}'"
262 fi
263diff --git a/scripts/build/lb_binary_hooks b/scripts/build/lb_binary_hooks
264index 8018f79..a53330f 100755
265--- a/scripts/build/lb_binary_hooks
266+++ b/scripts/build/lb_binary_hooks
267@@ -43,17 +43,18 @@ Create_lockfile .lock
268 # Running hooks
269 for _HOOK in ${LB_BINARY_HOOKS}
270 do
271- for LOCATION in "${LIVE_BUILD}/hooks" /usr/share/live/build/hooks
272+ for LOCATION in "${LIVE_BUILD}/hooks" /usr/share/live/build/hooks
273+ do
274+ for FILE in "${LOCATION}"/???-"${_HOOK}".binary
275 do
276- if [ -e "${LOCATION}/hooks/???-${_HOOK}.binary" ]
277+ if [ -e "${FILE}" ]
278 then
279 cd binary
280- ./"${LOCATION}/hooks/???-${_HOOK}.binary" || { Echo_error "${_HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;}
281+ "${FILE}" || { Echo_error "${_HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;}
282 cd "${OLDPWD}"
283-
284- continue
285 fi
286 done
287+ done
288 done
289
290 ## Processing local hooks
291diff --git a/scripts/build/lb_binary_includes b/scripts/build/lb_binary_includes
292index c727395..80e905f 100755
293--- a/scripts/build/lb_binary_includes
294+++ b/scripts/build/lb_binary_includes
295@@ -42,8 +42,12 @@ if Find_files config/includes.binary/
296 then
297 # Copying includes
298 cd config/includes.binary
299- find . | cpio -dmpu --no-preserve-owner "${OLDPWD}"/binary
300+ Echo_message "Creating a tarball with files from includes.binary..."
301+ tar cf "${OLDPWD}"/binary/includes.binary.tar .
302 cd "${OLDPWD}"
303+ Echo_message "Extracting the tarball in the chroot..."
304+ tar -C binary -xvf binary/includes.binary.tar --no-same-owner --keep-directory-symlink --overwrite
305+ rm binary/includes.binary.tar
306
307 # Removing symlinks
308 case "${LB_BINARY_IMAGES}" in
309diff --git a/scripts/build/lb_binary_linux-image b/scripts/build/lb_binary_linux-image
310index e36b54b..fb1c953 100755
311--- a/scripts/build/lb_binary_linux-image
312+++ b/scripts/build/lb_binary_linux-image
313@@ -58,7 +58,7 @@ case "${LB_INITRAMFS}" in
314 esac
315
316 case "${LB_ARCHITECTURES}" in
317- powerpc)
318+ powerpc|ppc64el)
319 LINUX="vmlinux"
320 ;;
321
322@@ -76,7 +76,7 @@ mkdir -p "${DESTDIR}"
323 if [ "${LB_LINUX_PACKAGES}" != "none" ]
324 then
325 cp chroot/boot/"${LINUX}"-* "${DESTDIR}"
326- cp chroot/boot/initrd.img-* "${DESTDIR}"
327+ cp chroot/boot/initrd.img-* "${DESTDIR}" 2>&1 || Echo_message "Skipped installing missing initrd."
328 fi
329
330 case "${LB_INITRAMFS}" in
331diff --git a/scripts/build/lb_binary_package-lists b/scripts/build/lb_binary_package-lists
332index b3414ef..611b01f 100755
333--- a/scripts/build/lb_binary_package-lists
334+++ b/scripts/build/lb_binary_package-lists
335@@ -41,15 +41,33 @@ Create_lockfile .lock
336 if ls config/package-lists/*.list > /dev/null 2>&1 || \
337 ls config/package-lists/*.list.binary > /dev/null 2>&1
338 then
339- # Restoring cache
340- Restore_cache cache/packages.chroot
341-
342- # Check depends
343- Check_package chroot/usr/bin/apt-ftparchive apt-utils
344- Check_package chroot/usr/bin/grep-aptavail dctrl-tools
345-
346- # Installing depends
347- Install_package
348+ case "${LB_BUILD_WITH_CHROOT}" in
349+ true)
350+ # Restoring cache
351+ Restore_cache cache/packages.chroot
352+
353+ # Check depends
354+ Check_package chroot/usr/bin/apt-ftparchive apt-utils
355+ Check_package chroot/usr/bin/grep-aptavail dctrl-tools
356+
357+ # Installing depends
358+ Install_package
359+ ;;
360+
361+ false)
362+ if [ ! -e /usr/bin/apt-ftparchive ]; then
363+ # apt-utils
364+ Echo_error "/usr/bin/apt-ftparchive - no such file."
365+ exit 1
366+ fi
367+
368+ if [ ! -e /usr/bin/grep-aptavail ]; then
369+ # dctrl-tools
370+ Echo_error "/usr/bin/grep-aptavail - no such file."
371+ exit 1
372+ fi
373+ ;;
374+ esac
375
376 if [ -e "${LIVE_BUILD}/share/bin/Packages" ]
377 then
378@@ -133,11 +151,15 @@ then
379 rm -rf chroot/binary.deb
380 mv chroot/var/lib/dpkg/status.tmp chroot/var/lib/dpkg/status
381
382- # Removing depends
383- Remove_package
384+ case "${LB_BUILD_WITH_CHROOT}" in
385+ true)
386+ # Removing depends
387+ Remove_package
388
389- # Saving cache
390- Save_cache cache/packages.chroot
391+ # Saving cache
392+ Save_cache cache/packages.chroot
393+ ;;
394+ esac
395
396 # Creating stage file
397 Create_stagefile .build/binary_package-lists
398diff --git a/scripts/build/lb_binary_rootfs b/scripts/build/lb_binary_rootfs
399index 860b600..81dbfdd 100755
400--- a/scripts/build/lb_binary_rootfs
401+++ b/scripts/build/lb_binary_rootfs
402@@ -43,7 +43,7 @@ case "${LB_ARCHITECTURES}" in
403 LINUX="vmlinuz"
404 ;;
405
406- powerpc)
407+ powerpc|ppc64el)
408 LINUX="vmlinux"
409 ;;
410 esac
411@@ -129,7 +129,7 @@ case "${LB_CHROOT_FILESYSTEM}" in
412 FAKE_MTAB="true"
413 fi
414
415- Chroot chroot "mkfs.${LB_CHROOT_FILESYSTEM} -F -b 1024 -N ${REAL_INODES} -m 0 filesystem.${LB_CHROOT_FILESYSTEM}"
416+ Chroot chroot "mkfs.${LB_CHROOT_FILESYSTEM} -F -b ${LB_EXT_BLOCKSIZE:-1024} -i 8192 -m 0 -L ${LB_HDD_LABEL} ${LB_EXT_RESIZEBLOCKS:+-E resize=${LB_EXT_RESIZEBLOCKS}} filesystem.${LB_CHROOT_FILESYSTEM}"
417
418 mkdir -p filesystem.tmp
419 ${LB_ROOT_COMMAND} mount -o loop chroot/filesystem.${LB_CHROOT_FILESYSTEM} filesystem.tmp
420@@ -199,7 +199,7 @@ case "${LB_CHROOT_FILESYSTEM}" in
421
422 false)
423 dd if=/dev/zero of=binary/${INITFS}/filesystem.${LB_CHROOT_FILESYSTEM} bs=1024k count=0 seek=${REAL_DIM}
424- mkfs.${LB_CHROOT_FILESYSTEM} -F -b 1024 -N ${REAL_INODES} -m 0 binary/${INITFS}/filesystem.${LB_CHROOT_FILESYSTEM}
425+ mkfs.${LB_CHROOT_FILESYSTEM} -F -b ${LB_EXT_BLOCKSIZE:-1024} -i 8192 -m 0 -L ${LB_HDD_LABEL} ${LB_EXT_RESIZEBLOCKS:+-E resize=${LB_EXT_RESIZEBLOCKS}} binary/${INITFS}/filesystem.${LB_CHROOT_FILESYSTEM}
426
427 mkdir -p filesystem.tmp
428 ${LB_ROOT_COMMAND} mount -o loop binary/${INITFS}/filesystem.${LB_CHROOT_FILESYSTEM} filesystem.tmp
429@@ -363,8 +363,15 @@ case "${LB_CHROOT_FILESYSTEM}" in
430 ;;
431
432 *)
433- # FIXME: artax-backports too, once d-i has catched up
434- MKSQUASHFS_OPTIONS="${MKSQUASHFS_OPTIONS} -comp xz"
435+ case "${LB_MODE}" in
436+ ubuntu|kubuntu)
437+
438+ ;;
439+ *)
440+ # FIXME: artax-backports too, once d-i has catched up
441+ MKSQUASHFS_OPTIONS="${MKSQUASHFS_OPTIONS} -comp xz"
442+ ;;
443+ esac
444 ;;
445 esac
446
447diff --git a/scripts/build/lb_binary_syslinux b/scripts/build/lb_binary_syslinux
448index 300841a..b441cdb 100755
449--- a/scripts/build/lb_binary_syslinux
450+++ b/scripts/build/lb_binary_syslinux
451@@ -254,6 +254,13 @@ then
452 sed -i -e "s|@LB_BOOTAPPEND_LIVE@|${LB_BOOTAPPEND_LIVE}|g" \
453 -e "s|@LB_BOOTAPPEND_FAILSAFE@|${LB_BOOTAPPEND_FAILSAFE}|g" \
454 ${_TARGET}/live.cfg
455+
456+ case "${LB_INITRAMFS}" in
457+ casper)
458+ sed -i -e "s|boot=live|boot=casper|" \
459+ ${_SUFFIX}/live.cfg
460+ ;;
461+ esac
462 fi
463
464 if [ -e ${_TARGET}/install.cfg ]
465@@ -352,6 +359,22 @@ case "${LB_MODE}" in
466 ;;
467 esac
468
469+# Hack around the removal of support in gfxboot for reading from outside
470+# the bootlogo archive. This makes customisation harder and is not ideal.
471+tmpdir="$(mktemp -d)"
472+(cd "$tmpdir" && cpio -i) < ${_TARGET}/bootlogo
473+cp -a -f ${_TARGET}/*.fnt \
474+ ${_TARGET}/*.hlp \
475+ ${_TARGET}/*.jpg \
476+ ${_TARGET}/*.pcx \
477+ ${_TARGET}/*.tr \
478+ ${_TARGET}/*.cfg \
479+ $(test -e ${_TARGET}/lang && echo ${_TARGET}/lang) \
480+ ${_TARGET}/langlist \
481+ "$tmpdir/" || true
482+(cd "$tmpdir" && ls -1 | cpio --quiet -o) > ${_TARGET}/bootlogo
483+rm -rf "$tmpdir"
484+
485 case "${LB_BUILD_WITH_CHROOT}" in
486 true)
487 # Saving cache
488diff --git a/scripts/build/lb_bootstrap_debootstrap b/scripts/build/lb_bootstrap_debootstrap
489index d5865b6..7d08b61 100755
490--- a/scripts/build/lb_bootstrap_debootstrap
491+++ b/scripts/build/lb_bootstrap_debootstrap
492@@ -84,7 +84,18 @@ case "${LB_USE_FAKEROOT}" in
493 false)
494 if [ -n "${LB_BOOTSTRAP_FLAVOUR}" ]
495 then
496- DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --variant=${LB_BOOTSTRAP_FLAVOUR}"
497+ case "${LB_BOOTSTRAP_FLAVOUR}" in
498+ minimal)
499+ DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --variant=minbase"
500+ ;;
501+
502+ standard)
503+ ;;
504+
505+ *)
506+ DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --variant=${LB_BOOTSTRAP_FLAVOUR}"
507+ ;;
508+ esac
509 fi
510 ;;
511 esac
512diff --git a/scripts/build/lb_chroot b/scripts/build/lb_chroot
513index ada67c3..5316af0 100755
514--- a/scripts/build/lb_chroot
515+++ b/scripts/build/lb_chroot
516@@ -54,6 +54,7 @@ lb chroot_archives chroot install ${*}
517 # Customizing chroot
518 lb chroot_linux-image ${*}
519 lb chroot_preseed ${*}
520+lb chroot_early_hooks ${*}
521
522 for _PASS in install live
523 do
524@@ -62,6 +63,12 @@ do
525
526 if [ "${_PASS}" = install ]
527 then
528+ Chroot chroot "dpkg -l linux-headers-3* linux-headers-4*" 2>/dev/null \
529+ | awk '/^i/ {print $2}' > chroot.headers
530+ for i in $(cat chroot.headers); do
531+ Chroot chroot "apt-mark auto $i"
532+ done
533+ Chroot chroot "apt-get --purge -y autoremove"
534 Chroot chroot "dpkg-query -W" > chroot.packages.install
535 fi
536 done
537diff --git a/scripts/build/lb_chroot_archives b/scripts/build/lb_chroot_archives
538index 304480b..0894eb4 100755
539--- a/scripts/build/lb_chroot_archives
540+++ b/scripts/build/lb_chroot_archives
541@@ -249,10 +249,10 @@ EOF
542 # Adding archive signing keys (chroot)
543 if [ -e "${_BASE}/archives/${REPOSITORY}.key.chroot" ]
544 then
545- cat "${_BASE}/archives/${REPOSITORY}.key.chroot" | Chroot chroot "apt-key add -"
546+ cp "${_BASE}/archives/${REPOSITORY}.key.chroot" chroot/etc/apt/trusted.gpg.d/${REPOSITORY}.gpg
547 elif [ -e "${_BASE}/archives/${REPOSITORY}.key" ]
548 then
549- cat "${_BASE}/archives/${REPOSITORY}.key" | Chroot chroot "apt-key add -"
550+ cp "${_BASE}/archives/${REPOSITORY}.key" chroot/etc/apt/trusted.gpg.d/${REPOSITORY}.gpg
551 fi
552 fi
553 done
554@@ -291,7 +291,7 @@ EOF
555 do
556 if [ -e "${FILE}" ]
557 then
558- cp config/archives/$(basename ${_FILE} .chroot) chroot/etc/apt/preferences.d
559+ cp ${FILE} chroot/etc/apt/preferences.d/$(basename ${FILE} .chroot)
560 fi
561 done
562 fi
563@@ -516,9 +516,7 @@ EOF
564 do
565 if [ -e "${FILE}" ]
566 then
567- cp ${FILE} chroot/root
568- Chroot chroot "apt-key add /root/$(basename ${FILE})"
569- rm -f chroot/root/$(basename ${FILE})
570+ cp ${FILE} chroot/etc/apt/trusted.gpg.d/$(basename ${FILE}).gpg
571 fi
572 done
573 fi
574@@ -564,8 +562,8 @@ EOF
575 rm -rf chroot/var/cache/apt/*.bin
576
577 Apt chroot update
578- Apt chroot "upgrade"
579- Apt chroot "dist-upgrade"
580+ Apt chroot "--force-yes" "upgrade"
581+ Apt chroot "--force-yes" "dist-upgrade"
582
583 if [ "${LB_CACHE_INDICES}" = "true" ]
584 then
585@@ -804,10 +802,10 @@ EOF
586 # Adding archive signing keys (binary)
587 if [ -e "${_BASE}/archives/${REPOSITORY}.key.binary" ]
588 then
589- cat "${_BASE}/archives/${REPOSITORY}.key.binary" | Chroot chroot "apt-key add -"
590+ cp "${_BASE}/archives/${REPOSITORY}.key.binary" chroot/etc/apt/trusted.gpg.d/${REPOSITORY}.gpg
591 elif [ -e "${_BASE}/archives/${REPOSITORY}.key" ]
592 then
593- cat "${_BASE}/archives/${REPOSITORY}.key" | Chroot chroot "apt-key add -"
594+ cat "${_BASE}/archives/${REPOSITORY}.key" chroot/etc/apt/trusted.gpg.d/${REPOSITORY}.gpg
595 fi
596 fi
597 done
598@@ -846,7 +844,7 @@ EOF
599 do
600 if [ -e "${FILE}" ]
601 then
602- cp config/archives/$(basename ${_FILE} .binary) chroot/etc/apt/preferences.d
603+ cp ${FILE} chroot/etc/apt/preferences.d/$(basename ${FILE} .binary)
604 fi
605 done
606 fi
607diff --git a/scripts/build/lb_chroot_devpts b/scripts/build/lb_chroot_devpts
608index 6cde4f4..e2af87f 100755
609--- a/scripts/build/lb_chroot_devpts
610+++ b/scripts/build/lb_chroot_devpts
611@@ -49,7 +49,7 @@ case "${1}" in
612 mkdir -p chroot/dev/pts
613
614 # Mounting /dev/pts
615- ${LB_ROOT_COMMAND} mount devpts-live -t devpts chroot/dev/pts || true
616+ ${LB_ROOT_COMMAND} mount devpts-live -t devpts -o gid=5,mode=620 chroot/dev/pts || true
617 fi
618
619 # Creating stage file
620diff --git a/scripts/build/lb_chroot_dpkg b/scripts/build/lb_chroot_dpkg
621index e2f76ad..1cdcc29 100755
622--- a/scripts/build/lb_chroot_dpkg
623+++ b/scripts/build/lb_chroot_dpkg
624@@ -40,10 +40,8 @@ case "${1}" in
625 # Creating lock file
626 Create_lockfile .lock
627
628- # Save start-stop-daemon program
629- mv chroot/sbin/start-stop-daemon chroot/sbin/start-stop-daemon.orig
630-
631- # Create start-stop-daemon program
632+ # Create custom start-stop-daemon program
633+ Chroot chroot dpkg-divert --rename --quiet --add /sbin/start-stop-daemon
634
635 cat > chroot/sbin/start-stop-daemon << EOF
636 #!/bin/sh
637@@ -103,11 +101,9 @@ EOF
638 rmdir --ignore-fail-on-non-empty /var/state/samhain || true
639 fi
640
641- # Restore start-stop-daemon program
642- if [ -e chroot/sbin/start-stop-daemon.orig ]
643- then
644- mv chroot/sbin/start-stop-daemon.orig chroot/sbin/start-stop-daemon
645- fi
646+ # Remove custom start-stop-daemon program
647+ rm -f chroot/sbin/start-stop-daemon
648+ Chroot chroot dpkg-divert --rename --quiet --remove /sbin/start-stop-daemon
649
650 # Remove dpkg sync configuration
651 rm -f chroot/etc/dpkg/dpkg.cfg.d/live-build
652diff --git a/scripts/build/lb_chroot_early_hooks b/scripts/build/lb_chroot_early_hooks
653new file mode 100644
654index 0000000..dcbaa65
655--- /dev/null
656+++ b/scripts/build/lb_chroot_early_hooks
657@@ -0,0 +1,70 @@
658+#!/bin/sh
659+
660+## live-build(7) - System Build Scripts
661+## Copyright (C) 2006-2012 Daniel Baumann <daniel@debian.org>
662+##
663+## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
664+## This is free software, and you are welcome to redistribute it
665+## under certain conditions; see COPYING for details.
666+
667+
668+set -e
669+
670+# Including common functions
671+( . "${LIVE_BUILD}/scripts/build.sh" > /dev/null 2>&1 || true ) || . /usr/lib/live/build.sh
672+
673+# Setting static variables
674+DESCRIPTION="$(Echo 'execute hooks in chroot (early stage)')"
675+HELP=""
676+USAGE="${PROGRAM} [--force]"
677+
678+Arguments "${@}"
679+
680+# Reading configuration files
681+Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
682+Set_defaults
683+
684+Echo_message "Begin executing early chroot hooks..."
685+
686+# Requiring stage file
687+Require_stagefile .build/config .build/bootstrap
688+
689+# Checking stage file
690+Check_stagefile .build/chroot_early_hooks
691+
692+# Checking lock file
693+Check_lockfile .lock
694+
695+# Creating lock file
696+Create_lockfile .lock
697+
698+## Processing local hooks
699+if Find_files config/hooks/*.chroot_early
700+then
701+ # Restoring cache
702+ Restore_cache cache/packages.chroot
703+
704+ for _HOOK in config/hooks/*.chroot_early
705+ do
706+ # Copying hook
707+ cp "${_HOOK}" chroot/root
708+
709+ # Making hook executable
710+ if [ ! -x chroot/root/"$(basename ${_HOOK})" ]
711+ then
712+ chmod +x chroot/root/"$(basename ${_HOOK})"
713+ fi
714+
715+ # Executing hook
716+ Chroot chroot "/root/$(basename ${_HOOK})" || { Echo_error "${_HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;}
717+
718+ # Removing hook
719+ rm -f chroot/root/"$(basename ${_HOOK})"
720+ done
721+
722+ # Saving cache
723+ Save_cache cache/packages.chroot
724+
725+ # Creating stage file
726+ Create_stagefile .build/chroot_early_hooks
727+fi
728diff --git a/scripts/build/lb_chroot_hacks b/scripts/build/lb_chroot_hacks
729index 06bfe50..4e8d39e 100755
730--- a/scripts/build/lb_chroot_hacks
731+++ b/scripts/build/lb_chroot_hacks
732@@ -176,45 +176,28 @@ case "${LB_INITRAMFS}" in
733 ;;
734 esac
735
736+case "${SUBPROJECT}" in
737+ wubi)
738+ UPDATE_INITRAMFS_OPTIONS="$UPDATE_INITRAMFS_OPTIONS FRAMEBUFFER=y"
739+ ;;
740+esac
741+
742 if [ "${LB_INITRAMFS}" != "none" ]
743 then
744+ if [ -n "${LB_INITRAMFS_COMPRESSION}" ]; then
745+ echo "COMPRESS=${LB_INITRAMFS_COMPRESSION}" \
746+ > chroot/etc/initramfs-tools/conf.d/live-build.conf
747+ fi
748 Chroot chroot "${UPDATE_INITRAMFS_OPTIONS} update-initramfs -k all -t -u"
749+ rm -f chroot//etc/initramfs-tools/conf.d/live-build.conf
750 fi
751
752-# We probably ought to use COMPRESS= in a temporary file in
753-# /etc/initramfs-tools/conf.d/ instead, but it's hard to pass options that
754-# way.
755-case "${LB_INITRAMFS_COMPRESSION}" in
756- gzip)
757- ;;
758-
759- bzip2)
760- for INITRAMFS in $(find chroot/boot -name 'initrd*'); do
761- zcat "${INITRAMFS}" | bzip2 -c ${BZIP2_OPTIONS} > "${INITRAMFS}.new"
762- mv "${INITRAMFS}.new" "${INITRAMFS}"
763- done
764- ;;
765-
766- lzma)
767- # We probably ought to use COMPRESS= in a temporary file in
768- # /etc/initramfs-tools/conf.d/ instead, but it's hard to
769- # pass options that way.
770- for INITRAMFS in $(find chroot/boot -name 'initrd*'); do
771- zcat "${INITRAMFS}" | lzma -c ${LZMA_OPTIONS} > "${INITRAMFS}.new"
772- mv "${INITRAMFS}.new" "${INITRAMFS}"
773- done
774- ;;
775-esac
776-
777 # Ensure readable permissions on initramfs. loop-aes-utils sets umask to
778 # protect GPG keys, which live-build does not support.
779 # Note: Use find rather than chmod on the wildcard, one never knows what
780 # people might do in local hooks, and there might be no initrds at all.
781 find chroot/boot -name 'initrd*' -print0 | xargs -r -0 chmod go+r
782
783-# Remove build systems clock drift
784-echo "0.0 0 0.0" > chroot/etc/adjtime
785-
786 # Remove cruft
787 rm -f chroot/boot/initrd*bak*
788 rm -f chroot/etc/apt/trusted.gpg~
789@@ -223,6 +206,7 @@ rm -f chroot/etc/gshadow- chroot/etc/shadow-
790 rm -f chroot/var/cache/debconf/*-old
791 rm -f chroot/var/lib/dpkg/*-old
792 rm -f chroot/var/log/apt/term.log
793+rm -f chroot/etc/adjtime
794
795 # Delete and re-create temporary directories
796 TEMP_DIRS="/tmp /var/tmp"
797@@ -271,7 +255,7 @@ then
798 done
799
800 # Config files which need to be RW
801- COW_FILES="/etc/adjtime /etc/fstab /etc/hostname /etc/hosts /etc/live.conf /etc/network/interfaces /etc/resolv.conf /etc/udev/rules.d/*persistent-net.rules /etc/udev/rules.d/*persistent-cd.rules /etc/X11/xorg.conf"
802+ COW_FILES="/etc/fstab /etc/hostname /etc/hosts /etc/live.conf /etc/network/interfaces /etc/resolv.conf /etc/udev/rules.d/*persistent-net.rules /etc/udev/rules.d/*persistent-cd.rules /etc/X11/xorg.conf"
803
804 # Where we will store RW config files
805 RW_DIRECTORY="/var/lib/live"
806diff --git a/scripts/build/lb_chroot_hooks b/scripts/build/lb_chroot_hooks
807index 368e922..71f123c 100755
808--- a/scripts/build/lb_chroot_hooks
809+++ b/scripts/build/lb_chroot_hooks
810@@ -54,12 +54,14 @@ for _HOOK in ${LB_CHROOT_HOOKS}
811 do
812 for LOCATION in "${LIVE_BUILD}/hooks" /usr/share/live/build/hooks
813 do
814- if [ -e "${LOCATION}/hooks/???-${_HOOK}.binary" ]
815- then
816- mkdir -p chroot/root/lb_chroot_hooks
817- cp "${LOCATION}"/hooks/???-"${_HOOK}".chroot chroot/root/lb_chroot_hooks
818- continue
819- fi
820+ for FILE in "${LOCATION}"/???-"${_HOOK}".chroot
821+ do
822+ if [ -e "${FILE}" ]
823+ then
824+ mkdir -p chroot/root/lb_chroot_hooks
825+ cp "${FILE}" chroot/root/lb_chroot_hooks
826+ fi
827+ done
828 done
829 done
830
831diff --git a/scripts/build/lb_chroot_hostname b/scripts/build/lb_chroot_hostname
832index 28cb501..2c88b41 100755
833--- a/scripts/build/lb_chroot_hostname
834+++ b/scripts/build/lb_chroot_hostname
835@@ -29,8 +29,6 @@ Require_stagefile .build/config .build/bootstrap
836
837 case "${1}" in
838 install)
839- Echo_message "Configuring file /etc/hostname"
840-
841 # Checking stage file
842 Check_stagefile .build/chroot_hostname
843
844@@ -40,15 +38,15 @@ case "${1}" in
845 # Creating lock file
846 Create_lockfile .lock
847
848- # Save hostname
849- mv chroot/bin/hostname chroot/bin/hostname.orig
850-
851 # Create hostname file
852+ Echo_message "Configuring file /etc/hostname"
853+
854 echo "localhost.localdomain" > chroot/etc/hostname
855
856+ # Create custom hostname
857 Echo_message "Configuring file /bin/hostname"
858
859- # Create hostname program
860+ Chroot chroot dpkg-divert --rename --quiet --add /bin/hostname
861
862 cat > chroot/bin/hostname << EOF
863 #!/bin/sh
864@@ -79,11 +77,9 @@ EOF
865
866 Echo_message "Deconfiguring file /bin/hostname"
867
868- # Restore hostname file
869- if [ -e chroot/bin/hostname.orig ]
870- then
871- mv chroot/bin/hostname.orig chroot/bin/hostname
872- fi
873+ # Remove custom hostname
874+ rm -f chroot/bin/hostname
875+ Chroot chroot dpkg-divert --rename --quiet --remove /bin/hostname
876
877 # Removing stage file
878 rm -f .build/chroot_hostname
879diff --git a/scripts/build/lb_chroot_includes b/scripts/build/lb_chroot_includes
880index ba31d5c..d946f5f 100755
881--- a/scripts/build/lb_chroot_includes
882+++ b/scripts/build/lb_chroot_includes
883@@ -42,8 +42,12 @@ if Find_files config/includes.chroot/
884 then
885 # Copying includes
886 cd config/includes.chroot
887- find . | cpio -dmpu --no-preserve-owner "${OLDPWD}"/chroot
888+ Echo_message "Creating a tarball with files from includes.chroot..."
889+ tar cf "${OLDPWD}"/chroot/includes.chroot.tar .
890 cd "${OLDPWD}"
891+ Echo_message "Extracting the tarball in the chroot..."
892+ Chroot chroot "tar -xvf includes.chroot.tar --no-same-owner --keep-directory-symlink --overwrite"
893+ rm chroot/includes.chroot.tar
894
895 # Creating stage file
896 Create_stagefile .build/chroot_includes
897diff --git a/scripts/build/lb_chroot_linux-image b/scripts/build/lb_chroot_linux-image
898index e2ca830..0244933 100755
899--- a/scripts/build/lb_chroot_linux-image
900+++ b/scripts/build/lb_chroot_linux-image
901@@ -118,6 +118,24 @@ EOF
902
903 fi
904
905+ cat > chroot/etc/kernel-img.conf << EOF
906+# Kernel Image management overrides
907+# See kernel-img.conf(5) for details
908+do_symlinks = yes
909+do_bootloader = no
910+EOF
911+
912+ case "${LB_ARCHITECTURES}" in
913+ alpha|amd64|hppa|i386|ia64|m68k|mips|mipsel)
914+ ;;
915+
916+ *)
917+ cat >> chroot/etc/kernel-img.conf << EOF
918+link_in_boot = yes
919+EOF
920+ ;;
921+ esac
922+
923 # Creating stage file
924 Create_stagefile .build/chroot_linux-image
925 fi
926diff --git a/scripts/build/lb_chroot_live-packages b/scripts/build/lb_chroot_live-packages
927index 0e4ff44..e8ba0a1 100755
928--- a/scripts/build/lb_chroot_live-packages
929+++ b/scripts/build/lb_chroot_live-packages
930@@ -48,20 +48,6 @@ then
931 _PACKAGES="${_PACKAGES} live-config live-config-${LB_INITSYSTEM}"
932 fi
933
934-# Do initsystem specific hacks
935-if [ -n "${LB_INITSYSTEM}" ] && [ "${LB_INITSYSTEM}" != "sysvinit" ]
936-then
937- # lets see if we still need the squeeze's "pre init system policy discussion" hack:
938- IS_SYSVINIT_ESSENTIAL="$(Chroot chroot dpkg-query --show --showformat='${Essential}\n' sysvinit)"
939- RC="$?"
940-
941- if [ "${IS_SYSVINIT_ESSENTIAL}" != "no" ] && [ "${RC}" = "0" ]
942- then
943- # sysvinit is both installed and essential, ugly hack to remove it
944- Chroot chroot dpkg --force-remove-essential --remove sysvinit || true
945- fi
946-fi
947-
948 # Install live packages
949 if [ -n "${_PACKAGES}" ]
950 then
951diff --git a/scripts/build/lb_chroot_package-lists b/scripts/build/lb_chroot_package-lists
952index e2dabb1..eba1cbe 100755
953--- a/scripts/build/lb_chroot_package-lists
954+++ b/scripts/build/lb_chroot_package-lists
955@@ -46,14 +46,26 @@ if ls config/package-lists/*.list > /dev/null 2>&1 || \
956 ls config/package-lists/*.list.chroot > /dev/null 2>&1 || \
957 ls config/package-lists/*.list.chroot_${_PASS} > /dev/null 2>&1
958 then
959- # Checking depends
960- Check_package chroot/usr/bin/grep-aptavail dctrl-tools
961-
962- # Restoring cache
963- Restore_cache cache/packages.chroot
964-
965- # Installing depends
966- Install_package
967+ case "${LB_BUILD_WITH_CHROOT}" in
968+ true)
969+ # Checking depends
970+ Check_package chroot/usr/bin/grep-aptavail dctrl-tools
971+
972+ # Restoring cache
973+ Restore_cache cache/packages.chroot
974+
975+ # Installing depends
976+ Install_package
977+ ;;
978+
979+ false)
980+ if [ ! -e /usr/bin/grep-aptavail ]; then
981+ # dctrl-tools
982+ Echo_error "/usr/bin/grep-aptavail - no such file."
983+ exit 1
984+ fi
985+ ;;
986+ esac
987
988 if [ -e "${LIVE_BUILD}/share/bin/Packages" ]
989 then
990@@ -76,15 +88,19 @@ then
991
992 rm -f chroot/bin/Packages
993
994- # Removing dctrl-tools again if the user has not installed it
995- if ! grep -qs dctrl-tools chroot/root/packages.chroot
996- then
997- # Removing depends
998- Remove_package
999- fi
1000-
1001- # Saving cache
1002- Save_cache cache/packages.binary
1003+ case "${LB_BUILD_WITH_CHROOT}" in
1004+ true)
1005+ # Removing dctrl-tools again if the user has not installed it
1006+ if ! grep -qs dctrl-tools chroot/root/packages.chroot
1007+ then
1008+ # Removing depends
1009+ Remove_package
1010+ fi
1011+
1012+ # Saving cache
1013+ Save_cache cache/packages.binary
1014+ ;;
1015+ esac
1016
1017 # Creating stage file
1018 Create_stagefile .build/chroot_package-lists.${_PASS}
1019diff --git a/scripts/build/lb_chroot_resolv b/scripts/build/lb_chroot_resolv
1020index 417c412..438bae0 100755
1021--- a/scripts/build/lb_chroot_resolv
1022+++ b/scripts/build/lb_chroot_resolv
1023@@ -76,11 +76,20 @@ case "${1}" in
1024 # Creating lock file
1025 Create_lockfile .lock
1026
1027- if [ -e config/includes.chroot/etc/resolv.conf ]
1028+ if [ -e config/includes.chroot/etc/resolv.conf ] || [ -L config/includes.chroot/etc/resolv.conf ];
1029 then
1030 # Copying local resolv.conf
1031 cp -a config/includes.chroot/etc/resolv.conf chroot/etc/resolv.conf
1032 rm -f chroot/etc/resolv.conf.orig
1033+ elif [ -L chroot/etc/resolv.conf ] && [ -e chroot/etc/resolv.conf.orig ]
1034+ then
1035+ # After debootstrap (which copied resolv.conf from
1036+ # the host) and after we backed that up, something
1037+ # converted /etc/resolv.conf into a
1038+ # symlink. E.g. a late installation of
1039+ # systemd-resolved or resolvconf. Do not touch the
1040+ # new symlink, but do clean up our backup.
1041+ rm -f chroot/etc/resolv.conf.orig
1042 elif [ -e chroot/etc/resolv.conf.orig ] || [ -L chroot/etc/resolv.conf.orig ]
1043 then
1044 # Restoring resolv file or symlink
1045@@ -90,6 +99,12 @@ case "${1}" in
1046 Truncate chroot/etc/resolv.conf
1047 fi
1048
1049+ # Clean up resolvconf's pollution
1050+ if [ -d chroot/etc/resolvconf/resolv.conf.d ]; then
1051+ rm -f chroot/etc/resolvconf/resolv.conf.d/original
1052+ rm -f chroot/etc/resolvconf/resolv.conf.d/tail
1053+ fi
1054+
1055 # Removing stage file
1056 rm -f .build/chroot_resolv
1057 ;;
1058diff --git a/scripts/build/lb_chroot_sysv-rc b/scripts/build/lb_chroot_sysv-rc
1059index 94db1ca..c070a25 100755
1060--- a/scripts/build/lb_chroot_sysv-rc
1061+++ b/scripts/build/lb_chroot_sysv-rc
1062@@ -40,10 +40,10 @@ case "${1}" in
1063 # Creating lock file
1064 Create_lockfile .lock
1065
1066- if [ -f chroot/usr/sbin/policy-rc.d ]
1067+ if [ -e chroot/usr/sbin/policy-rc.d ]
1068 then
1069 # Save policy-rc.d file
1070- mv chroot/usr/sbin/policy-rc.d chroot/usr/sbin/policy-rc.d.orig
1071+ Chroot chroot dpkg-divert --rename --quiet --add /usr/sbin/policy-rc.d
1072 fi
1073
1074 # Create policy-rc.d file
1075@@ -68,13 +68,13 @@ EOF
1076 # Creating lock file
1077 Create_lockfile .lock
1078
1079- if [ -f chroot/usr/sbin/policy-rc.d.orig ]
1080+ # Remove custom policy-rc.d file
1081+ rm -f chroot/usr/sbin/policy-rc.d
1082+
1083+ if [ -e chroot/usr/sbin/policy-rc.d.distrib ]
1084 then
1085 # Restore policy-rc.d file
1086- mv chroot/usr/sbin/policy-rc.d.orig chroot/usr/sbin/policy-rc.d
1087- else
1088- # Remove policy-rc.d file
1089- rm -f chroot/usr/sbin/policy-rc.d
1090+ Chroot chroot dpkg-divert --rename --quiet --remove /usr/sbin/policy-rc.d
1091 fi
1092
1093 # Removing stage file
1094diff --git a/scripts/build/lb_chroot_upstart b/scripts/build/lb_chroot_upstart
1095index ea22549..8b7c1c4 100755
1096--- a/scripts/build/lb_chroot_upstart
1097+++ b/scripts/build/lb_chroot_upstart
1098@@ -40,13 +40,11 @@ case "${1}" in
1099 # Creating lock file
1100 Create_lockfile .lock
1101
1102- if [ -f chroot/sbin/initctl ]
1103- then
1104- # Save initctl file
1105- mv chroot/sbin/initctl chroot/sbin/initctl.orig
1106- fi
1107+ # Create custom initctl file
1108+ Chroot chroot dpkg-divert --rename --quiet --add /sbin/initctl
1109
1110- # Create initctl file
1111+ # Only create stub if we actually diverted something
1112+ if [ -e chroot/sbin/initctl.distrib ]; then
1113 cat > chroot/sbin/initctl << EOF
1114 #!/bin/sh
1115 echo "All runlevel operations denied by policy" >&2
1116@@ -54,6 +52,7 @@ exit 101
1117 EOF
1118
1119 chmod 0755 chroot/sbin/initctl
1120+ fi
1121
1122 # Creating stage file
1123 Create_stagefile .build/chroot_upstart
1124@@ -68,14 +67,9 @@ EOF
1125 # Creating lock file
1126 Create_lockfile .lock
1127
1128- if [ -f chroot/sbin/initctl.orig ]
1129- then
1130- # Restore initctl file
1131- mv chroot/sbin/initctl.orig chroot/sbin/initctl
1132- else
1133- # Remove initctl file
1134- rm -f chroot/sbin/initctl
1135- fi
1136+ # Remove custom initctl file
1137+ rm -f chroot/sbin/initctl
1138+ Chroot chroot dpkg-divert --rename --quiet --remove /sbin/initctl
1139
1140 # Removing stage file
1141 rm -f .build/chroot_upstart
1142diff --git a/scripts/build/lb_clean b/scripts/build/lb_clean
1143index 4b7c23b..e500a8c 100755
1144--- a/scripts/build/lb_clean
1145+++ b/scripts/build/lb_clean
1146@@ -88,6 +88,7 @@ do
1147 ${LB_ROOT_COMMAND} rm -rf chroot chroot.tmp
1148
1149 rm -f chroot.packages.live chroot.packages.install
1150+ rm -f chroot.headers
1151
1152 rm -f .build/chroot*
1153 ;;
1154diff --git a/scripts/build/lb_config b/scripts/build/lb_config
1155index 8dbd0b8..ebfa47d 100755
1156--- a/scripts/build/lb_config
1157+++ b/scripts/build/lb_config
1158@@ -57,6 +57,9 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\
1159 \t [--debian-installer-gui true|false]\n\
1160 \t [--debug]\n\
1161 \t [-d|--distribution CODENAME]\n\
1162+\t [--ext-block-size 1024|2048|4096]\n\
1163+\t [--ext-resize-blocks N]\n\
1164+\t [--ext-fudge-factor PERCENTAGE]\n\
1165 \t [--parent-distribution CODENAME]\n\
1166 \t [--parent-debian-installer-distribution CODENAME]\n\
1167 \t [--dump]\n\
1168@@ -157,7 +160,7 @@ Local_arguments ()
1169 apt-indices:,bootappend-install:,bootappend-live:,bootappend-failsafe:,bootloader:,checksums:,compression:,config:,zsync:,build-with-chroot:,
1170 debian-installer:,debian-installer-distribution:,debian-installer-preseedfile:,debian-installer-gui:,
1171 grub-splash:,isohybrid-options:,hdd-label:,hdd-size:,iso-application:,iso-preparer:,iso-publisher:,
1172- iso-volume:,jffs2-eraseblock:,memtest:,net-root-filesystem:,net-root-mountoptions:,
1173+ iso-volume:,jffs2-eraseblock:,ext-block-size:,ext-resize-blocks:,ext-fudge-factor:,memtest:,net-root-filesystem:,net-root-mountoptions:,
1174 net-root-path:,net-root-server:,net-cow-filesystem:,net-cow-mountoptions:,net-cow-path:,
1175 net-cow-server:,net-tarball:,firmware-binary:,firmware-chroot:,swap-file-path:,swap-file-size:,syslinux-theme:,
1176 win32-loader:,source:,source-images:,breakpoints,conffile:,debug,force,
1177@@ -683,6 +686,21 @@ Local_arguments ()
1178 shift 2
1179 ;;
1180
1181+ --ext-block-size)
1182+ LB_EXT_BLOCKSIZE="${2}"
1183+ shift 2
1184+ ;;
1185+
1186+ --ext-resize-blocks)
1187+ LB_EXT_RESIZEBLOCKS="${2}"
1188+ shift 2
1189+ ;;
1190+
1191+ --ext-fudge-factor)
1192+ LB_EXT_FUDGEFACTOR="${2}"
1193+ shift 2
1194+ ;;
1195+
1196 --jffs2-eraseblock)
1197 LB_JFFS2_ERASEBLOCK="${2}"
1198 shift 2
1199@@ -1392,6 +1410,18 @@ LB_ISO_PUBLISHER="${LB_ISO_PUBLISHER}"
1200 # (Default: ${LB_ISO_VOLUME})
1201 LB_ISO_VOLUME="${LB_ISO_VOLUME}"
1202
1203+# \$LB_EXT_BLOCKSIZE: set EXT block size
1204+# (Default: unset)
1205+LB_EXT_BLOCKSIZE="${LB_EXT_BLOCKSIZE}"
1206+
1207+# \$LB_EXT_RESIZEBLOCKS: set EXT resize parameter
1208+# (Default: unset)
1209+LB_EXT_RESIZEBLOCKS="${LB_EXT_RESIZEBLOCKS}"
1210+
1211+# \$LB_EXT_FUDGEFACTOR: set extra size of EXT images (in %)
1212+# (Default: unset)
1213+LB_EXT_FUDGEFACTOR="${LB_EXT_FUDGEFACTOR}"
1214+
1215 # \$LB_JFFS2_ERASEBLOCK: set jffs2 eraseblock size
1216 # (Default: unset)
1217 LB_JFFS2_ERASEBLOCK=""
1218diff --git a/share/hooks/004-remove-dbus-machine-id.chroot b/share/hooks/004-remove-dbus-machine-id.chroot
1219index 230099e..6beac3b 100755
1220--- a/share/hooks/004-remove-dbus-machine-id.chroot
1221+++ b/share/hooks/004-remove-dbus-machine-id.chroot
1222@@ -7,3 +7,6 @@ set -e
1223 # This removes dbus machine id that cache that makes each system unique.
1224
1225 rm -f /var/lib/dbus/machine-id
1226+
1227+# truncate, do not remove otherwise systemd is unhappy
1228+printf "" > /etc/machine-id
1229diff --git a/share/hooks/100-build-wubildr.binary b/share/hooks/100-build-wubildr.binary
1230new file mode 100644
1231index 0000000..66d1944
1232--- /dev/null
1233+++ b/share/hooks/100-build-wubildr.binary
1234@@ -0,0 +1,36 @@
1235+#! /bin/sh
1236+
1237+set -e
1238+
1239+# Build the wubildr bootloader for Wubi.
1240+
1241+cd ..
1242+CHROOT="$(mktemp -d)"
1243+# grub-mkimage needs to be able to find the source file of the loopback image
1244+# in the location that losetup knows it is; however, in a chroot this file wont
1245+# be present, so we need to make it so by the magic of bind mounts:
1246+mkdir -p "ubuntu/disks"
1247+# FIXME: swap these next two lines around when the buildds can handle ext4:
1248+# mv "binary/boot/filesystem.ext4" "ubuntu/disks/root.disk"
1249+mv "binary/boot/filesystem.ext3" "ubuntu/disks/root.disk"
1250+mount -o loop "ubuntu/disks/root.disk" "$CHROOT"
1251+# Save the directory structure mkdir created, so that it can be removed later.
1252+REMOVE="$(mkdir -pv "$CHROOT$PWD" | head -n1 | sed "s,.*\`\(.*\)',\1,")"
1253+mount -o bind "$PWD" "$CHROOT$PWD"
1254+chroot "$CHROOT" mount -t proc proc /proc
1255+# Expected to already exist.
1256+touch wubildr
1257+# grub-install cries unless you point it at something.
1258+chroot "$CHROOT" grub-install /dev/null
1259+umount "$CHROOT/proc"
1260+umount "$CHROOT$PWD"
1261+rm -rf "$REMOVE"
1262+# /host is normally created by partman-auto-loop.
1263+mkdir "$CHROOT/host"
1264+umount "$CHROOT"
1265+mv wubildr binary/boot
1266+# Link output files somewhere BuildLiveCD will be able to find them.
1267+PREFIX="livecd.$PROJECT${SUBARCH:+-$SUBARCH}"
1268+mv ubuntu/disks/root.disk binary/boot/root.disk
1269+rmdir -p ubuntu/disks
1270+tar cf - -C binary/boot root.disk wubildr | xz -9 > "$PREFIX.tar.xz"

Subscribers

People subscribed via source and target branches