Import Debian version 20180411
live-build (1:20180411) unstable; urgency=medium
* ONIE: Check_package in the host, not the chroot
* ONIE: missing dependency on file
* ONIE: add Recommends for programs needed by binary_onie
* Print an error and exit if a host package (dependency) is missing.
* Reconfigure bootstrapped packages after preseeding.
live-build (1:20180328) unstable; urgency=low
[ Raphaël Hertzog ]
* Restore i386/amd64 autodetection in grub after rename of
i386 kernel from -486 to -686. Closes: #884585
Thanks to Adrian Gibanel Lopez for the patch.
* Fix handling of multiple kernels in binary_loopback_cfg.
Closes: #884588 Thanks to Adrian Gibanel Lopez for the patch.
* Rework failsafe entries in grub configuration to be more
consistent with the i386/amd64 autodetection entries.
Closes: #884591 Thanks to Adrian Gibanel Lopez for the patch.
* Add e2fsprogs to Suggests along with mtd-utils, parted. Closes: #887278
* Fix Check_package invocation in binary_hdd for ntfs-3g
(/sbin/mkfs.nfts -> /sbin/mkfs.ntfs)
* Run mksquashfs with nice -n 19 to not overload the system.
Thanks to Ronny Standtke for the patch. (Closes: #867539)
[ Luca Boccassi ]
* Fix build with local offline mirrors (Closes: #891206)
[ Rohan Garg ]
* Simplify bootstrapping of foreign architectures with qemu-debootstrap
(Closes: #847919)
[ Steven Shiau ]
* Add grub-based UEFI boot support for ARM64 (Closes: #885692)
[ Luca Boccassi ]
* UEFI: add minimal grub.cfg to fat32 partition (Closes: #892406)
* UEFI: add support for Secure Boot on amd64 and arm64 (Closes: #821084)
* UEFI: use uppercase EFI directory name for Tianocore
* Add NEWS file to warn users about change of live-boot mount paths
* Add options to build ONIE images
* Add Acquire::AllowInsecureRepositories to fix apt-secure in sid
* Use HTTPS in debian/copyright (policy 4.0.0).
* Bump Standards-Version to 4.1.3.
* Add myself to Uploaders.
Luca Boccassi authored 6 years ago
Sophie Brun committed 5 years ago
0 | live-build (1:20180411) unstable; urgency=medium | |
1 | ||
2 | The live-boot mount points have been moved from /lib/live/mount to | |
3 | /run/live. Since this is a backward-incompatible change, a compat | |
4 | recursive bind mount point is being provided in /lib/live/mount so | |
5 | that existing scripts will not break in Debian 10 (Buster). | |
6 | Please note that this will be removed in Debian 11 (Bullseye) so | |
7 | plan accordingly and update any required scripts. | |
8 | ||
9 | -- Luca Boccassi <[email protected]> Wed, 11 Apr 2018 12:35:19 +0100 |
0 | live-build (1:20180411) unstable; urgency=medium | |
1 | ||
2 | * ONIE: Check_package in the host, not the chroot | |
3 | * ONIE: missing dependency on file | |
4 | * ONIE: add Recommends for programs needed by binary_onie | |
5 | * Print an error and exit if a host package (dependency) is missing. | |
6 | * Reconfigure bootstrapped packages after preseeding. | |
7 | ||
8 | -- Luca Boccassi <[email protected]> Wed, 11 Apr 2018 12:35:19 +0100 | |
9 | ||
10 | live-build (1:20180328) unstable; urgency=low | |
11 | ||
12 | [ Raphaël Hertzog ] | |
13 | * Restore i386/amd64 autodetection in grub after rename of | |
14 | i386 kernel from -486 to -686. Closes: #884585 | |
15 | Thanks to Adrian Gibanel Lopez for the patch. | |
16 | * Fix handling of multiple kernels in binary_loopback_cfg. | |
17 | Closes: #884588 Thanks to Adrian Gibanel Lopez for the patch. | |
18 | * Rework failsafe entries in grub configuration to be more | |
19 | consistent with the i386/amd64 autodetection entries. | |
20 | Closes: #884591 Thanks to Adrian Gibanel Lopez for the patch. | |
21 | * Add e2fsprogs to Suggests along with mtd-utils, parted. Closes: #887278 | |
22 | * Fix Check_package invocation in binary_hdd for ntfs-3g | |
23 | (/sbin/mkfs.nfts -> /sbin/mkfs.ntfs) | |
24 | * Run mksquashfs with nice -n 19 to not overload the system. | |
25 | Thanks to Ronny Standtke for the patch. (Closes: #867539) | |
26 | ||
27 | [ Luca Boccassi ] | |
28 | * Fix build with local offline mirrors (Closes: #891206) | |
29 | ||
30 | [ Rohan Garg ] | |
31 | * Simplify bootstrapping of foreign architectures with qemu-debootstrap | |
32 | (Closes: #847919) | |
33 | ||
34 | [ Steven Shiau ] | |
35 | * Add grub-based UEFI boot support for ARM64 (Closes: #885692) | |
36 | ||
37 | [ Luca Boccassi ] | |
38 | * UEFI: add minimal grub.cfg to fat32 partition (Closes: #892406) | |
39 | * UEFI: add support for Secure Boot on amd64 and arm64 (Closes: #821084) | |
40 | * UEFI: use uppercase EFI directory name for Tianocore | |
41 | * Add NEWS file to warn users about change of live-boot mount paths | |
42 | * Add options to build ONIE images | |
43 | * Add Acquire::AllowInsecureRepositories to fix apt-secure in sid | |
44 | * Use HTTPS in debian/copyright (policy 4.0.0). | |
45 | * Bump Standards-Version to 4.1.3. | |
46 | * Add myself to Uploaders. | |
47 | ||
48 | -- Luca Boccassi <[email protected]> Wed, 28 Mar 2018 20:20:46 +0100 | |
49 | ||
0 | 50 | live-build (1:20171207) unstable; urgency=medium |
1 | 51 | |
2 | 52 | * Use $SOURCE_DATE_EPOCH when updating timestamps of manual pages in order |
1 | 1 | Section: misc |
2 | 2 | Priority: optional |
3 | 3 | Maintainer: Debian Live <[email protected]> |
4 | Uploaders: Raphaël Hertzog <[email protected]> | |
4 | Uploaders: Raphaël Hertzog <[email protected]>, | |
5 | Luca Boccassi <[email protected]>, | |
5 | 6 | Build-Depends: |
6 | 7 | debhelper (>= 10), |
7 | 8 | po4a, |
8 | 9 | gettext, |
9 | Standards-Version: 4.1.0 | |
10 | Standards-Version: 4.1.3 | |
10 | 11 | Homepage: https://debian-live.alioth.debian.org/live-build/ |
11 | Vcs-Browser: https://anonscm.debian.org/cgit/debian-live/live-build.git | |
12 | Vcs-Git: https://anonscm.debian.org/git/debian-live/live-build.git | |
12 | Vcs-Browser: https://salsa.debian.org/live-team/live-build | |
13 | Vcs-Git: https://salsa.debian.org/live-team/live-build.git | |
13 | 14 | |
14 | 15 | Package: live-build |
15 | 16 | Architecture: all |
18 | 19 | ${misc:Depends}, |
19 | 20 | Recommends: |
20 | 21 | apt-utils, |
22 | bzip2, | |
21 | 23 | cpio, |
24 | file, | |
22 | 25 | live-boot-doc, |
23 | 26 | live-config-doc, |
24 | 27 | live-manual-html | live-manual, |
25 | 28 | wget, |
29 | xz-utils, | |
30 | Suggests: | |
31 | e2fsprogs, | |
32 | parted, | |
33 | mtd-utils, | |
26 | 34 | Description: Live System Build Components |
27 | 35 | The Live Systems project maintains the components to build Debian based Live |
28 | 36 | systems and the official Debian Live images themselves. |
0 | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ | |
0 | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ | |
1 | 1 | Upstream-Name: live-build |
2 | 2 | Upstream-Contact: Debian Live Project <[email protected]> |
3 | 3 |
762 | 762 | # Setting net tarball |
763 | 763 | LB_NET_TARBALL="${LB_NET_TARBALL:-true}" |
764 | 764 | |
765 | # Setting onie | |
766 | LB_ONIE="${LB_ONIE:-false}" | |
767 | ||
768 | # Setting onie additional kernel cmdline options | |
769 | LB_ONIE_KERNEL_CMDLINE="${LB_ONIE_KERNEL_CMDLINE:-}" | |
770 | ||
765 | 771 | # Setting firmware option |
766 | 772 | LB_FIRMWARE_CHROOT="${LB_FIRMWARE_CHROOT:-true}" |
767 | 773 | LB_FIRMWARE_BINARY="${LB_FIRMWARE_BINARY:-true}" |
768 | 774 | |
769 | 775 | # Setting swap file |
770 | 776 | LB_SWAP_FILE_SIZE="${LB_SWAP_FILE_SIZE:-512}" |
777 | ||
778 | # Setting UEFI Secure Boot | |
779 | LB_UEFI_SECURE_BOOT="${LB_UEFI_SECURE_BOOT:-auto}" | |
771 | 780 | |
772 | 781 | ## config/source |
773 | 782 |
17 | 17 | |
18 | 18 | if [ "${INSTALL_STATUS}" -ne 0 ] |
19 | 19 | then |
20 | if [ "${LB_BUILD_WITH_CHROOT}" != "false" ] | |
20 | if [ "${LB_BUILD_WITH_CHROOT}" != "false" ] && [ "${CHROOT}" = "chroot" ] | |
21 | 21 | then |
22 | 22 | _LB_PACKAGES="${_LB_PACKAGES} ${PACKAGE}" |
23 | 23 | else |
198 | 198 | .br |
199 | 199 | [\fB\-\-net\-tarball\fR true|false] |
200 | 200 | .br |
201 | [\fB\-\-onie\fR true|false] | |
202 | .br | |
203 | [\fB\-\-onie\-kernel\-cmdline\fR \fI"OPTION1 OPTION2"\fR] | |
204 | .br | |
201 | 205 | [\fB\-\-quiet\fR] |
202 | 206 | .br |
203 | 207 | [\fB\-\-archive\-areas\fR \fIARCHIVE_AREA\fR|\fI"ARCHIVE_AREAS"\fR] |
213 | 217 | [\fB\-\-tasksel\fR apt|aptitude|tasksel] |
214 | 218 | .br |
215 | 219 | [\fB\-\-templates\fR \fIPATH\fR] |
220 | .br | |
221 | [\fB\-\-uefi\-secure\-boot\fR \fIauto|enable|disable\fR] | |
216 | 222 | .br |
217 | 223 | [\fB\-\-hdd\-size \fIMB\fR] |
218 | 224 | .br |
429 | 435 | sets the IP or hostname that will be configured in the bootloader configuration for the copy\-on\-write filesystem of your netboot image and is by default empty. |
430 | 436 | .IP "\fB\-\-net\-tarball\fR true|false" 4 |
431 | 437 | defines if a compressed tarball should be created. Disabling this options leads to no tarball at all, the plain binary directory is considered the output in this case. Default is true. |
438 | .IP "\fB\-\-onie\fR true|false" 4 | |
439 | defines if an ONIE.bin image is generated. ONIE binaries can be loaded by supported systems, and will in turn boot the live image. Note that iso or hybrid-iso are the only formats supported. For more information visit <\fIhttp://onie.org/\fR>. Default is false. | |
440 | .IP "\fB\-\-onie\-kernel\-cmdline\fR \fI""OPTION1 OPTION2""\fR" 4 | |
441 | defines additional kernel command line options that the ONIE system will use when booting the image. Default is empty string. | |
432 | 442 | .IP "\fB\-\-quiet\fR" 4 |
433 | 443 | reduces the verbosity of messages output by \fBlb build\fR. |
434 | 444 | .IP "\fB\-\-archive\-areas\fR \fIARCHIVE_AREA\fR|""\fIARCHIVE_AREAS\fR""" 4 |
453 | 463 | selects which program is used to install tasks. By default, this is set to tasksel. |
454 | 464 | .IP "\fB\-\-templates\fR \fIPATH\fR" 4 |
455 | 465 | sets the path to the templates that live\-build is going to use, e.g. for bootloaders. By default, this is set to /usr/share/live/build/templates/. |
466 | .IP "\fB\-\-uefi\-secure\-boot\fR \fIauto|enable|disable\fR" 4 | |
467 | enables or disables Secure Boot support when using grub-efi, by installing signed shim and grub-efi packages. By default, this is set to auto, which means if the packages are available they will be installed, but if not only a warning will be printed and the normal non-signed grub-efi will be used. | |
456 | 468 | .IP "\fB\-\-hdd\-size\fR MB" 4 |
457 | 469 | defines what size the hdd image should be. Note that although the default is set to 10000 (= 10GB), it will not need 10GB space on your harddisk as the files are created as sparse files. |
458 | 470 | .IP "\fB\-\-updates\fR true|false" 4 |
81 | 81 | |
82 | 82 | # Building images |
83 | 83 | lb binary_iso ${@} |
84 | lb binary_onie ${@} | |
84 | 85 | lb binary_netboot ${@} |
85 | 86 | lb binary_tar ${@} |
86 | 87 | lb binary_hdd ${@} |
40 | 40 | Create_lockfile .lock |
41 | 41 | |
42 | 42 | # Check architecture |
43 | Check_architectures amd64 i386 | |
43 | Check_architectures amd64 i386 arm64 | |
44 | 44 | Check_crossarchitectures |
45 | 45 | |
46 | 46 | # Checking depends |
47 | Check_package chroot /usr/lib/grub/x86_64-efi/configfile.mod grub-efi-amd64-bin | |
48 | Check_package chroot /usr/lib/grub/i386-efi/configfile.mod grub-efi-ia32-bin | |
47 | case "${LB_ARCHITECTURES}" in | |
48 | amd64|i386) | |
49 | Check_package chroot /usr/lib/grub/x86_64-efi/configfile.mod grub-efi-amd64-bin | |
50 | Check_package chroot /usr/lib/grub/i386-efi/configfile.mod grub-efi-ia32-bin | |
51 | ;; | |
52 | arm64) | |
53 | Check_package chroot /usr/lib/grub/arm64-efi/configfile.mod grub-efi-arm64-bin | |
54 | ;; | |
55 | esac | |
49 | 56 | Check_package chroot /usr/bin/grub-mkimage grub-common |
50 | 57 | Check_package chroot /usr/bin/mcopy mtools |
51 | 58 | Check_package chroot /sbin/mkfs.msdos dosfstools |
59 | ||
60 | # Check UEFI Secure Boot setting and depends | |
61 | # By default (auto) do a best-effort build: if the signed binaries are available use | |
62 | # them, but don't fail if they are not, just print a warning. | |
63 | case "${LB_ARCHITECTURES}" in | |
64 | amd64|i386) | |
65 | _SB_EFI_PLATFORM="x86_64" | |
66 | _SB_EFI_NAME="x64" | |
67 | _SB_EFI_DEB="amd64" | |
68 | ;; | |
69 | arm64) | |
70 | _SB_EFI_PLATFORM="arm64" | |
71 | _SB_EFI_NAME="aa64" | |
72 | _SB_EFI_DEB="arm64" | |
73 | ;; | |
74 | esac | |
75 | ||
76 | _PRE_SB_PACKAGES="${_LB_PACKAGES}" | |
77 | _LB_PACKAGES="shim-signed grub-efi-${_SB_EFI_DEB}-signed" | |
78 | case "${LB_UEFI_SECURE_BOOT}" in | |
79 | auto) | |
80 | # Use Check_installed, as Check_package will error out immediately | |
81 | set +e | |
82 | Install_package | |
83 | set -e | |
84 | Check_installed chroot /usr/lib/grub/${_SB_EFI_PLATFORM}-efi-signed/grub${_SB_EFI_NAME}.efi.signed \ | |
85 | grub-efi-${_SB_EFI_DEB}-signed | |
86 | _GRUB_INSTALL_STATUS="${INSTALL_STATUS}" | |
87 | Check_installed chroot /usr/lib/shim/shim${_SB_EFI_NAME}.efi.signed \ | |
88 | shim-signed | |
89 | ||
90 | if [ "${INSTALL_STATUS}" -ne 0 -o "${_GRUB_INSTALL_STATUS}" -ne 0 ] | |
91 | then | |
92 | Echo_warning "UEFI Secure Boot disabled due to missing signed Grub/Shim." | |
93 | else | |
94 | Echo_message "UEFI Secure Boot support enabled." | |
95 | fi | |
96 | ;; | |
97 | enable) | |
98 | Check_package chroot /usr/lib/grub/${_SB_EFI_PLATFORM}-efi-signed/grub${_SB_EFI_NAME}.efi.signed \ | |
99 | grub-efi-${_SB_EFI_DEB}-signed | |
100 | Check_package chroot /usr/lib/shim/shim${_SB_EFI_NAME}.efi.signed \ | |
101 | shim-signed | |
102 | Install_package | |
103 | Echo_message "UEFI Secure Boot support enabled." | |
104 | ;; | |
105 | disable) | |
106 | Echo_message "UEFI Secure Boot support disabled." | |
107 | ;; | |
108 | esac | |
109 | _LB_PACKAGES="${_PRE_SB_PACKAGES}" | |
52 | 110 | |
53 | 111 | # Setting destination directory |
54 | 112 | case "${LIVE_IMAGE_TYPE}" in |
66 | 124 | Install_package |
67 | 125 | |
68 | 126 | # Cleanup files that we generate |
69 | rm -rf binary/boot/efi.img binary/boot/grub/i386-efi/ binary/boot/grub/x86_64-efi | |
127 | rm -rf binary/boot/efi.img binary/boot/grub/i386-efi/ binary/boot/grub/x86_64-efi binary/boot/grub/arm64-efi | |
70 | 128 | |
71 | 129 | # This is workaround till both efi-image and grub-cpmodules are put into a binary package |
72 | 130 | case "${LB_BUILD_WITH_CHROOT}" in |
92 | 150 | |
93 | 151 | set -e |
94 | 152 | |
153 | gen_efi_boot_img(){ | |
154 | local platform="\$1" | |
155 | local efi_name="\$2" | |
156 | local netboot_prefix="\$3" | |
157 | local outdir="grub-efi-temp-\${platform}" | |
158 | "\${LIVE_BUILD_PATH}/efi-image" "${_CHROOT_DIR}/\$outdir" "\$platform" "\$efi_name" "\$netboot_prefix" | |
159 | mkdir -p ${_CHROOT_DIR}/grub-efi-temp/EFI/boot | |
160 | mcopy -n -i ${_CHROOT_DIR}/\$outdir/efi.img '::efi/boot/boot*.efi' ${_CHROOT_DIR}/grub-efi-temp/EFI/boot | |
161 | cp -r "${_CHROOT_DIR}"/\$outdir/* "${_CHROOT_DIR}/grub-efi-temp/" | |
162 | ||
163 | # Secure Boot support: | |
164 | # - create the EFI directory in the ESP with uppercase letters to make | |
165 | # certain firmwares (eg: TianoCore) happy | |
166 | # - use shim as the boot<arch>.efi that gets loaded first by the firmware | |
167 | # - drop a grub.cfg (same reason as below) in the cfg directory as configured | |
168 | # by the signed grub efi binary creation. At the moment that is EFI/debian | |
169 | # as set by grub2/debian/build-efi-images and cannot be changed without | |
170 | # rebuilding grub2 | |
171 | # - the source paths are taken from shim-signed: | |
172 | # https://packages.debian.org/sid/amd64/shim-signed/filelist | |
173 | # and grub-efi-amd64-signed, currently in Ubuntu: | |
174 | # https://packages.ubuntu.com/xenial/amd64/grub-efi-amd64-signed/filelist | |
175 | # https://packages.ubuntu.com/bionic/arm64/grub-efi-arm64-signed/filelist | |
176 | if [ -r ${_CHROOT_DIR}/usr/lib/grub/\$platform-signed/grub\$efi_name.efi.signed -a \ | |
177 | -r ${_CHROOT_DIR}/usr/lib/shim/shim\$efi_name.efi.signed -a \ | |
178 | "${LB_UEFI_SECURE_BOOT}" != "disable" ]; then | |
179 | mkdir -p ${_CHROOT_DIR}/grub-efi-temp/EFI/debian | |
180 | cp ${_CHROOT_DIR}/usr/lib/grub/\$platform-signed/grub\$efi_name.efi.signed \ | |
181 | ${_CHROOT_DIR}/grub-efi-temp/EFI/boot/grub\$efi_name.efi | |
182 | cp ${_CHROOT_DIR}/usr/lib/shim/shim\$efi_name.efi.signed \ | |
183 | ${_CHROOT_DIR}/grub-efi-temp/EFI/boot/boot\$efi_name.efi | |
184 | fi | |
185 | } | |
186 | ||
95 | 187 | PRE_EFI_IMAGE_PATH="${PATH}" |
96 | 188 | if [ ! -e "${LIVE_BUILD}" ] ; then |
97 | 189 | LIVE_BUILD_PATH="/usr/lib/live/build" |
101 | 193 | |
102 | 194 | PATH="${PATH}:\${LIVE_BUILD_PATH}" # Make sure grub-cpmodules is used as if it was installed in the system |
103 | 195 | |
104 | "\${LIVE_BUILD_PATH}/efi-image" "${_CHROOT_DIR}/grub-efi-temp-x86_64-efi/" "x86_64-efi" "x64" "debian-live/amd64" | |
105 | mkdir -p ${_CHROOT_DIR}/grub-efi-temp/efi/boot | |
106 | mcopy -n -i ${_CHROOT_DIR}/grub-efi-temp-x86_64-efi/efi.img '::efi/boot/boot*.efi' ${_CHROOT_DIR}/grub-efi-temp/efi/boot | |
107 | cp -r "${_CHROOT_DIR}"/grub-efi-temp-x86_64-efi/* "${_CHROOT_DIR}/grub-efi-temp/" | |
108 | ||
109 | "\${LIVE_BUILD_PATH}/efi-image" "${_CHROOT_DIR}/grub-efi-temp-i386-efi/" "i386-efi" "ia32" "debian-live/i386" | |
110 | PATH="\${PRE_EFI_IMAGE_PATH}" | |
111 | mkdir -p ${_CHROOT_DIR}/grub-efi-temp/efi/boot | |
112 | mcopy -n -i ${_CHROOT_DIR}/grub-efi-temp-i386-efi/efi.img '::efi/boot/boot*.efi' ${_CHROOT_DIR}/grub-efi-temp/efi/boot | |
113 | cp -r "${_CHROOT_DIR}"/grub-efi-temp-i386-efi/* "${_CHROOT_DIR}/grub-efi-temp/" | |
196 | case "${LB_ARCHITECTURES}" in | |
197 | amd64|i386) | |
198 | gen_efi_boot_img "x86_64-efi" "x64" "debian-live/amd64" | |
199 | gen_efi_boot_img "i386-efi" "ia32" "debian-live/i386" | |
200 | PATH="\${PRE_EFI_IMAGE_PATH}" | |
201 | ;; | |
202 | arm64) | |
203 | gen_efi_boot_img "arm64-efi" "aa64" "debian-live/arm64" | |
204 | PATH="\${PRE_EFI_IMAGE_PATH}" | |
205 | ;; | |
206 | esac | |
207 | ||
208 | ||
209 | # On some platforms the EFI grub image will be loaded, so grub's root | |
210 | # variable will be set to the EFI partition. This means that grub will | |
211 | # look in that partition for a grub.cfg file, and even if it finds it | |
212 | # it will not be able to find the vmlinuz and initrd. | |
213 | # Drop a minimal grub.cfg in the EFI partition that sets the root and prefix | |
214 | # to whatever partition holds the /live/vmlinuz image, and load the grub | |
215 | # config from that same partition. | |
216 | # This is what the Ubuntu livecd already does. | |
217 | mkdir -p ${_CHROOT_DIR}/grub-efi-temp-cfg | |
218 | cat >${_CHROOT_DIR}/grub-efi-temp-cfg/grub.cfg <<EOF | |
219 | search --set=root --file /live/vmlinuz | |
220 | set prefix=(\\\$root)/boot/grub | |
221 | configfile (\\\$root)/boot/grub/grub.cfg | |
222 | EOF | |
114 | 223 | |
115 | 224 | # The code below is adapted from tools/boot/jessie/boot-x86 |
116 | 225 | # in debian-cd |
122 | 231 | # the case of a multi-arch amd64/i386 image |
123 | 232 | |
124 | 233 | size=0 |
125 | for file in ${_CHROOT_DIR}/grub-efi-temp/efi/boot/boot*.efi; do | |
234 | for file in ${_CHROOT_DIR}/grub-efi-temp/EFI/boot/*.efi \ | |
235 | ${_CHROOT_DIR}/grub-efi-temp-cfg/grub.cfg; do | |
126 | 236 | size=\$((\$size + \$(stat -c %s "\$file"))) |
127 | 237 | done |
128 | 238 | |
239 | # directories: EFI EFI/boot boot boot/grub | |
240 | size=\$((\$size + 4096 * 4)) | |
241 | ||
242 | # EFI/debian and additional grub.cfg | |
243 | if [ -d ${_CHROOT_DIR}/grub-efi-temp/EFI/debian ]; then | |
244 | size=\$((\$size + 4096)) | |
245 | size=\$((\$size + \$(stat -c %s "${_CHROOT_DIR}/grub-efi-temp-cfg/grub.cfg"))) | |
246 | cp ${_CHROOT_DIR}/grub-efi-temp-cfg/grub.cfg \ | |
247 | ${_CHROOT_DIR}/grub-efi-temp/EFI/debian | |
248 | fi | |
249 | ||
129 | 250 | blocks=\$(((\$size / 1024 + 55) / 32 * 32 )) |
130 | 251 | |
131 | 252 | rm -f ${_CHROOT_DIR}/grub-efi-temp/boot/grub/efi.img |
132 | 253 | mkfs.msdos -C "${_CHROOT_DIR}/grub-efi-temp/boot/grub/efi.img" \$blocks >/dev/null |
133 | mmd -i "${_CHROOT_DIR}/grub-efi-temp/boot/grub/efi.img" ::efi | |
134 | mmd -i "${_CHROOT_DIR}/grub-efi-temp/boot/grub/efi.img" ::efi/boot | |
135 | mcopy -o -i "${_CHROOT_DIR}/grub-efi-temp/boot/grub/efi.img" ${_CHROOT_DIR}/grub-efi-temp/efi/boot/boot*.efi \ | |
136 | "::efi/boot" | |
254 | mmd -i "${_CHROOT_DIR}/grub-efi-temp/boot/grub/efi.img" ::EFI | |
255 | mmd -i "${_CHROOT_DIR}/grub-efi-temp/boot/grub/efi.img" ::EFI/boot | |
256 | mcopy -o -i "${_CHROOT_DIR}/grub-efi-temp/boot/grub/efi.img" ${_CHROOT_DIR}/grub-efi-temp/EFI/boot/*.efi \ | |
257 | "::EFI/boot" | |
258 | ||
259 | if [ -d ${_CHROOT_DIR}/grub-efi-temp/EFI/debian ]; then | |
260 | mmd -i "${_CHROOT_DIR}/grub-efi-temp/boot/grub/efi.img" ::EFI/debian | |
261 | mcopy -o -i "${_CHROOT_DIR}/grub-efi-temp/boot/grub/efi.img" \ | |
262 | ${_CHROOT_DIR}/grub-efi-temp-cfg/grub.cfg "::EFI/debian" | |
263 | fi | |
264 | ||
265 | mmd -i "${_CHROOT_DIR}/grub-efi-temp/boot/grub/efi.img" ::boot | |
266 | mmd -i "${_CHROOT_DIR}/grub-efi-temp/boot/grub/efi.img" ::boot/grub | |
267 | mcopy -o -i "${_CHROOT_DIR}/grub-efi-temp/boot/grub/efi.img" ${_CHROOT_DIR}/grub-efi-temp-cfg/grub.cfg \ | |
268 | "::boot/grub" | |
137 | 269 | END |
138 | 270 | |
139 | 271 | case "${LB_BUILD_WITH_CHROOT}" in |
158 | 290 | # Remove unnecessary files |
159 | 291 | rm -f chroot/grub-efi-temp/bootnetia32.efi |
160 | 292 | rm -f chroot/grub-efi-temp/bootnetx64.efi |
293 | rm -f chroot/grub-efi-temp/bootnetaa64.efi | |
161 | 294 | |
162 | 295 | mkdir -p binary |
163 | 296 | cp -r chroot/grub-efi-temp/* binary/ |
164 | 297 | rm -rf chroot/grub-efi-temp-x86_64-efi |
165 | 298 | rm -rf chroot/grub-efi-temp-i386-efi |
299 | rm -rf chroot/grub-efi-temp-arm64-efi | |
300 | rm -rf chroot/grub-efi-temp-cfg | |
166 | 301 | rm -rf chroot/grub-efi-temp |
167 | 302 | |
168 | 303 | # We rely on: binary_loopback_cfg to generate grub.cfg and other configuration files |
49 | 49 | ;; |
50 | 50 | |
51 | 51 | ntfs) |
52 | Check_package chroot /sbin/mkfs.nfts ntfs-3g | |
52 | Check_package chroot /sbin/mkfs.ntfs ntfs-3g | |
53 | 53 | ;; |
54 | 54 | esac |
55 | 55 |
98 | 98 | local LABEL="${1}" |
99 | 99 | local AMD64_KERNEL="${2}" |
100 | 100 | local AMD64_INITRD="${3}" |
101 | local _486_KERNEL="${4}" | |
102 | local _486_INITRD="${5}" | |
101 | local _686_KERNEL="${4}" | |
102 | local _686_INITRD="${5}" | |
103 | 103 | local APPEND="${6}" |
104 | 104 | cat <<END |
105 | 105 | # Autodetect if amd64 is supported |
108 | 108 | linux ${AMD64_KERNEL} ${APPEND} |
109 | 109 | initrd ${AMD64_INITRD} |
110 | 110 | else |
111 | linux ${_486_KERNEL} ${APPEND} | |
112 | initrd ${_486_INITRD} | |
111 | linux ${_686_KERNEL} ${APPEND} | |
112 | initrd ${_686_INITRD} | |
113 | 113 | fi |
114 | 114 | } |
115 | 115 | END |
177 | 177 | APPEND_LIVE="${LB_BOOTAPPEND_LIVE}" |
178 | 178 | |
179 | 179 | # Assembling kernel configuration |
180 | _AMD64_486_NUMBER="0" | |
180 | _AMD64_686_NUMBER="0" | |
181 | 181 | |
182 | 182 | for _FLAVOUR in ${LB_LINUX_FLAVOURS} |
183 | 183 | do |
184 | if [ "${_FLAVOUR}" = "amd64" -o "${_FLAVOUR}" = "486" ] ; then | |
185 | _AMD64_486_NUMBER="$((${_AMD64_486_NUMBER} + 1))" | |
184 | if [ "${_FLAVOUR}" = "amd64" -o "${_FLAVOUR}" = "686" ] ; then | |
185 | _AMD64_686_NUMBER="$((${_AMD64_686_NUMBER} + 1))" | |
186 | 186 | fi |
187 | 187 | done |
188 | 188 | |
189 | if [ "${_AMD64_486_NUMBER}" -ge 2 ] ; then | |
189 | if [ "${_AMD64_686_NUMBER}" -ge 2 ] ; then | |
190 | 190 | # Default entries |
191 | 191 | AMD64_KERNEL="$(basename chroot/boot/vmlinuz-*amd64)" |
192 | 192 | AMD64_INITRD="initrd.img-$(echo ${AMD64_KERNEL} | sed -e 's|vmlinuz-||')" |
193 | _486_KERNEL="$(basename chroot/boot/vmlinuz-*486)" | |
194 | _486_INITRD="initrd.img-$(echo ${_486_KERNEL} | sed -e 's|vmlinuz-||')" | |
193 | _686_KERNEL="$(basename chroot/boot/vmlinuz-*686)" | |
194 | _686_INITRD="initrd.img-$(echo ${_686_KERNEL} | sed -e 's|vmlinuz-||')" | |
195 | 195 | |
196 | 196 | Grub_live_autodetect_entry "Live system (autodetect)" \ |
197 | 197 | "/${INITFS}/${AMD64_KERNEL}" \ |
198 | 198 | "/${INITFS}/${AMD64_INITRD}" \ |
199 | "/${INITFS}/${_486_KERNEL}" \ | |
200 | "/${INITFS}/${_486_INITRD}" \ | |
201 | "$APPEND_LIVE" | |
199 | "/${INITFS}/${_686_KERNEL}" \ | |
200 | "/${INITFS}/${_686_INITRD}" \ | |
201 | "${APPEND_LIVE}" | |
202 | ||
203 | if [ "${LB_BOOTAPPEND_LIVE_FAILSAFE}" != "none" ] | |
204 | then | |
205 | Grub_live_autodetect_entry "Live system (autodetect) (fail-safe mode)" \ | |
206 | "/${INITFS}/${AMD64_KERNEL}" \ | |
207 | "/${INITFS}/${AMD64_INITRD}" \ | |
208 | "/${INITFS}/${_686_KERNEL}" \ | |
209 | "/${INITFS}/${_686_INITRD}" \ | |
210 | "${LB_BOOTAPPEND_LIVE_FAILSAFE}" | |
211 | fi | |
202 | 212 | else |
203 | 213 | Grub_live_entry "Live system" "/${INITFS}/${DEFAULT_KERNEL}" "/${INITFS}/${DEFAULT_INITRD}" "${APPEND_LIVE}" |
204 | fi | |
205 | ||
206 | if [ "${LB_BOOTAPPEND_LIVE_FAILSAFE}" != "none" ] | |
207 | then | |
208 | Grub_live_entry "Live system (fail-safe mode)" "/${INITFS}/${DEFAULT_KERNEL}" "/${INITFS}/${DEFAULT_INITRD}" "${LB_BOOTAPPEND_LIVE_FAILSAFE}" | |
214 | if [ "${LB_BOOTAPPEND_LIVE_FAILSAFE}" != "none" ] | |
215 | then | |
216 | Grub_live_entry "Live system (fail-safe mode)" "/${INITFS}/${DEFAULT_KERNEL}" "/${INITFS}/${DEFAULT_INITRD}" "${LB_BOOTAPPEND_LIVE_FAILSAFE}" | |
217 | fi | |
209 | 218 | fi |
210 | 219 | |
211 | 220 | _COUNT=0 |
212 | 221 | for KERNEL in chroot/boot/vmlinuz-*; do |
213 | _COUNT=$(( $COUNT + 1 )) | |
222 | _COUNT=$(( $_COUNT + 1 )) | |
214 | 223 | done |
215 | 224 | |
216 | 225 | if [ $_COUNT -gt 1 ]; then |
0 | #!/bin/sh | |
1 | ||
2 | ## live-build(7) - System Build Scripts | |
3 | ## Copyright (C) 2017 Erik Ziegenbalg <[email protected]> | |
4 | ## Copyright (C) 2018 Luca Boccassi <[email protected]> | |
5 | ## | |
6 | ## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING. | |
7 | ## This is free software, and you are welcome to redistribute it | |
8 | ## under certain conditions; see COPYING for details. | |
9 | ||
10 | ||
11 | set -e | |
12 | ||
13 | # Including common functions | |
14 | [ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh | |
15 | ||
16 | # Setting static variables | |
17 | DESCRIPTION="$(Echo 'build ONIE binary image')" | |
18 | HELP="" | |
19 | USAGE="${PROGRAM} [--force]" | |
20 | ||
21 | Arguments "${@}" | |
22 | ||
23 | # Reading configuration files | |
24 | Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source | |
25 | Set_defaults | |
26 | ||
27 | if [ "${LB_ONIE}" != "true" ] | |
28 | then | |
29 | exit 0 | |
30 | fi | |
31 | ||
32 | case "${LIVE_IMAGE_TYPE}" in | |
33 | iso) | |
34 | IMAGE="${LIVE_IMAGE_NAME}-${LB_ARCHITECTURES}.iso" | |
35 | ;; | |
36 | iso-hybrid) | |
37 | IMAGE="${LIVE_IMAGE_NAME}-${LB_ARCHITECTURES}.hybrid.iso" | |
38 | ;; | |
39 | *) | |
40 | exit 0 | |
41 | ;; | |
42 | esac | |
43 | ||
44 | Echo_message "Begin building onie binary..." | |
45 | ||
46 | # Requiring stage file | |
47 | Require_stagefile .build/config .build/binary_iso | |
48 | ||
49 | # Checking stage file | |
50 | Check_stagefile .build/binary_onie | |
51 | ||
52 | # Checking lock file | |
53 | Check_lockfile .lock | |
54 | ||
55 | # Creating lock file | |
56 | Create_lockfile .lock | |
57 | ||
58 | Check_package host /bin/cpio cpio | |
59 | Check_package host /usr/bin/file file | |
60 | Check_package host /usr/bin/sha1sum coreutils | |
61 | Check_package host /bin/zcat gzip | |
62 | Check_package host /bin/gzip gzip | |
63 | Check_package host /usr/bin/xzcat xz-utils | |
64 | Check_package host /usr/bin/xz xz-utils | |
65 | Check_package host /bin/bzcat bzip2 | |
66 | Check_package host /bin/bzip2 bzip2 | |
67 | ||
68 | ### Adds needed helper script | |
69 | ## Based on https://github.com/opencomputeproject/onie/blob/master/contrib/debian-iso/sharch_body.sh | |
70 | cat > sharch_body.sh << EOF | |
71 | #!/bin/sh | |
72 | ||
73 | # | |
74 | # Copyright (C) 2015 Curt Brune <[email protected]> | |
75 | # | |
76 | # SPDX-License-Identifier: GPL-2.0 | |
77 | # | |
78 | ||
79 | # | |
80 | # Shell archive template | |
81 | # | |
82 | # Strings of the form %%VAR%% are replaced during construction. | |
83 | # | |
84 | ||
85 | echo -n "Verifying image checksum ..." | |
86 | sha1=\$(sed -e '1,/^exit_marker$/d' "\$0" | sha1sum | awk '{ print \$1 }') | |
87 | ||
88 | payload_sha1=%%IMAGE_SHA1%% | |
89 | ||
90 | if [ "\$sha1" != "\$payload_sha1" ] ; then | |
91 | echo | |
92 | echo "ERROR: Unable to verify archive checksum" | |
93 | echo "Expected: \$payload_sha1" | |
94 | echo "Found : \$sha1" | |
95 | exit 1 | |
96 | fi | |
97 | ||
98 | echo " OK." | |
99 | ||
100 | tmp_dir= | |
101 | clean_up() { | |
102 | if [ "\$(id -u)" = "0" ] ; then | |
103 | umount \$tmp_dir > /dev/null 2>&1 | |
104 | fi | |
105 | rm -rf \$tmp_dir | |
106 | exit \$1 | |
107 | } | |
108 | ||
109 | # Untar and launch install script in a tmpfs | |
110 | cur_wd=\$(pwd) | |
111 | archive_path=\$(realpath "\$0") | |
112 | tmp_dir=\$(mktemp -d) | |
113 | if [ "\$(id -u)" = "0" ] ; then | |
114 | mount -t tmpfs tmpfs-installer \$tmp_dir || clean_up 1 | |
115 | fi | |
116 | cd \$tmp_dir | |
117 | echo -n "Preparing image archive ..." | |
118 | sed -e '1,/^exit_marker\$/d' \$archive_path | tar xf - || clean_up 1 | |
119 | echo " OK." | |
120 | cd \$cur_wd | |
121 | ||
122 | extract=no | |
123 | args=":x" | |
124 | while getopts "\$args" a ; do | |
125 | case \$a in | |
126 | x) | |
127 | extract=yes | |
128 | ;; | |
129 | *) | |
130 | ;; | |
131 | esac | |
132 | done | |
133 | ||
134 | if [ "\$extract" = "yes" ] ; then | |
135 | # stop here | |
136 | echo "Image extracted to: \$tmp_dir" | |
137 | if [ "\$(id -u)" = "0" ] ; then | |
138 | echo "To un-mount the tmpfs when finished type: umount \$tmp_dir" | |
139 | fi | |
140 | exit 0 | |
141 | fi | |
142 | ||
143 | \$tmp_dir/installer/install.sh "\$@" | |
144 | rc="\$?" | |
145 | ||
146 | clean_up \$rc | |
147 | ||
148 | exit_marker | |
149 | EOF | |
150 | ||
151 | ||
152 | ### Based on onie cookbits script... | |
153 | ### https://github.com/opencomputeproject/onie/blob/master/contrib/debian-iso/cook-bits.sh | |
154 | ||
155 | CURDIR=`pwd` | |
156 | OUT=${CURDIR}/output | |
157 | rm -rf $OUT | |
158 | mkdir -p $OUT | |
159 | ||
160 | WORKDIR=${CURDIR}/work | |
161 | EXTRACTDIR="$WORKDIR/extract" | |
162 | INSTALLDIR="$WORKDIR/installer" | |
163 | ||
164 | IN_IMAGE="${IMAGE}" | |
165 | ||
166 | output_file="${OUT}/${IN_IMAGE}-ONIE.bin" | |
167 | ||
168 | echo "Creating $output_file:" | |
169 | ||
170 | # prepare workspace | |
171 | [ -d $EXTRACTDIR ] && chmod +w -R $EXTRACTDIR | |
172 | rm -rf $WORKDIR | |
173 | mkdir -p $EXTRACTDIR | |
174 | mkdir -p $INSTALLDIR | |
175 | ||
176 | # Link the iso binary root to the onie extract dir | |
177 | ln -s ${CURDIR}/binary/* ${EXTRACTDIR} | |
178 | echo -n "." | |
179 | ||
180 | ## pack ISO into initrd | |
181 | # create initrd working dir | |
182 | INITDIR=${WORKDIR}/initrd-extract | |
183 | rm -rf ${INITDIR} | |
184 | mkdir -p ${INITDIR} | |
185 | cd ${INITDIR} | |
186 | # extract current initrd | |
187 | case $(file --brief --mime --dereference $EXTRACTDIR/live/initrd.img | \ | |
188 | sed "s/application\/\(.*\);.*/\1/") in | |
189 | gzip) | |
190 | UNCOMPRESS="zcat" | |
191 | COMPRESS="gzip" | |
192 | ;; | |
193 | x-xz) | |
194 | UNCOMPRESS="xzcat" | |
195 | COMPRESS="xz --check=crc32" | |
196 | ;; | |
197 | x-bzip2) | |
198 | UNCOMPRESS="bzcat" | |
199 | COMPRESS="bzip2" | |
200 | ;; | |
201 | x-lzma) | |
202 | UNCOMPRESS="lzcat --suffix \"\"" | |
203 | COMPRESS="lzma" | |
204 | ;; | |
205 | octet-stream) | |
206 | UNCOMPRESS="cat" | |
207 | COMPRESS="cat" | |
208 | ;; | |
209 | *) | |
210 | echo "ERROR: Unable to detect initrd compression format." | |
211 | exit 1 | |
212 | ;; | |
213 | esac | |
214 | ||
215 | $UNCOMPRESS $EXTRACTDIR/live/initrd.img | cpio -d -i -m | |
216 | echo -n "." | |
217 | # copy inputed iso into initrd | |
218 | cp "${CURDIR}/${IN_IMAGE}" ./conf/live.iso | |
219 | echo -n "." | |
220 | # repack | |
221 | find . | cpio -o -H newc | $COMPRESS > ${WORKDIR}/initrd.img | |
222 | # cd back into root dir | |
223 | cd ${CURDIR} | |
224 | echo -n "." | |
225 | ||
226 | KERNEL='vmlinuz' | |
227 | IN_KERNEL=$EXTRACTDIR/live/$KERNEL | |
228 | [ -r $IN_KERNEL ] || { | |
229 | echo "ERROR: Unable to find kernel in ISO: $IN_KERNEL" | |
230 | exit 1 | |
231 | } | |
232 | INITRD='initrd.img' | |
233 | IN_INITRD=$WORKDIR/$INITRD | |
234 | [ -r $IN_INITRD ] || { | |
235 | echo "ERROR: Unable to find initrd in ISO: $IN_INITRD" | |
236 | exit 1 | |
237 | } | |
238 | ||
239 | # Note: specify kernel args you want the Debian installer to | |
240 | # automatically append by putting them after the special marker "---". | |
241 | # Here we want the Deb installer to auto include the serial console | |
242 | # parameters. | |
243 | # The minimal required parameters are included by default, and users | |
244 | # can add more depending on what they need, eg: systemd parameters. | |
245 | KERNEL_ARGS="--- boot=live nopersistent noeject dhcp fromiso=/conf/live.iso" | |
246 | KERNEL_ARGS="${KERNEL_ARGS} ${LB_ONIE_KERNEL_CMDLINE}" | |
247 | ||
248 | # To debug DI preseed file add these args | |
249 | # DI_DEBUG_ARGS="DEBCONF_DEBUG=5 dbg/flags=all-x" | |
250 | ||
251 | # Debian installer args | |
252 | DI_ARGS="auto=true priority=critical $DI_DEBUG_ARGS" | |
253 | ||
254 | cp -r $IN_KERNEL $IN_INITRD $INSTALLDIR | |
255 | ||
256 | # Create custom install.sh script | |
257 | touch $INSTALLDIR/install.sh | |
258 | chmod +x $INSTALLDIR/install.sh | |
259 | ||
260 | (cat <<EOF | |
261 | #!/bin/sh | |
262 | ||
263 | cd \$(dirname \$0) | |
264 | ||
265 | # remove old partitions | |
266 | for p in \$(seq 3 9) ; do | |
267 | sgdisk -d \$p /dev/vda > /dev/null 2&>1 | |
268 | done | |
269 | ||
270 | # bonk out on errors | |
271 | set -e | |
272 | ||
273 | echo "auto-detecting console..." | |
274 | tty=\$(cat /sys/class/tty/console/active 2>/dev/null | awk 'END {print \$NF}') | |
275 | speed=\$(stty -F /dev/\$tty speed 2>/dev/null) | |
276 | bits=\$(stty -F /dev/\$tty -a 2>/dev/null | grep -o cs[5-8]) | |
277 | bits=\$(echo \$bits | grep -o [5-8]) | |
278 | ||
279 | con='' | |
280 | if [ -n "\$speed" ]; then | |
281 | con="console=\$tty,\${speed}n\${bits}" | |
282 | else | |
283 | con="console=\$tty" | |
284 | fi | |
285 | ||
286 | echo "using \$con" | |
287 | ||
288 | kcmd_console=\$(cat /proc/cmdline | grep -o 'console=.* ') | |
289 | kcmd_console=\$(echo \$kcmd_console | cut -d' ' -f2) # remove tty0 | |
290 | ||
291 | if [ \${kcmd_console}x != \${con}x ]; then | |
292 | echo "WARNING: Detected console does not match boot console: \$kcmd_console != \$con" | |
293 | fi | |
294 | ||
295 | echo "Loading new kernel ..." | |
296 | echo "kexec --load --initrd=$INITRD --append=\"$DI_ARGS $KERNEL_ARGS \$con\" $KERNEL" | |
297 | kexec --load --initrd=$INITRD --append="$DI_ARGS $KERNEL_ARGS \$con" $KERNEL | |
298 | kexec --exec | |
299 | ||
300 | EOF | |
301 | ) >> $INSTALLDIR/install.sh | |
302 | echo -n "." | |
303 | ||
304 | # Repackage $INSTALLDIR into a self-extracting installer image | |
305 | sharch="$WORKDIR/sharch.tar" | |
306 | tar -C $WORKDIR -cf $sharch installer || { | |
307 | echo "Error: Problems creating $sharch archive" | |
308 | exit 1 | |
309 | } | |
310 | ||
311 | [ -f "$sharch" ] || { | |
312 | echo "Error: $sharch not found" | |
313 | exit 1 | |
314 | } | |
315 | echo -n "." | |
316 | ||
317 | sha1=$(cat $sharch | sha1sum | awk '{print $1}') | |
318 | echo -n "." | |
319 | ||
320 | cp sharch_body.sh $output_file || { | |
321 | echo "Error: Problems copying sharch_body.sh" | |
322 | exit 1 | |
323 | } | |
324 | ||
325 | # Replace variables in the sharch template | |
326 | sed -i -e "s/%%IMAGE_SHA1%%/$sha1/" $output_file | |
327 | echo -n "." | |
328 | cat $sharch >> $output_file | |
329 | mv $output_file ${CURDIR} | |
330 | rm -rf $tmp_dir | |
331 | rm -rf $OUT $WORKDIR | |
332 | echo " Done." | |
333 | ls -la $(basename $output_file) | |
334 | Echo_message "onie-installer created..." | |
335 | ||
336 | # Creating stage file | |
337 | Create_stagefile .build/binary_onie |
351 | 351 | fi |
352 | 352 | |
353 | 353 | # Create image |
354 | Chroot chroot "mksquashfs chroot filesystem.squashfs ${MKSQUASHFS_OPTIONS}" | |
354 | Chroot chroot "nice -n 19 mksquashfs chroot filesystem.squashfs ${MKSQUASHFS_OPTIONS}" | |
355 | 355 | |
356 | 356 | rm -f chroot/chroot/excludes |
357 | 357 | |
412 | 412 | MKSQUASHFS_OPTIONS="${MKSQUASHFS_OPTIONS} -wildcards -ef config/rootfs/excludes" |
413 | 413 | fi |
414 | 414 | |
415 | mksquashfs chroot binary/${INITFS}/filesystem.squashfs ${MKSQUASHFS_OPTIONS} | |
415 | nice -n 19 mksquashfs chroot binary/${INITFS}/filesystem.squashfs ${MKSQUASHFS_OPTIONS} | |
416 | 416 | |
417 | 417 | du -B 1 -s chroot | cut -f1 > binary/${INITFS}/filesystem.size |
418 | 418 | ;; |
61 | 61 | then |
62 | 62 | # Modify archive areas to remove leading/trailing whitespaces and replace other whitepspace with commas |
63 | 63 | DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --components=$(echo ${LB_ARCHIVE_AREAS} | sed -e 's| |,|g')" |
64 | FOREIGN_DEBOOTSTRAP_OPTIONS="--components=$(echo ${LB_ARCHIVE_AREAS} | sed -e 's| |,|g')" | |
65 | 64 | fi |
66 | 65 | |
67 | 66 | if [ "${_VERBOSE}" = "true" ] |
107 | 106 | DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --exclude=$(echo ${LB_BOOTSTRAP_QEMU_EXCLUDE} | sed 's| *|,|g')" |
108 | 107 | fi |
109 | 108 | |
110 | Echo_message "Bootstrap will be foreign" | |
111 | debootstrap ${DEBOOTSTRAP_OPTIONS} --foreign "${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" ${DEBOOTSTRAP_SCRIPT} | |
112 | ||
113 | Echo_message "Running debootstrap second stage under QEMU" | |
114 | cp ${LB_BOOTSTRAP_QEMU_STATIC} chroot/usr/bin | |
115 | Chroot chroot /bin/sh /debootstrap/debootstrap --second-stage ${FOREIGN_DEBOOTSTRAP_OPTIONS} | |
109 | Echo_message "Running debootstrap with qemu-debootstrap" | |
110 | qemu-debootstrap ${DEBOOTSTRAP_OPTIONS} "${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" ${DEBOOTSTRAP_SCRIPT} | |
116 | 111 | else |
117 | 112 | debootstrap ${DEBOOTSTRAP_OPTIONS} "${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" ${DEBOOTSTRAP_SCRIPT} |
118 | 113 | fi |
77 | 77 | true) |
78 | 78 | echo "APT::Get::AllowUnauthenticated \"false\";" > chroot/etc/apt/apt.conf.d/00secure |
79 | 79 | echo "Aptitude::CmdLine::Ignore-Trust-Violations \"false\";" >> chroot/etc/apt/apt.conf.d/00secure |
80 | echo "Acquire::AllowInsecureRepositories \"false\";" >> chroot/etc/apt/apt.conf.d/00secure | |
80 | 81 | ;; |
81 | 82 | |
82 | 83 | false) |
83 | 84 | echo "APT::Get::AllowUnauthenticated \"true\";" > chroot/etc/apt/apt.conf.d/00secure |
84 | 85 | echo "Aptitude::CmdLine::Ignore-Trust-Violations \"true\";" >> chroot/etc/apt/apt.conf.d/00secure |
86 | echo "Acquire::AllowInsecureRepositories \"true\";" >> chroot/etc/apt/apt.conf.d/00secure | |
85 | 87 | ;; |
86 | 88 | esac |
87 | 89 |
448 | 448 | mv chroot/etc/apt/sources.list.d/zz-sources.list chroot/etc/apt/sources.list |
449 | 449 | fi |
450 | 450 | |
451 | # Unmount local repository | |
452 | if echo "${LB_PARENT_MIRROR_CHROOT}" | grep -q '^file:/' | |
453 | then | |
454 | Chroot_unbind_path chroot "$(echo ${LB_PARENT_MIRROR_CHROOT} | sed -e 's|file:||')" | |
455 | fi | |
456 | ||
457 | 451 | # Configure generic indices |
458 | 452 | # Cleaning apt list cache |
459 | 453 | rm -rf chroot/var/lib/apt/lists |
651 | 645 | # Updating indices |
652 | 646 | Apt chroot update |
653 | 647 | |
648 | # Unmount local repository - after apt update or it will fail due to missing files | |
649 | if echo "${LB_PARENT_MIRROR_CHROOT}" | grep -q '^file:/' | |
650 | then | |
651 | Chroot_unbind_path chroot "$(echo ${LB_PARENT_MIRROR_CHROOT} | sed -e 's|file:||')" | |
652 | fi | |
653 | ||
654 | 654 | # Cleaning apt package cache |
655 | 655 | rm -rf chroot/var/cache/apt |
656 | 656 | mkdir -p chroot/var/cache/apt/archives/partial |
58 | 58 | |
59 | 59 | # Removing local preseed file |
60 | 60 | rm -f chroot/root/preseed |
61 | ||
62 | # After preseeding debconf, reconfigure packages that have already | |
63 | # been installed in the debootstrap phase. | |
64 | # Strip comments and empty lines and take first column (pkg name). | |
65 | sed -e 's/[[:space:]]*#.*//' -e '/^[[:space:]]*$/d' \ | |
66 | -e 's/[[:space:]].*//g' "${PRESEED}" | \ | |
67 | while read PKG | |
68 | do | |
69 | # Don't know the filename, but we want to query only dpkg | |
70 | Check_installed chroot "placeholder" "${PKG}" | |
71 | if [ ${INSTALL_STATUS} -eq 0 ] | |
72 | then | |
73 | Chroot chroot "dpkg-reconfigure ${PKG}" | |
74 | fi | |
75 | done | |
61 | 76 | fi |
62 | 77 | done |
63 | 78 |
104 | 104 | \t [--net-cow-path PATH]\n\ |
105 | 105 | \t [--net-cow-server IP|HOSTNAME]\n\ |
106 | 106 | \t [--net-tarball true|false]\n\ |
107 | \t [--onie true|false]\n\ | |
108 | \t [--onie-kernel-cmdline \"OPTION1 OPTION2\"]\n\ | |
107 | 109 | \t [--quiet]\n\ |
108 | 110 | \t [--archive-areas ARCHIVE_AREA|\"ARCHIVE_AREAS\"]\n\ |
109 | 111 | \t [--parent-archive-areas ARCHIVE_AREA|\"ARCHIVE_AREAS\"]\n\ |
115 | 117 | \t [--swap-file-path PATH]\n\ |
116 | 118 | \t [--swap-file-size MB]\n\ |
117 | 119 | \t [--tasksel apt|aptitude|tasksel]\n\ |
120 | \t [--uefi-secure-boot auto|enable|disable]\n\ | |
118 | 121 | \t [--updates true|false]\n\ |
119 | 122 | \t [--backports true|false]\n\ |
120 | 123 | \t [--verbose]\n\ |
144 | 147 | grub-splash:,isohybrid-options:,hdd-label:,hdd-size:,hdd-partition-start:,iso-application:,iso-preparer:,iso-publisher:, |
145 | 148 | iso-volume:,jffs2-eraseblock:,memtest:,net-root-filesystem:,net-root-mountoptions:, |
146 | 149 | net-root-path:,net-root-server:,net-cow-filesystem:,net-cow-mountoptions:,net-cow-path:, |
147 | net-cow-server:,net-tarball:,firmware-binary:,firmware-chroot:,swap-file-path:,swap-file-size:, | |
150 | net-cow-server:,net-tarball:,onie:,onie-kernel-cmdline:,firmware-binary:,firmware-chroot:,swap-file-path:,swap-file-size:, | |
148 | 151 | loadlin:,win32-loader:,source:,source-images:,breakpoints,conffile:,debug,force, |
149 | 152 | help,ignore-system-defaults,quiet,usage,verbose,version,bootstrap-qemu-static:,bootstrap-qemu-arch:, |
153 | uefi-secure-boot:, | |
150 | 154 | bootstrap-qemu-exclude:" |
151 | 155 | # Remove spaces added by indentation |
152 | 156 | LONG_OPTIONS="$(echo ${LONG_OPTIONS} | tr -d ' ')" |
653 | 657 | shift 2 |
654 | 658 | ;; |
655 | 659 | |
660 | --onie) | |
661 | LB_ONIE="${2}" | |
662 | shift 2 | |
663 | ;; | |
664 | ||
665 | --onie-kernel-cmdline) | |
666 | LB_ONIE_KERNEL_CMDLINE="${2}" | |
667 | shift 2 | |
668 | ;; | |
669 | ||
656 | 670 | --firmware-binary) |
657 | 671 | LB_FIRMWARE_BINARY="${2}" |
658 | 672 | shift 2 |
670 | 684 | |
671 | 685 | --swap-file-size) |
672 | 686 | LB_SWAP_FILE_SIZE="${2}" |
687 | shift 2 | |
688 | ;; | |
689 | ||
690 | --uefi-secure-boot) | |
691 | LB_UEFI_SECURE_BOOT="${2}" | |
673 | 692 | shift 2 |
674 | 693 | ;; |
675 | 694 | |
1283 | 1302 | # (Default: ${LB_NET_TARBALL}) |
1284 | 1303 | LB_NET_TARBALL="${LB_NET_TARBALL}" |
1285 | 1304 | |
1305 | # \$LB_ONIE: set onie | |
1306 | # (Default: ${LB_ONIE}) | |
1307 | LB_ONIE="${LB_ONIE}" | |
1308 | ||
1309 | # \$LB_ONIE_KERNEL_CMDLINE: set onie additional kernel cmdline options | |
1310 | # (Default: ${LB_ONIE_KERNEL_CMDLINE}) | |
1311 | LB_ONIE_KERNEL_CMDLINE="${LB_ONIE_KERNEL_CMDLINE}" | |
1312 | ||
1286 | 1313 | # \$LB_FIRMWARE_BINARY: include firmware packages in debian-installer |
1287 | 1314 | # (Default: ${LB_FIRMWARE_BINARY}) |
1288 | 1315 | LB_FIRMWARE_BINARY="${LB_FIRMWARE_BINARY}" |
1298 | 1325 | # \$LB_SWAP_FILE_SIZE: set swap file size |
1299 | 1326 | # (Default: ${LB_SWAP_FILE_SIZE}) |
1300 | 1327 | LB_SWAP_FILE_SIZE="${LB_SWAP_FILE_SIZE}" |
1328 | ||
1329 | # \$LB_UEFI_SECURE_BOOT: enable/disable UEFI secure boot | |
1330 | # (Default: ${LB_UEFI_SECURE_BOOT}) | |
1331 | LB_UEFI_SECURE_BOOT="${LB_UEFI_SECURE_BOOT}" | |
1301 | 1332 | EOF |
1302 | 1333 | |
1303 | 1334 | # Creating lb_source_* configuration |