live-build/scripts/build/config

1397 lines
33 KiB
Plaintext
Raw Normal View History

2007-09-23 08:04:40 +00:00
#!/bin/sh
## live-build(7) - System Build Scripts
## Copyright (C) 2016-2020 The Debian Live team
## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
##
## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
## This is free software, and you are welcome to redistribute it
## under certain conditions; see COPYING for details.
2007-09-23 08:04:46 +00:00
set -e
# Including common functions
[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
2007-09-23 08:05:11 +00:00
# Setting static variables
PROGRAM="lb config"
DESCRIPTION="Create configuration for live-build(7)"
USAGE="${PROGRAM} [--apt apt|apt-get|aptitude]\n\
2007-09-23 08:05:19 +00:00
\t [--apt-ftp-proxy URL]\n\
\t [--apt-http-proxy URL]\n\
\t [--apt-indices true|false]\n\
\t [--apt-options OPTION|\"OPTIONS\"]\n\
\t [--apt-pipeline DEPTH]\n\
\t [--apt-recommends true|false]\n\
\t [--apt-secure true|false]\n\
\t [--apt-source-archives true|false]\n\
\t [--aptitude-options OPTION|\"OPTIONS\"]\n\
\t [-a|--architecture ARCHITECTURE]\n\
\t [--archive-areas ARCHIVE_AREA|\"ARCHIVE_AREAS\"]\n\
\t [--backports true|false]\n\
\t [--binary-filesystem fat16|fat32|ext2|ext3|ext4|ntfs]\n\
\t [-b|--binary-image iso|iso-hybrid|netboot|tar|hdd]\n\
2007-09-23 12:05:12 +00:00
\t [--bootappend-install PARAMETER|\"PARAMETERS\"]\n\
\t [--bootappend-live PARAMETER|\"PARAMETERS\"]\n\
\t [--bootappend-live-failsafe PARAMETER|\"PARAMETERS\"]\n\
\t [--bootloaders grub-legacy|grub-pc|syslinux|grub-efi|\"BOOTLOADERS\"]\n\
\t [--bootstrap-qemu-arch ARCH]\n\
\t [--bootstrap-qemu-exclude PACKAGE|\"PACKAGES\"]\n\
\t [--bootstrap-qemu-static PATH]\n\
\t [--breakpoints]\n\
\t [--build-with-chroot true|false]\n\
\t [--cache true|false]\n\
\t [--cache-indices true|false]\n\
\t [--cache-packages true|false]\n\
2007-09-23 08:05:19 +00:00
\t [--cache-stages STAGE|\"STAGES\"]\n\
\t [--checksums md5|sha1|sha224|sha256|sha384|sha512|none]\n\
\t [--chroot-filesystem ext2|ext3|ext4|squashfs|jffs2|none]\n\
\t [--clean]\n\
\t [--color]\n\
\t [--compression bzip2|gzip|lzip|xz|none]\n\
\t [-c|--conffile FILE]\n\
\t [--config GIT_URL::GIT_BRANCH]\n\
2007-09-23 08:05:19 +00:00
\t [--debconf-frontend dialog|editor|noninteractive|readline]\n\
\t [--debconf-priority low|medium|high|critical]\n\
\t [--debian-installer cdrom|netinst|netboot|businesscard|live|none]\n\
\t [--debian-installer-distribution daily|CODENAME]\n\
\t [--debian-installer-gui true|false]\n\
\t [--debian-installer-preseedfile FILE|URL]\n\
\t [--debootstrap-options OPTION|\"OPTIONS\"]\n\
\t [--debootstrap-script SCRIPT]\n\
2007-09-23 08:05:19 +00:00
\t [--debug]\n\
\t [-d|--distribution CODENAME]\n\
\t [--distribution-binary CODENAME]\n\
\t [--distribution-chroot CODENAME]\n\
\t [--dump]\n\
\t [--firmware-binary true|false]\n\
\t [--firmware-chroot true|false]\n\
2007-09-23 08:05:19 +00:00
\t [--force]\n\
\t [--gzip-options OPTION|\"OPTIONS\"]\n\
\t [--hdd-label LABEL]\n\
\t [--hdd-partition-start START]\n\
\t [--hdd-size SIZE]\n\
\t [--ignore-system-defaults]\n\
\t [--image-name NAME]\n\
2019-06-12 11:55:10 +00:00
\t [--initramfs none|live-boot]\n\
\t [--initramfs-compression bzip2|gzip|lzma]\n\
\t [--initsystem sysvinit|systemd|none]\n\
\t [--interactive true|shell|x11|xnest|false]\n\
2007-09-23 08:05:19 +00:00
\t [--iso-application NAME]\n\
\t [--iso-preparer NAME]\n\
\t [--iso-publisher NAME]\n\
\t [--iso-volume NAME]\n\
\t [--jffs2-eraseblock SIZE]\n\
2007-09-23 08:05:19 +00:00
\t [--keyring-packages PACKAGE|\"PACKAGES\"]\n\
\t [-k|--linux-flavours FLAVOUR|\"FLAVOURS\"]\n\
\t [--linux-packages PACKAGE|\"PACKAGES\"]\n\
\t [--loadlin true|false]\n\
\t [--memtest memtest86+|memtest86|none]\n\
\t [--mirror-binary URL]\n\
\t [--mirror-binary-security URL]\n\
\t [--mirror-bootstrap URL]\n\
\t [--mirror-chroot URL]\n\
\t [--mirror-chroot-security URL]\n\
\t [--mirror-debian-installer URL]\n\
\t [--mode debian]\n\
\t [--net-root-path PATH]\n\
\t [--net-tarball true|false]\n\
\t [--no-color]\n\
Add options to build ONIE images Open Network Install Environment is an open image format used by networking vendor to ship a standardised image for networking white box switches. ONIE hardware takes this image at boot and a script to chain load into the final environment via kexec. We can support Debian and derivatives on such systems by packing an ISO which then gets unpacked, kexec'ed and live-booted. A base ONIE system can be tested in QEMU by building a VM following these instrunctions: https://github.com/opencomputeproject/onie/blob/master/machine/kvm_x86_64/INSTALL Once built, boot onie-recovery-x86_64-kvm_x86_64-r0.iso in QEMU/libvirt and on the console there will be the terminal prompt. Check the IP assigned by libvirt and then scp the live image (ssh access is enabled as root without password...). Then the .bin can be booted with: ONIE-RECOVERY:/ # onie-nos-install /tmp/live.hybrid.iso-ONIE.bin The implementation is inspired by ONIE's own scripts that can be found at: https://github.com/opencomputeproject/onie/blob/master/contrib/debian-iso/cook-bits.sh A new option, --onie (false by default) can be set to true to enable building this new format in addition to an ISO. An additional option, --onie-kernel-cmdline can be used to specify additional options that the ONIE system should use when kexec'ing the final image. Note that only iso or hybrid-iso formats are supported. For more information about the ONIE ecosystem see: http://onie.org Signed-off-by: Erik Ziegenbalg <eziegenb@Brocade.com> Signed-off-by: Luca Boccassi <bluca@debian.org>
2018-03-16 18:30:50 -01:00
\t [--onie true|false]\n\
\t [--onie-kernel-cmdline OPTION|\"OPTIONS\"]\n\
2011-03-24 18:25:34 -01:00
\t [--parent-archive-areas ARCHIVE_AREA|\"ARCHIVE_AREAS\"]\n\
\t [--parent-debian-installer-distribution CODENAME]\n\
\t [--parent-distribution CODENAME]\n\
\t [--parent-distribution-binary CODENAME]\n\
\t [--parent-distribution-chroot CODENAME]\n\
\t [--parent-mirror-binary URL]\n\
\t [--parent-mirror-binary-security URL]\n\
\t [-m|--parent-mirror-bootstrap URL]\n\
\t [--parent-mirror-chroot URL]\n\
\t [--parent-mirror-chroot-security URL]\n\
\t [--parent-mirror-debian-installer URL]\n\
\t [--quiet]\n\
\t [--security true|false]\n\
\t [--source true|false]\n\
\t [-s|--source-images iso|netboot|tar|hdd]\n\
\t [--swap-file-path PATH]\n\
\t [--swap-file-size MB]\n\
\t [--system live|normal]\n\
UEFI: add support for Secure Boot on amd64 and arm64 Support for UEFI Secure Boot is modelled after how it currently works in Ubuntu and on how it is going to work on Debian. A minimal bootloader, shim, is used as the first-stage and it then loads grub. Both have to be signed. shim-signed is already available in Debian so the filenames are already established, and the grub2 repository and packaging is common between the 2 distros so we can already be reasonably sure of what it is going to be. So if both are available, copy /usr/lib/shim/shim[x64|aa64].efi.signed as boot[x64|aa64].efi so that UEFI loads it first, and copy /usr/lib/grub/[x86_64|arm64]-efi-signed/grub[x64|aa64].efi.signed as grub[x64|aa64].efi. This grub2 EFI monolithic image is currently hard-coded in grub2's repository to look for a config file in efi/debian, so make a copy of the previously added minimal grub.cfg that loads the real one in that directory in both the fat32 and ISO 9660 partitions. The new option --uefi-secure-boot can be set to auto (default, enable or disable. In auto, the lack of the signed EFI binaries is intentionally left as a soft failure - live-build will simply fallback to using the locally generated non-signed grub2 monolithic EFI binary as the only bootloader. Given the difficulties surrounding the Secure Boot signing infrastructure this approach gives the most flexibility and makes sure things will "just work" once the packages are available, without the need to change anything in the configuration. This will also greatly help downstream distributions and users who want to do self-signing. The enable or disable options work as expected. Closes: #821084
2018-02-27 18:28:33 -01:00
\t [--uefi-secure-boot auto|enable|disable]\n\
\t [--updates true|false]\n\
\t [--validate]\n\
\t [--verbose]\n\
\t [--win32-loader true|false]\n\
\t [--zsync true|false]"
2007-09-23 08:04:48 +00:00
2007-09-23 08:05:17 +00:00
Local_arguments ()
{
local LONG_OPTIONS
LONG_OPTIONS="
apt:,apt-ftp-proxy:,apt-http-proxy:,apt-indices:,aptitude-options:,
apt-options:,apt-pipeline:,apt-recommends:,apt-secure:,
apt-source-archives:,architecture:,architectures:,archive-areas:,
backports:,binary-filesystem:,binary-image:,binary-images:,
bootappend-install:,bootappend-live:,bootappend-live-failsafe:,
bootloader:,bootloaders:,bootstrap-qemu-arch:,bootstrap-qemu-exclude:,
bootstrap-qemu-static:,breakpoints,build-with-chroot:,
cache:,cache-indices:,cache-packages:,cache-stages:,checksums:,
chroot-filesystem:,clean,color,compression:,conffile:,config:,
debconf-frontend:,debconf-priority:,debian-installer:,
debian-installer-distribution:,debian-installer-gui:,
debian-installer-preseedfile:,debootstrap-options:,debootstrap-script:,
debug,distribution:,distribution-binary:,distribution-chroot:,dump,
fdisk:,firmware-binary:,firmware-chroot:,force,
grub-splash:,gzip-options:,
hdd-label:,hdd-partition-start:,hdd-size:,help,
ignore-system-defaults,image-name:,initramfs:,initramfs-compression:,
initsystem:,interactive:,iso-application:,isohybrid-options:,
iso-preparer:,iso-publisher:,iso-volume:,
jffs2-eraseblock:,
keyring-packages:,
linux-flavours:,linux-packages:,loadlin:,losetup:,
memtest:,mirror-binary:,mirror-binary-security:,mirror-bootstrap:,
mirror-chroot:,mirror-chroot-security:,mirror-debian-installer:,mode:,
net-cow-filesystem:,net-cow-mountoptions:,net-cow-path:,
net-cow-server:,net-root-filesystem:,net-root-mountoptions:,
net-root-path:,net-root-server:,net-tarball:,no-color,
onie:,onie-kernel-cmdline:,
parent-archive-areas:,parent-debian-installer-distribution:,
parent-distribution:,parent-distribution-binary:,
parent-distribution-chroot:,parent-mirror-binary:,
parent-mirror-binary-security:,parent-mirror-bootstrap:,
parent-mirror-chroot:,parent-mirror-chroot-security:,
parent-mirror-debian-installer:,
quiet,
security:,source:,source-images:,swap-file-path:,swap-file-size:,system:,
tasksel:,
uefi-secure-boot:,updates:,usage,
validate,verbose,version,
win32-loader:,
zsync:"
# Remove spaces added by indentation
LONG_OPTIONS="$(echo ${LONG_OPTIONS} | tr -d ' ')"
2007-09-23 08:04:48 +00:00
local ARGUMENTS
local ERR=0
ARGUMENTS="$(getopt --longoptions ${LONG_OPTIONS} --name="${PROGRAM}" --options a:d:m:k:b:s:c:huv --shell sh -- "${@}")" || ERR=$?
if [ $ERR -eq 1 ]; then
Echo_error "Invalid argument(s)"
exit 1
elif [ $ERR -ne 0 ]; then
2020-03-18 00:09:11 -01:00
Echo_error "getopt failure"
2007-09-23 08:05:17 +00:00
exit 1
2007-09-23 08:04:50 +00:00
fi
2007-09-23 08:05:17 +00:00
eval set -- "${ARGUMENTS}"
while true
do
case "${1}" in
# Config script specific options
--clean)
_CLEAN="true"
shift
;;
--config)
_CONFIG="${2}"
shift 2
;;
-c|--conffile)
_CONFFILE="${2}"
shift 2
;;
--dump)
# Dump version
local VERSION_DPKG
if [ $(which dpkg-query) ]
then
VERSION_DPKG="$(dpkg-query -f='${Version}' --show live-build)"
fi
Echo "%s: This is live-build version %s" "${0}" "${VERSION_DPKG:-${VERSION}}"
# Dump conffile contents
Print_conffiles $(Common_config_files)
# Dump contents of directories that contain text files
local DIRECTORY
for DIRECTORY in config/package-lists config/apt config/preseed config/rootfs
do
if Find_files "${DIRECTORY}"
then
Echo_file "${DIRECTORY}"/*
fi
done
# Dump directory listings of all directories under config/
for DIRECTORY in $(find config/ -mindepth 1 -maxdepth 1 -type d)
do
if Find_files "${DIRECTORY}"
then
ls -lR "${DIRECTORY}" | while read LINE
do
echo "${DIRECTORY}: ${LINE}"
done
fi
done
exit 0
;;
--ignore-system-defaults)
shift
;;
--validate)
_VALIDATE_MODE="true"
shift
;;
# General options
--breakpoints)
_BREAKPOINTS="true"
shift
;;
--color)
_COLOR="true"
shift
;;
--debug)
_DEBUG="true"
shift
;;
--force)
_FORCE="true"
shift
;;
-h|--help)
Help
shift
;;
--no-color)
_COLOR="false"
shift
;;
--quiet)
_QUIET="true"
shift
;;
-u|--usage)
Usage 0
shift
;;
--verbose)
_VERBOSE="true"
shift
;;
-v|--version)
echo "${VERSION}"
exit 0
;;
# Build config options
2007-09-23 08:05:17 +00:00
--apt)
LB_APT="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--apt-ftp-proxy)
LB_APT_FTP_PROXY="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--apt-http-proxy)
LB_APT_HTTP_PROXY="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--apt-indices)
LB_APT_INDICES="${2}"
shift 2
;;
--apt-options)
APT_OPTIONS="${2}"
shift 2
;;
2007-09-23 08:05:17 +00:00
--apt-pipeline)
LB_APT_PIPELINE="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--apt-recommends)
LB_APT_RECOMMENDS="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--apt-secure)
LB_APT_SECURE="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--apt-source-archives)
LB_APT_SOURCE_ARCHIVES="${2}"
shift 2
;;
--aptitude-options)
APTITUDE_OPTIONS="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
-a|--architecture|--architectures)
LB_ARCHITECTURE="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--archive-areas)
LB_ARCHIVE_AREAS="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--backports)
LB_BACKPORTS="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--binary-filesystem)
LB_BINARY_FILESYSTEM="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
-b|--binary-image|--binary-images)
LIVE_IMAGE_TYPE="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--bootappend-install)
LB_BOOTAPPEND_INSTALL="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--bootappend-live)
LB_BOOTAPPEND_LIVE="${2}"
shift 2
;;
--bootappend-live-failsafe)
LB_BOOTAPPEND_LIVE_FAILSAFE="${2}"
shift 2
;;
--bootloaders|--bootloader)
LB_BOOTLOADERS="${2}"
shift 2
;;
--bootstrap-qemu-arch)
LB_BOOTSTRAP_QEMU_ARCHITECTURE="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--bootstrap-qemu-exclude)
LB_BOOTSTRAP_QEMU_EXCLUDE="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--bootstrap-qemu-static)
LB_BOOTSTRAP_QEMU_STATIC="${2}"
shift 2
;;
--build-with-chroot)
LB_BUILD_WITH_CHROOT="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--cache)
LB_CACHE="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--cache-indices)
LB_CACHE_INDICES="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--cache-packages)
LB_CACHE_PACKAGES="${2}"
shift 2
;;
--cache-stages)
LB_CACHE_STAGES="${2}"
shift 2
;;
--checksums)
LB_CHECKSUMS="${2}"
shift 2
;;
--chroot-filesystem)
LB_CHROOT_FILESYSTEM="${2}"
shift 2
;;
--compression)
LB_COMPRESSION="${2}"
shift 2
;;
--debconf-frontend)
LB_DEBCONF_FRONTEND="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--debconf-priority)
LB_DEBCONF_PRIORITY="${2}"
shift 2
;;
--debian-installer)
LB_DEBIAN_INSTALLER="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--debian-installer-distribution)
LB_DEBIAN_INSTALLER_DISTRIBUTION="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--debian-installer-gui)
LB_DEBIAN_INSTALLER_GUI="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--debian-installer-preseedfile)
LB_DEBIAN_INSTALLER_PRESEEDFILE="${2}"
shift 2
;;
--debootstrap-options)
DEBOOTSTRAP_OPTIONS="${2}"
shift 2
;;
--debootstrap-script)
DEBOOTSTRAP_SCRIPT="${2}"
shift 2
;;
-d|--distribution)
LB_DISTRIBUTION="${2}"
shift 2
;;
--distribution-binary)
LB_DISTRIBUTION_BINARY="${2}"
shift 2
;;
--distribution-chroot)
LB_DISTRIBUTION_CHROOT="${2}"
shift 2
;;
--fdisk)
Echo_warning "--fdisk is an obsolete option"
shift 2
;;
--firmware-binary)
LB_FIRMWARE_BINARY="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--firmware-chroot)
LB_FIRMWARE_CHROOT="${2}"
2011-03-24 18:25:34 -01:00
shift 2
;;
--grub-splash)
Echo_warning "--grub-splash is an obsolete option"
2007-09-23 08:05:17 +00:00
shift 2
;;
--gzip-options)
GZIP_OPTIONS="${2}"
shift 2
;;
--hdd-label)
LB_HDD_LABEL="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--hdd-partition-start)
LB_HDD_PARTITION_START="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--hdd-size)
LB_HDD_SIZE="${2}"
shift 2
;;
--image-name)
LIVE_IMAGE_NAME="${2}"
shift 2
;;
--initramfs)
LB_INITRAMFS="${2}"
shift 2
;;
--initramfs-compression)
LB_INITRAMFS_COMPRESSION="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--initsystem)
LB_INITSYSTEM="${2}"
2007-09-23 12:05:12 +00:00
shift 2
;;
--interactive)
LB_INTERACTIVE="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--iso-application)
LB_ISO_APPLICATION="${2}"
shift 2
;;
--iso-preparer)
LB_ISO_PREPARER="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--iso-publisher)
LB_ISO_PUBLISHER="${2}"
shift 2
;;
--iso-volume)
LB_ISO_VOLUME="${2}"
shift 2
;;
--isohybrid-options)
Echo_warning "--isohybrid-options is an obsolete option"
shift 2
;;
--jffs2-eraseblock)
LB_JFFS2_ERASEBLOCK="${2}"
shift 2
;;
--keyring-packages)
LB_KEYRING_PACKAGES="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
-k|--linux-flavours)
LB_LINUX_FLAVOURS_WITH_ARCH="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--linux-packages)
LB_LINUX_PACKAGES="${2}"
shift 2
;;
--loadlin)
LB_LOADLIN="${2}"
shift 2
;;
--losetup)
Echo_warning "--losetup is an obsolete option"
shift 2
;;
--memtest)
LB_MEMTEST="${2}"
shift 2
;;
--mirror-binary)
LB_MIRROR_BINARY="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--mirror-binary-security)
LB_MIRROR_BINARY_SECURITY="${2}"
shift 2
;;
--mirror-bootstrap)
LB_MIRROR_BOOTSTRAP="${2}"
shift 2
;;
--mirror-chroot)
LB_MIRROR_CHROOT="${2}"
shift 2
;;
--mirror-chroot-security)
LB_MIRROR_CHROOT_SECURITY="${2}"
shift 2
;;
--mirror-debian-installer)
LB_MIRROR_DEBIAN_INSTALLER="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--mode)
LB_MODE="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--net-cow-filesystem)
Echo_warning "--net-cow-filesystem is an obsolete option"
2007-09-23 08:05:17 +00:00
shift 2
;;
--net-cow-mountoptions)
Echo_warning "--net-cow-mountoptions is an obsolete option"
2007-09-23 08:05:17 +00:00
shift 2
;;
--net-cow-path)
Echo_warning "--net-cow-path is an obsolete option"
shift 2
;;
--net-cow-server)
Echo_warning "--net-cow-server is an obsolete option"
2007-09-23 08:05:17 +00:00
shift 2
;;
--net-root-filesystem)
Echo_warning "--net-root-filesystem is an obsolete option"
2007-09-23 08:05:17 +00:00
shift 2
;;
--net-root-mountoptions)
Echo_warning "--net-root-mountoptions is an obsolete option"
2007-09-23 08:05:17 +00:00
shift 2
;;
--net-root-path)
2020-04-23 13:44:17 +00:00
Echo_warning "--net-root-path is an obsolete option"
2007-09-23 08:05:17 +00:00
shift 2
;;
--net-root-server)
Echo_warning "--net-root-server is an obsolete option"
shift 2
;;
--net-tarball)
LB_NET_TARBALL="${2}"
shift 2
;;
Add options to build ONIE images Open Network Install Environment is an open image format used by networking vendor to ship a standardised image for networking white box switches. ONIE hardware takes this image at boot and a script to chain load into the final environment via kexec. We can support Debian and derivatives on such systems by packing an ISO which then gets unpacked, kexec'ed and live-booted. A base ONIE system can be tested in QEMU by building a VM following these instrunctions: https://github.com/opencomputeproject/onie/blob/master/machine/kvm_x86_64/INSTALL Once built, boot onie-recovery-x86_64-kvm_x86_64-r0.iso in QEMU/libvirt and on the console there will be the terminal prompt. Check the IP assigned by libvirt and then scp the live image (ssh access is enabled as root without password...). Then the .bin can be booted with: ONIE-RECOVERY:/ # onie-nos-install /tmp/live.hybrid.iso-ONIE.bin The implementation is inspired by ONIE's own scripts that can be found at: https://github.com/opencomputeproject/onie/blob/master/contrib/debian-iso/cook-bits.sh A new option, --onie (false by default) can be set to true to enable building this new format in addition to an ISO. An additional option, --onie-kernel-cmdline can be used to specify additional options that the ONIE system should use when kexec'ing the final image. Note that only iso or hybrid-iso formats are supported. For more information about the ONIE ecosystem see: http://onie.org Signed-off-by: Erik Ziegenbalg <eziegenb@Brocade.com> Signed-off-by: Luca Boccassi <bluca@debian.org>
2018-03-16 18:30:50 -01:00
--onie)
LB_ONIE="${2}"
shift 2
;;
--onie-kernel-cmdline)
LB_ONIE_KERNEL_CMDLINE="${2}"
shift 2
;;
--parent-archive-areas)
LB_PARENT_ARCHIVE_AREAS="${2}"
shift 2
;;
--parent-debian-installer-distribution)
LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION="${2}"
shift 2
;;
--parent-distribution)
LB_PARENT_DISTRIBUTION="${2}"
shift 2
;;
--parent-distribution-binary)
LB_PARENT_DISTRIBUTION_BINARY="${2}"
shift 2
;;
--parent-distribution-chroot)
LB_PARENT_DISTRIBUTION_CHROOT="${2}"
UEFI: add support for Secure Boot on amd64 and arm64 Support for UEFI Secure Boot is modelled after how it currently works in Ubuntu and on how it is going to work on Debian. A minimal bootloader, shim, is used as the first-stage and it then loads grub. Both have to be signed. shim-signed is already available in Debian so the filenames are already established, and the grub2 repository and packaging is common between the 2 distros so we can already be reasonably sure of what it is going to be. So if both are available, copy /usr/lib/shim/shim[x64|aa64].efi.signed as boot[x64|aa64].efi so that UEFI loads it first, and copy /usr/lib/grub/[x86_64|arm64]-efi-signed/grub[x64|aa64].efi.signed as grub[x64|aa64].efi. This grub2 EFI monolithic image is currently hard-coded in grub2's repository to look for a config file in efi/debian, so make a copy of the previously added minimal grub.cfg that loads the real one in that directory in both the fat32 and ISO 9660 partitions. The new option --uefi-secure-boot can be set to auto (default, enable or disable. In auto, the lack of the signed EFI binaries is intentionally left as a soft failure - live-build will simply fallback to using the locally generated non-signed grub2 monolithic EFI binary as the only bootloader. Given the difficulties surrounding the Secure Boot signing infrastructure this approach gives the most flexibility and makes sure things will "just work" once the packages are available, without the need to change anything in the configuration. This will also greatly help downstream distributions and users who want to do self-signing. The enable or disable options work as expected. Closes: #821084
2018-02-27 18:28:33 -01:00
shift 2
;;
--parent-mirror-binary)
LB_PARENT_MIRROR_BINARY="${2}"
shift 2
;;
--parent-mirror-binary-security)
LB_PARENT_MIRROR_BINARY_SECURITY="${2}"
shift 2
;;
-m|--parent-mirror-bootstrap)
LB_PARENT_MIRROR_BOOTSTRAP="${2}"
shift 2
;;
--parent-mirror-chroot)
LB_PARENT_MIRROR_CHROOT="${2}"
shift 2
;;
--parent-mirror-chroot-security)
LB_PARENT_MIRROR_CHROOT_SECURITY="${2}"
shift 2
;;
--parent-mirror-debian-installer)
LB_PARENT_MIRROR_DEBIAN_INSTALLER="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--security)
LB_SECURITY="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
--source)
LB_SOURCE="${2}"
2007-09-23 08:05:17 +00:00
shift 2
;;
-s|--source-images)
LB_SOURCE_IMAGES="${2}"
shift 2
;;
--swap-file-path)
LB_SWAP_FILE_PATH="${2}"
shift 2
;;
--swap-file-size)
LB_SWAP_FILE_SIZE="${2}"
shift 2
2007-09-23 08:05:17 +00:00
;;
--system)
LB_SYSTEM="${2}"
shift 2
2007-09-23 08:05:17 +00:00
;;
--tasksel)
Echo_warning "--tasksel is an obsolete option"
shift 2
2007-09-23 08:05:17 +00:00
;;
--uefi-secure-boot)
LB_UEFI_SECURE_BOOT="${2}"
shift 2
;;
--updates)
LB_UPDATES="${2}"
shift 2
2007-09-23 08:05:17 +00:00
;;
--win32-loader)
LB_WIN32_LOADER="${2}"
shift 2
2007-09-23 08:05:17 +00:00
;;
--zsync)
LB_ZSYNC="${2}"
shift 2
2007-09-23 08:05:17 +00:00
;;
# Other
2007-09-23 08:05:17 +00:00
--)
shift
break
;;
*)
Echo_error "Internal error, unhandled option: %s" "${1}"
2007-09-23 08:05:17 +00:00
exit 1
;;
esac
done
}
2020-02-25 10:41:25 -01:00
# Processing args such that we have a value for --config if given
# We can thus momentarily print an appropriate message that we are ignoring it under certain circumstances
Local_arguments "${@}"
2020-02-25 10:41:25 -01:00
# Ignoring --config if CWD is already a git repo
# Only print warning from direct execution, not when run from auto script redirection, to avoid repetition
if [ -e .git ] && [ -n "${_CONFIG}" ]
then
if [ "${1}" != "noauto" ]
then
Echo_message "Ignoring --config ${_CONFIG}: ${PWD} is already a git repository"
fi
_CONFIG=""
fi
2020-02-25 10:41:25 -01:00
# Ignoring --config if CWD already has a config
# Only print warning from direct execution, not when run from auto script redirection, to avoid repetition
if [ -e .build/config ] && [ -n "${_CONFIG}" ]
then
if [ "${1}" != "noauto" ]
then
Echo_message "Ignoring --config ${_CONFIG}: ${PWD} is already a live-build configuration tree"
fi
_CONFIG=""
fi
2020-02-25 10:41:25 -01:00
# Otherwise, handling --config request, copying specified config
2013-05-06 12:48:46 +00:00
if [ -n "${_CONFIG}" ]
then
if [ -e "${_CONFIG}" ] || [ -e "/usr/share/live/images/${_CONFIG}" ]
then
if [ ! -e "${_CONFIG}" ] && [ -e "/usr/share/live/images/${_CONFIG}" ]
then
_CONFIG="/usr/share/live/images/${_CONFIG}"
fi
Echo_message "Copying ${_CONFIG}"
tar -C "${_CONFIG}" -c . | tar -C ./ -x
else
_GIT_REPOSITORY="$(echo ${_CONFIG} | sed -e 's|::.*$||')"
Echo_message "Cloning ${_GIT_REPOSITORY}"
git clone ${_GIT_REPOSITORY} ./
if [ "${_GIT_REPOSITORY}" != "${_CONFIG}" ]
then
_GIT_BRANCH="$(echo ${_CONFIG} | awk -F\:\: '{ print $NF }')"
Echo_message "Checking out ${_GIT_BRANCH}"
git checkout ${_GIT_BRANCH}
fi
fi
if [ -e auto/config ]
then
_EXTRA_OPTIONS="$(echo ${@} | sed -e "s|--config ${_GIT_REPOSITORY}::${_GIT_BRANCH}||g" -e "s|--config ${_GIT_REPOSITORY}||g")"
Echo_message "The following extra options specified to lb config are going to be added to auto/config: ${_EXTRA_OPTIONS}"
sed -i -e "s|\"\${@}\"|${_EXTRA_OPTIONS} \"\${@}\"|" auto/config
fi
fi
2020-02-25 10:41:25 -01:00
# "Auto" script redirection.
# Re-run via "auto" script to pick up saved command-line arguments, if not already redirected.
# See the documentation of the Maybe_auto_redirect function for more details.
if [ "${1}" = "noauto" ]; then
shift
else
Maybe_auto_redirect config
fi
2020-02-25 10:41:25 -01:00
# Reading config defaults configured at system level
if ls /etc/live/build.conf > /dev/null 2>&1 || ls /etc/live/build/* > /dev/null 2>&1
then
if In_list "--ignore-system-defaults" "${@}"
then
Echo_message "Ignoring defaults in %s" "/etc/live/build.conf"
else
Echo_message "Using defaults in %s" "/etc/live/build.conf"
Read_conffiles /etc/live/build.conf /etc/live/build/*
fi
fi
2020-02-25 10:41:25 -01:00
# Reading existing saved configuration
Read_conffiles $(Common_config_files)
2007-09-23 08:04:47 +00:00
2020-02-25 10:41:25 -01:00
# Processing arguments again to overwrite just-read previously saved settings as necessary
Local_arguments "${@}"
2020-02-25 10:41:25 -01:00
# Loading user specified saved config file if specified
if [ -n "${_CONFFILE}" ]
2007-09-23 08:05:17 +00:00
then
Read_conffiles "${_CONFFILE}"
2007-09-23 08:05:17 +00:00
fi
# Setting and validating config
Prepare_config
Validate_config
if [ "${_VALIDATE_MODE}" = "true" ]; then
Echo_message "Validation check complete! Please address any problem notices given above."
exit 0
fi
2020-02-25 10:41:25 -01:00
# Creating or updating saved config
if [ ! -e config ]
then
Echo_message "Creating config tree for a ${LB_MODE}/${LB_DISTRIBUTION_BINARY}/${LB_ARCHITECTURE} system"
mkdir config
else
Echo_message "Updating config tree for a ${LB_MODE}/${LB_DISTRIBUTION_BINARY}/${LB_ARCHITECTURE} system"
fi
# Creating live-build configuration
2007-09-23 08:05:17 +00:00
cat > config/common << EOF
# config/common - common options for live-build(7)
2007-09-23 08:04:49 +00:00
# \$LB_APT: set package manager
LB_APT="${LB_APT}"
2007-09-23 08:04:46 +00:00
# \$LB_APT_FTP_PROXY: set apt/aptitude ftp proxy
LB_APT_FTP_PROXY="${LB_APT_FTP_PROXY}"
2007-09-23 08:04:46 +00:00
# \$LB_APT_HTTP_PROXY: set apt/aptitude http proxy
LB_APT_HTTP_PROXY="${LB_APT_HTTP_PROXY}"
2007-09-23 08:04:46 +00:00
# \$LB_APT_PIPELINE: set apt/aptitude pipeline depth
LB_APT_PIPELINE="${LB_APT_PIPELINE}"
2007-09-23 08:05:11 +00:00
# \$LB_APT_RECOMMENDS: set apt/aptitude recommends
LB_APT_RECOMMENDS="${LB_APT_RECOMMENDS}"
2007-09-23 08:04:46 +00:00
# \$LB_APT_SECURE: set apt/aptitude security
LB_APT_SECURE="${LB_APT_SECURE}"
2007-09-23 08:04:48 +00:00
# \$LB_APT_SOURCE_ARCHIVES: set apt/aptitude source entries in sources.list
LB_APT_SOURCE_ARCHIVES="${LB_APT_SOURCE_ARCHIVES}"
# \$LB_CACHE: control cache
LB_CACHE="${LB_CACHE}"
2007-09-23 08:05:17 +00:00
# \$LB_CACHE_INDICES: control if downloaded package indices should be cached
LB_CACHE_INDICES="${LB_CACHE_INDICES}"
2007-09-23 08:04:52 +00:00
# \$LB_CACHE_PACKAGES: control if downloaded packages files should be cached
LB_CACHE_PACKAGES="${LB_CACHE_PACKAGES}"
2007-09-23 08:04:52 +00:00
# \$LB_CACHE_STAGES: control if completed stages should be cached
LB_CACHE_STAGES="${LB_CACHE_STAGES}"
2007-09-23 08:04:46 +00:00
# \$LB_DEBCONF_FRONTEND: set debconf(1) frontend to use
LB_DEBCONF_FRONTEND="${LB_DEBCONF_FRONTEND}"
2007-09-23 08:04:46 +00:00
# \$LB_DEBCONF_PRIORITY: set debconf(1) priority to use
LB_DEBCONF_PRIORITY="${LB_DEBCONF_PRIORITY}"
2007-09-23 08:05:10 +00:00
# \$LB_INITRAMFS: set initramfs hook
LB_INITRAMFS="${LB_INITRAMFS}"
2007-09-23 08:05:10 +00:00
# \$LB_INITRAMFS_COMPRESSION: set initramfs compression
LB_INITRAMFS_COMPRESSION="${LB_INITRAMFS_COMPRESSION}"
# \$LB_INITSYSTEM: set init system
LB_INITSYSTEM="${LB_INITSYSTEM}"
# \$LB_MODE: set distribution mode
LB_MODE="${LB_MODE}"
2007-09-23 08:05:10 +00:00
# \$LB_SYSTEM: set system type
LB_SYSTEM="${LB_SYSTEM}"
# live-build options
2007-09-23 08:04:49 +00:00
# \$_BREAKPOINTS: enable breakpoints
# If set here, overrides the command line option
#_BREAKPOINTS="${_BREAKPOINTS}"
2007-09-23 08:04:49 +00:00
# \$_DEBUG: enable debug
# If set here, overrides the command line option
#_DEBUG="${_DEBUG}"
2007-09-23 08:04:49 +00:00
# \$_COLOR: enable color
# If set here, overrides the command line option
#_COLOR="${_COLOR}"
# \$_FORCE: enable force
# If set here, overrides the command line option
#_FORCE="${_FORCE}"
2007-09-23 08:04:49 +00:00
# \$_QUIET: enable quiet
# If set here, overrides the command line option
#_QUIET="${_QUIET}"
2007-09-23 08:04:49 +00:00
# \$_VERBOSE: enable verbose
# If set here, overrides the command line option
#_VERBOSE="${_VERBOSE}"
# Internal stuff (FIXME)
APT_OPTIONS="${APT_OPTIONS}"
APTITUDE_OPTIONS="${APTITUDE_OPTIONS}"
DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS}"
DEBOOTSTRAP_SCRIPT="${DEBOOTSTRAP_SCRIPT}"
GZIP_OPTIONS="${GZIP_OPTIONS}"
ISOHYBRID_OPTIONS="${ISOHYBRID_OPTIONS}"
2007-09-23 08:04:46 +00:00
EOF
# Creating lb_bootstrap_* configuration
2007-09-23 08:05:17 +00:00
cat > config/bootstrap << EOF
# config/bootstrap - options for live-build(7), bootstrap stage
2007-09-23 08:05:10 +00:00
# \$LB_DISTRIBUTION: select distribution to use
LB_DISTRIBUTION="${LB_DISTRIBUTION}"
2007-09-23 08:05:11 +00:00
# \$LB_PARENT_DISTRIBUTION: select parent distribution to use
LB_PARENT_DISTRIBUTION="${LB_PARENT_DISTRIBUTION}"
# \$LB_DISTRIBUTION_CHROOT: select distribution to use in the chroot
LB_DISTRIBUTION_CHROOT="${LB_DISTRIBUTION_CHROOT}"
# \$LB_PARENT_DISTRIBUTION_CHROOT: select parent distribution to use in the chroot
LB_PARENT_DISTRIBUTION_CHROOT="${LB_PARENT_DISTRIBUTION_CHROOT}"
# \$LB_DISTRIBUTION_BINARY: select distribution to use in the final image
LB_DISTRIBUTION_BINARY="${LB_DISTRIBUTION_BINARY}"
# \$LB_PARENT_DISTRIBUTION_BINARY: select parent distribution to use in the final image
LB_PARENT_DISTRIBUTION_BINARY="${LB_PARENT_DISTRIBUTION_BINARY}"
# \$LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION: select parent distribution for debian-installer to use
LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION="${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}"
# \$LB_PARENT_MIRROR_BOOTSTRAP: set parent mirror to bootstrap from
LB_PARENT_MIRROR_BOOTSTRAP="${LB_PARENT_MIRROR_BOOTSTRAP}"
2007-09-23 08:05:10 +00:00
# \$LB_PARENT_MIRROR_CHROOT: set parent mirror to fetch packages from
LB_PARENT_MIRROR_CHROOT="${LB_PARENT_MIRROR_CHROOT}"
# \$LB_PARENT_MIRROR_CHROOT_SECURITY: set security parent mirror to fetch packages from
LB_PARENT_MIRROR_CHROOT_SECURITY="${LB_PARENT_MIRROR_CHROOT_SECURITY}"
2007-09-23 08:05:10 +00:00
# \$LB_PARENT_MIRROR_BINARY: set parent mirror which ends up in the image
LB_PARENT_MIRROR_BINARY="${LB_PARENT_MIRROR_BINARY}"
2007-09-23 08:05:10 +00:00
# \$LB_PARENT_MIRROR_BINARY_SECURITY: set security parent mirror which ends up in the image
LB_PARENT_MIRROR_BINARY_SECURITY="${LB_PARENT_MIRROR_BINARY_SECURITY}"
2007-09-23 08:05:10 +00:00
# \$LB_PARENT_MIRROR_DEBIAN_INSTALLER: set debian-installer parent mirror
LB_PARENT_MIRROR_DEBIAN_INSTALLER="${LB_PARENT_MIRROR_DEBIAN_INSTALLER}"
# \$LB_MIRROR_BOOTSTRAP: set mirror to bootstrap from
LB_MIRROR_BOOTSTRAP="${LB_MIRROR_BOOTSTRAP}"
# \$LB_MIRROR_CHROOT: set mirror to fetch packages from
LB_MIRROR_CHROOT="${LB_MIRROR_CHROOT}"
# \$LB_MIRROR_CHROOT_SECURITY: set security mirror to fetch packages from
LB_MIRROR_CHROOT_SECURITY="${LB_MIRROR_CHROOT_SECURITY}"
# \$LB_MIRROR_BINARY: set mirror which ends up in the image
LB_MIRROR_BINARY="${LB_MIRROR_BINARY}"
# \$LB_MIRROR_BINARY_SECURITY: set security mirror which ends up in the image
LB_MIRROR_BINARY_SECURITY="${LB_MIRROR_BINARY_SECURITY}"
# \$LB_MIRROR_DEBIAN_INSTALLER: set debian-installer mirror
LB_MIRROR_DEBIAN_INSTALLER="${LB_MIRROR_DEBIAN_INSTALLER}"
# \$LB_BOOTSTRAP_QEMU_ARCHITECTURE: architectures to use foreign bootstrap
LB_BOOTSTRAP_QEMU_ARCHITECTURE="${LB_BOOTSTRAP_QEMU_ARCHITECTURE}"
# \$LB_BOOTSTRAP_QEMU_EXCLUDE: packages to exclude during foreign bootstrap
LB_BOOTSTRAP_QEMU_EXCLUDE="${LB_BOOTSTRAP_QEMU_EXCLUDE}"
# \$LB_BOOTSTRAP_QEMU_STATIC: static qemu binary for foreign bootstrap
LB_BOOTSTRAP_QEMU_STATIC="${LB_BOOTSTRAP_QEMU_STATIC}"
2007-09-23 08:05:10 +00:00
EOF
# Creating lb_chroot_* configuration
mkdir -p config/archives
mkdir -p config/apt
mkdir -p config/packages
mkdir -p config/packages.chroot
mkdir -p config/package-lists
mkdir -p config/preseed
2007-09-23 08:05:10 +00:00
2007-09-23 08:05:17 +00:00
cat > config/chroot << EOF
# config/chroot - options for live-build(7), chroot stage
2007-09-23 08:04:46 +00:00
# \$LB_CHROOT_FILESYSTEM: set chroot filesystem
LB_CHROOT_FILESYSTEM="${LB_CHROOT_FILESYSTEM}"
2007-09-23 08:05:09 +00:00
# \$LB_UNION_FILESYSTEM: set union filesystem
LB_UNION_FILESYSTEM="${LB_UNION_FILESYSTEM}"
2007-09-23 08:05:13 +00:00
# \$LB_INTERACTIVE: set interactive build
LB_INTERACTIVE="${LB_INTERACTIVE}"
2007-09-23 08:05:09 +00:00
# \$LB_KEYRING_PACKAGES: set keyring packages
LB_KEYRING_PACKAGES="${LB_KEYRING_PACKAGES}"
2007-09-23 08:04:49 +00:00
Fixed foreign architecture package support to linux kernel flavours Before Stretch there was an special amd64 kernel in the i386 arch repo. So if you wanted to install an amd64 kernel alongside an i386 system you did not need an additional arch repo. Debian added multiarch support. That way you can install library packages from multiple architectures on the same machine. So there is no longer a need for having an amd64 kernel in i386 arch repo. You can add an amd64 arch repo to an i386 arch system and fetch the amd64 kernel from the am64 arch repo. live-build can be setup to use several linux kernel flavours in a single image. So in the days previous to this patch you could issue: lb config --linux-flavours "486 amd64" to use both 486 and amd64 kernel flavours. Adding additional arch support to linux flavours poses two problems: * Packages need to have its arch suffix (e.g. amd64:amd64). If the suffix is not there apt-get insists on search amd64 kernel package on i386 arch repo and, of course, fails to find it. * The rest of the code which handles labels (bootloader config files) or installed filenames (kernel images themselves) do not use the arch suffix. This patch adds foreign architecture package support to linux kernel flavours having taken those problems into account. Practical example usage: i386 system and extra amd64 kernel. First add amd64 foreign architecture in your i386 system thanks to: dpkg --add-architecture amd64 apt-get update . Finally enable amd64 kernel from amd64 arch alongside the i386 system's 686 kernel thanks to: lb config --architectures i386 --linux-flavours "686 amd64:amd64"
2017-12-15 16:22:57 -01:00
# \$LB_LINUX_FLAVOURS_WITH_ARCH: set kernel flavour to use (with arch)
LB_LINUX_FLAVOURS_WITH_ARCH="${LB_LINUX_FLAVOURS_WITH_ARCH}"
2007-09-23 08:05:10 +00:00
# \$LB_LINUX_PACKAGES: set kernel packages to use
LB_LINUX_PACKAGES="${LB_LINUX_PACKAGES}"
2007-09-23 08:05:10 +00:00
# \$LB_SECURITY: enable security updates
LB_SECURITY="${LB_SECURITY}"
2007-09-23 08:04:46 +00:00
# \$LB_UPDATES: enable updates updates
LB_UPDATES="${LB_UPDATES}"
# \$LB_BACKPORTS: enable backports updates
LB_BACKPORTS="${LB_BACKPORTS}"
2007-09-23 08:04:46 +00:00
EOF
# Creating lb_binary_* configuration
mkdir -p config/debian-installer
mkdir -p config/includes.installer
mkdir -p config/packages.binary
mkdir -p config/package-lists
mkdir -p config/rootfs
2007-09-23 08:05:17 +00:00
cat > config/binary << EOF
# config/binary - options for live-build(7), binary stage
2007-09-23 08:05:10 +00:00
# \$LB_BINARY_FILESYSTEM: set image filesystem
LB_BINARY_FILESYSTEM="${LB_BINARY_FILESYSTEM}"
# \$LB_APT_INDICES: set apt/aptitude generic indices
LB_APT_INDICES="${LB_APT_INDICES}"
2007-09-23 08:05:09 +00:00
# \$LB_BOOTAPPEND_LIVE: set boot parameters
LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE}"
2007-09-23 08:04:46 +00:00
# \$LB_BOOTAPPEND_INSTALL: set boot parameters
LB_BOOTAPPEND_INSTALL="${LB_BOOTAPPEND_INSTALL}"
# \$LB_BOOTAPPEND_LIVE_FAILSAFE: set boot parameters
LB_BOOTAPPEND_LIVE_FAILSAFE="${LB_BOOTAPPEND_LIVE_FAILSAFE}"
# \$LB_BOOTLOADERS: set bootloaders
LB_BOOTLOADERS="${LB_BOOTLOADERS}"
2007-09-23 08:05:10 +00:00
# \$LB_CHECKSUMS: set checksums
LB_CHECKSUMS="${LB_CHECKSUMS}"
# \$LB_COMPRESSION: set compression
LB_COMPRESSION="${LB_COMPRESSION}"
# \$LB_ZSYNC: set zsync
LB_ZSYNC="${LB_ZSYNC}"
# \${LB_BUILD_WITH_CHROOT: control if we build binary images chrooted
# DO NEVER, *NEVER*, *N*E*V*E*R* SET THIS OPTION to false.
LB_BUILD_WITH_CHROOT="${LB_BUILD_WITH_CHROOT}"
2007-09-23 08:05:15 +00:00
# \$LB_DEBIAN_INSTALLER: set debian-installer
LB_DEBIAN_INSTALLER="${LB_DEBIAN_INSTALLER}"
2007-09-23 08:05:10 +00:00
# \$LB_DEBIAN_INSTALLER_DISTRIBUTION: set debian-installer suite
LB_DEBIAN_INSTALLER_DISTRIBUTION="${LB_DEBIAN_INSTALLER_DISTRIBUTION}"
# \$LB_DEBIAN_INSTALLER_PRESEEDFILE: set debian-installer preseed filename/url
LB_DEBIAN_INSTALLER_PRESEEDFILE="${LB_DEBIAN_INSTALLER_PRESEEDFILE}"
# \$LB_DEBIAN_INSTALLER_GUI: toggle use of GUI debian-installer
LB_DEBIAN_INSTALLER_GUI="${LB_DEBIAN_INSTALLER_GUI}"
# \$LB_HDD_LABEL: set hdd label
LB_HDD_LABEL="${LB_HDD_LABEL}"
# \$LB_HDD_SIZE: set hdd filesystem size
LB_HDD_SIZE="${LB_HDD_SIZE}"
# \$LB_HDD_PARTITION_START: set start of partition for the hdd target for BIOSes that expect a specific boot partition start (e.g. "63s"). If empty, use optimal layout.
LB_HDD_PARTITION_START="${LB_HDD_PARTITION_START}"
# \$LB_ISO_APPLICATION: set iso author
LB_ISO_APPLICATION="${LB_ISO_APPLICATION}"
2007-09-23 08:04:46 +00:00
# \$LB_ISO_PREPARER: set iso preparer
LB_ISO_PREPARER="${LB_ISO_PREPARER}"
2007-09-23 08:05:10 +00:00
# \$LB_ISO_PUBLISHER: set iso publisher
LB_ISO_PUBLISHER="${LB_ISO_PUBLISHER}"
2007-09-23 08:04:52 +00:00
# \$LB_ISO_VOLUME: set iso volume (max 32 chars)
LB_ISO_VOLUME="${LB_ISO_VOLUME}"
2007-09-23 08:04:46 +00:00
# \$LB_JFFS2_ERASEBLOCK: set jffs2 eraseblock size
LB_JFFS2_ERASEBLOCK=""
# \$LB_MEMTEST: set memtest
LB_MEMTEST="${LB_MEMTEST}"
2007-09-23 08:04:46 +00:00
# \$LB_LOADLIN: set loadlin
LB_LOADLIN="${LB_LOADLIN}"
# \$LB_WIN32_LOADER: set win32-loader
LB_WIN32_LOADER="${LB_WIN32_LOADER}"
# \$LB_NET_TARBALL: set net tarball
LB_NET_TARBALL="${LB_NET_TARBALL}"
Add options to build ONIE images Open Network Install Environment is an open image format used by networking vendor to ship a standardised image for networking white box switches. ONIE hardware takes this image at boot and a script to chain load into the final environment via kexec. We can support Debian and derivatives on such systems by packing an ISO which then gets unpacked, kexec'ed and live-booted. A base ONIE system can be tested in QEMU by building a VM following these instrunctions: https://github.com/opencomputeproject/onie/blob/master/machine/kvm_x86_64/INSTALL Once built, boot onie-recovery-x86_64-kvm_x86_64-r0.iso in QEMU/libvirt and on the console there will be the terminal prompt. Check the IP assigned by libvirt and then scp the live image (ssh access is enabled as root without password...). Then the .bin can be booted with: ONIE-RECOVERY:/ # onie-nos-install /tmp/live.hybrid.iso-ONIE.bin The implementation is inspired by ONIE's own scripts that can be found at: https://github.com/opencomputeproject/onie/blob/master/contrib/debian-iso/cook-bits.sh A new option, --onie (false by default) can be set to true to enable building this new format in addition to an ISO. An additional option, --onie-kernel-cmdline can be used to specify additional options that the ONIE system should use when kexec'ing the final image. Note that only iso or hybrid-iso formats are supported. For more information about the ONIE ecosystem see: http://onie.org Signed-off-by: Erik Ziegenbalg <eziegenb@Brocade.com> Signed-off-by: Luca Boccassi <bluca@debian.org>
2018-03-16 18:30:50 -01:00
# \$LB_ONIE: set onie
LB_ONIE="${LB_ONIE}"
# \$LB_ONIE_KERNEL_CMDLINE: set onie additional kernel cmdline options
LB_ONIE_KERNEL_CMDLINE="${LB_ONIE_KERNEL_CMDLINE}"
# \$LB_FIRMWARE_BINARY: include firmware packages in debian-installer
LB_FIRMWARE_BINARY="${LB_FIRMWARE_BINARY}"
# \$LB_FIRMWARE_CHROOT: include firmware packages in the live image
LB_FIRMWARE_CHROOT="${LB_FIRMWARE_CHROOT}"
# \$LB_SWAP_FILE_PATH: set swap file path
LB_SWAP_FILE_PATH="${LB_SWAP_FILE_PATH}"
# \$LB_SWAP_FILE_SIZE: set swap file size
LB_SWAP_FILE_SIZE="${LB_SWAP_FILE_SIZE}"
UEFI: add support for Secure Boot on amd64 and arm64 Support for UEFI Secure Boot is modelled after how it currently works in Ubuntu and on how it is going to work on Debian. A minimal bootloader, shim, is used as the first-stage and it then loads grub. Both have to be signed. shim-signed is already available in Debian so the filenames are already established, and the grub2 repository and packaging is common between the 2 distros so we can already be reasonably sure of what it is going to be. So if both are available, copy /usr/lib/shim/shim[x64|aa64].efi.signed as boot[x64|aa64].efi so that UEFI loads it first, and copy /usr/lib/grub/[x86_64|arm64]-efi-signed/grub[x64|aa64].efi.signed as grub[x64|aa64].efi. This grub2 EFI monolithic image is currently hard-coded in grub2's repository to look for a config file in efi/debian, so make a copy of the previously added minimal grub.cfg that loads the real one in that directory in both the fat32 and ISO 9660 partitions. The new option --uefi-secure-boot can be set to auto (default, enable or disable. In auto, the lack of the signed EFI binaries is intentionally left as a soft failure - live-build will simply fallback to using the locally generated non-signed grub2 monolithic EFI binary as the only bootloader. Given the difficulties surrounding the Secure Boot signing infrastructure this approach gives the most flexibility and makes sure things will "just work" once the packages are available, without the need to change anything in the configuration. This will also greatly help downstream distributions and users who want to do self-signing. The enable or disable options work as expected. Closes: #821084
2018-02-27 18:28:33 -01:00
# \$LB_UEFI_SECURE_BOOT: enable/disable UEFI secure boot
LB_UEFI_SECURE_BOOT="${LB_UEFI_SECURE_BOOT}"
2007-09-23 08:04:52 +00:00
EOF
# Creating lb_source_* configuration
2007-09-23 08:05:17 +00:00
cat > config/source << EOF
# config/source - options for live-build(7), source stage
2007-09-23 08:04:52 +00:00
# \$LB_SOURCE: set source option
LB_SOURCE="${LB_SOURCE}"
2007-09-23 08:04:46 +00:00
# \$LB_SOURCE_IMAGES: set image type
LB_SOURCE_IMAGES="${LB_SOURCE_IMAGES}"
2007-09-23 08:04:46 +00:00
EOF
2007-09-23 08:05:12 +00:00
mkdir -p auto
mkdir -p local/bin
if [ "${_CLEAN}" = "true" ]
then
# Remove empty directories in config tree
2012-09-30 13:13:42 +00:00
rmdir --ignore-fail-on-non-empty auto > /dev/null 2>&1 || true
rmdir --ignore-fail-on-non-empty config/*/ > /dev/null 2>&1 || true
rmdir --ignore-fail-on-non-empty config > /dev/null 2>&1 || true
2012-09-30 13:13:42 +00:00
rmdir --ignore-fail-on-non-empty local/*/ > /dev/null 2>&1 || true
rmdir --ignore-fail-on-non-empty local > /dev/null 2>&1 || true
fi
mkdir -p config/hooks/normal config/hooks/live
mkdir -p config/includes config/includes.bootstrap config/includes.chroot config/includes.binary config/includes.source
Echo_message "Symlinking hooks..."
for _HOOK in "${LIVE_BUILD}"/share/hooks/normal/*.hook* /usr/share/live/build/hooks/normal/*.hook*
do
if [ -e "${_HOOK}" ] && [ ! -e "config/hooks/normal/$(basename ${_HOOK})" ]
then
ln -s "${_HOOK}" "config/hooks/normal/$(basename ${_HOOK})"
fi
done
for _HOOK in "${LIVE_BUILD}"/share/hooks/live/*.hook* /usr/share/live/build/hooks/live/*.hook*
do
if [ -e "${_HOOK}" ] && [ ! -e "config/hooks/live/$(basename ${_HOOK})" ]
then
ln -s "${_HOOK}" "config/hooks/live/$(basename ${_HOOK})"
fi
done
if [ ! -e config/package-lists/live.list.chroot ]
then
mkdir -p config/package-lists
case "${LB_INITRAMFS}" in
live-boot)
echo "live-boot" > config/package-lists/live.list.chroot
echo "live-config" >> config/package-lists/live.list.chroot
2014-12-10 06:38:42 -01:00
case "${LB_INITSYSTEM}" in
none)
# do nothing
;;
2014-12-10 06:38:42 -01:00
systemd)
echo "live-config-systemd" >> config/package-lists/live.list.chroot
;;
sysvinit)
2014-12-10 06:38:42 -01:00
echo "live-config-${LB_INITSYSTEM}" >> config/package-lists/live.list.chroot
echo "sysvinit-core" >> config/package-lists/live.list.chroot
;;
esac
;;
*)
;;
esac
fi
cat > config/build << EOF
[Image]
Architecture: ${LB_ARCHITECTURE}
Archive-Areas: ${LB_ARCHIVE_AREAS}
Distribution-Chroot: ${LB_DISTRIBUTION_CHROOT}
Distribution-Binary: ${LB_DISTRIBUTION_BINARY}
Mirror-Bootstrap: ${LB_MIRROR_BOOTSTRAP}
EOF
if [ "${LB_DERIVATIVE}" = "true" ]
then
cat >> config/build << EOF
Parent-Archive-Areas: ${LB_PARENT_ARCHIVE_AREAS}
Parent-Distribution-Chroot: ${LB_PARENT_DISTRIBUTION_CHROOT}
Parent-Distribution-Binary: ${LB_PARENT_DISTRIBUTION_BINARY}
Parent-Mirror-Bootstrap: ${LB_PARENT_MIRROR_BOOTSTRAP}
EOF
fi
cat >> config/build << EOF
[FIXME]
Configuration-Version: ${LIVE_CONFIGURATION_VERSION}
Name: ${LIVE_IMAGE_NAME}
Type: ${LIVE_IMAGE_TYPE}
EOF
# Creating stage file
Create_stagefile