live-build/functions/configuration.sh

718 lines
23 KiB
Bash
Raw Normal View History

2007-09-23 08:04:46 +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
# Prepare config for use, filling in defaults where no value provided for instance
Prepare_config ()
2007-09-23 08:04:46 +00:00
{
# Colouring is re-evaluated here just incase a hard coded override was given in the saved config
case "${_COLOR}" in
true)
_COLOR_OUT="true"
_COLOR_ERR="true"
;;
false)
_COLOR_OUT="false"
_COLOR_ERR="false"
;;
auto)
;;
esac
_BREAKPOINTS="${_BREAKPOINTS:-false}"
_DEBUG="${_DEBUG:-false}"
_FORCE="${_FORCE:-false}"
_QUIET="${_QUIET:-false}"
_VERBOSE="${_VERBOSE:-false}"
LB_CONFIGURATION_VERSION="${LB_CONFIGURATION_VERSION:-${LIVE_BUILD_VERSION}}"
LIVE_CONFIGURATION_VERSION="${LB_CONFIGURATION_VERSION}" #for backwards compatibility with hooks
config: revert partial format conversion back in v4.0~a6-1 a transition process was started to move the live-build config to a new format. the new format was INI style, and required parsing functions to read/write values, compared to the existing format which was just shell script code setting variables. this partial transition is the explanation for the existence of the `New_configuration()` function, and understanding this is important to understanding the purpose of it - it is not in fact intended for creating a new configuration, it is just related to the new config format transition. the positives of the new format were that it was somewhat cleaner looking, while the negative was the terrible relative efficiency. the file `config/build` was created to hold options in this new format. the transition was only ever completed for a handful of config options: - architecture - archive areas and parent archive areas - live image name - live image type a 'configuration version' attribute was also saved, which is not used by anything. the bootstrap-mirror and parent-bootstrap-mirror attributes are pointlessly stored in it seemingly resulting from work done in v4.0~a17-1. (they are also stored in another config file from which the value is actually used). it in fact seems to have been a source of confusion for Raphaël in authoring 44b9b0a6501476de594ce3783cea5df0c141478c, since the new `[parent]-distribution-{chroot|binary}` options it introduced were stored both in `config/bootstrap` and in `config/build`, while only used from the former. i expect, understandably, that he thought that `config/build` was just an information file. Gbp-Dch: Short
2020-04-06 15:49:08 +00:00
LB_SYSTEM="${LB_SYSTEM:-live}"
if command -v lsb_release >/dev/null
then
local _DISTRIBUTOR
_DISTRIBUTOR="$(lsb_release -is | tr "[A-Z]" "[a-z]")"
case "${_DISTRIBUTOR}" in
debian)
LB_MODE="${LB_MODE:-${_DISTRIBUTOR}}"
;;
*)
LB_MODE="${LB_MODE:-debian}"
;;
esac
else
LB_MODE="${LB_MODE:-debian}"
fi
2007-09-23 08:04:49 +00:00
LB_DERIVATIVE="false"
LB_DISTRIBUTION="${LB_DISTRIBUTION:-buster}"
LB_DISTRIBUTION_CHROOT="${LB_DISTRIBUTION_CHROOT:-${LB_DISTRIBUTION}}"
LB_DISTRIBUTION_BINARY="${LB_DISTRIBUTION_BINARY:-${LB_DISTRIBUTION_CHROOT}}"
LB_IMAGE_NAME="${LB_IMAGE_NAME:-live-image}"
LB_IMAGE_TYPE="${LB_IMAGE_TYPE:-iso-hybrid}"
#for backwards compatibility with hooks
LIVE_IMAGE_NAME="${LB_IMAGE_NAME}"
LIVE_IMAGE_TYPE="${LB_IMAGE_TYPE}"
config: revert partial format conversion back in v4.0~a6-1 a transition process was started to move the live-build config to a new format. the new format was INI style, and required parsing functions to read/write values, compared to the existing format which was just shell script code setting variables. this partial transition is the explanation for the existence of the `New_configuration()` function, and understanding this is important to understanding the purpose of it - it is not in fact intended for creating a new configuration, it is just related to the new config format transition. the positives of the new format were that it was somewhat cleaner looking, while the negative was the terrible relative efficiency. the file `config/build` was created to hold options in this new format. the transition was only ever completed for a handful of config options: - architecture - archive areas and parent archive areas - live image name - live image type a 'configuration version' attribute was also saved, which is not used by anything. the bootstrap-mirror and parent-bootstrap-mirror attributes are pointlessly stored in it seemingly resulting from work done in v4.0~a17-1. (they are also stored in another config file from which the value is actually used). it in fact seems to have been a source of confusion for Raphaël in authoring 44b9b0a6501476de594ce3783cea5df0c141478c, since the new `[parent]-distribution-{chroot|binary}` options it introduced were stored both in `config/bootstrap` and in `config/build`, while only used from the former. i expect, understandably, that he thought that `config/build` was just an information file. Gbp-Dch: Short
2020-04-06 15:49:08 +00:00
if [ -z "${LB_ARCHITECTURE}" ]; then
if command -v dpkg >/dev/null; then
config: revert partial format conversion back in v4.0~a6-1 a transition process was started to move the live-build config to a new format. the new format was INI style, and required parsing functions to read/write values, compared to the existing format which was just shell script code setting variables. this partial transition is the explanation for the existence of the `New_configuration()` function, and understanding this is important to understanding the purpose of it - it is not in fact intended for creating a new configuration, it is just related to the new config format transition. the positives of the new format were that it was somewhat cleaner looking, while the negative was the terrible relative efficiency. the file `config/build` was created to hold options in this new format. the transition was only ever completed for a handful of config options: - architecture - archive areas and parent archive areas - live image name - live image type a 'configuration version' attribute was also saved, which is not used by anything. the bootstrap-mirror and parent-bootstrap-mirror attributes are pointlessly stored in it seemingly resulting from work done in v4.0~a17-1. (they are also stored in another config file from which the value is actually used). it in fact seems to have been a source of confusion for Raphaël in authoring 44b9b0a6501476de594ce3783cea5df0c141478c, since the new `[parent]-distribution-{chroot|binary}` options it introduced were stored both in `config/bootstrap` and in `config/build`, while only used from the former. i expect, understandably, that he thought that `config/build` was just an information file. Gbp-Dch: Short
2020-04-06 15:49:08 +00:00
LB_ARCHITECTURE="$(dpkg --print-architecture)"
else
case "$(uname -m)" in
x86_64)
LB_ARCHITECTURE="amd64"
;;
i?86)
LB_ARCHITECTURE="i386"
;;
*)
Echo_error "Unable to determine current architecture"
exit 1
;;
esac
fi
fi
# For backwards compat with custom hooks and conditional includes
LB_ARCHITECTURES="${LB_ARCHITECTURE}"
LB_ARCHIVE_AREAS="${LB_ARCHIVE_AREAS:-main}"
LB_PARENT_ARCHIVE_AREAS="${LB_PARENT_ARCHIVE_AREAS:-${LB_ARCHIVE_AREAS}}"
LB_ARCHIVE_AREAS="$(echo "${LB_ARCHIVE_AREAS}" | tr "," " ")"
LB_PARENT_ARCHIVE_AREAS="$(echo "${LB_PARENT_ARCHIVE_AREAS}" | tr "," " ")"
LB_BACKPORTS="${LB_BACKPORTS:-false}"
if [ -n "$LB_PARENT_DISTRIBUTION" ]; then
LB_PARENT_DISTRIBUTION_CHROOT="${LB_PARENT_DISTRIBUTION_CHROOT:-${LB_PARENT_DISTRIBUTION}}"
LB_PARENT_DISTRIBUTION_BINARY="${LB_PARENT_DISTRIBUTION_BINARY:-${LB_PARENT_DISTRIBUTION}}"
else
LB_PARENT_DISTRIBUTION_CHROOT="${LB_PARENT_DISTRIBUTION_CHROOT:-${LB_DISTRIBUTION_CHROOT}}"
LB_PARENT_DISTRIBUTION_BINARY="${LB_PARENT_DISTRIBUTION_BINARY:-${LB_DISTRIBUTION_BINARY}}"
fi
LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION="${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION:-${LB_PARENT_DISTRIBUTION_CHROOT}}"
2007-09-23 08:04:46 +00:00
LB_APT="${LB_APT:-apt}"
LB_APT_FTP_PROXY="${LB_APT_FTP_PROXY}"
LB_APT_HTTP_PROXY="${LB_APT_HTTP_PROXY}"
LB_APT_RECOMMENDS="${LB_APT_RECOMMENDS:-true}"
LB_APT_SECURE="${LB_APT_SECURE:-true}"
LB_APT_SOURCE_ARCHIVES="${LB_APT_SOURCE_ARCHIVES:-true}"
LB_APT_INDICES="${LB_APT_INDICES:-true}"
2007-09-23 08:04:46 +00:00
APT_OPTIONS="${APT_OPTIONS:---yes}"
APTITUDE_OPTIONS="${APTITUDE_OPTIONS:---assume-yes}"
BZIP2_OPTIONS="${BZIP2_OPTIONS:--6}"
GZIP_OPTIONS="${GZIP_OPTIONS:--6}"
LZIP_OPTIONS="${LZIP_OPTIONS:--6}"
LZMA_OPTIONS="${LZMA_OPTIONS:--6}"
XZ_OPTIONS="${XZ_OPTIONS:--6}"
if gzip --help | grep -qs "\-\-rsyncable"
then
GZIP_OPTIONS="$(echo ${GZIP_OPTIONS} | sed -e 's|--rsyncable||') --rsyncable"
fi
LB_CACHE="${LB_CACHE:-true}"
if [ "${LB_CACHE}" = "false" ]
then
LB_CACHE_INDICES="false"
LB_CACHE_PACKAGES="false"
LB_CACHE_STAGES="bootstrap" #bootstrap caching currently required for process to work
else
LB_CACHE_INDICES="${LB_CACHE_INDICES:-false}"
LB_CACHE_PACKAGES="${LB_CACHE_PACKAGES:-true}"
LB_CACHE_STAGES="${LB_CACHE_STAGES:-bootstrap}"
fi
LB_CACHE_STAGES="$(echo "${LB_CACHE_STAGES}" | tr "," " ")"
2007-09-23 08:04:46 +00:00
LB_DEBCONF_FRONTEND="${LB_DEBCONF_FRONTEND:-noninteractive}"
LB_DEBCONF_PRIORITY="${LB_DEBCONF_PRIORITY:-critical}"
2007-09-23 08:04:50 +00:00
case "${LB_SYSTEM}" in
live)
LB_INITRAMFS="${LB_INITRAMFS:-live-boot}"
2010-12-27 16:12:36 -01:00
;;
normal)
LB_INITRAMFS="${LB_INITRAMFS:-none}"
2010-12-27 16:12:36 -01:00
;;
esac
2007-09-23 08:05:10 +00:00
LB_INITRAMFS_COMPRESSION="${LB_INITRAMFS_COMPRESSION:-gzip}"
case "${LB_SYSTEM}" in
live)
LB_INITSYSTEM="${LB_INITSYSTEM:-systemd}"
;;
normal)
LB_INITSYSTEM="${LB_INITSYSTEM:-none}"
;;
2011-02-10 21:31:21 -01:00
esac
if [ "${LB_ARCHITECTURE}" = "i386" ] && [ "${CURRENT_IMAGE_ARCHITECTURE}" = "amd64" ]
then
# Use linux32 when building amd64 images on i386
_LINUX32="linux32"
else
_LINUX32=""
fi
# Mirrors:
2020-03-19 00:37:59 -01:00
# *_MIRROR_BOOTSTRAP: to fetch packages from
# *_MIRROR_CHROOT: to fetch packages from
2020-03-19 00:37:59 -01:00
# *_MIRROR_CHROOT_SECURITY: security mirror to fetch packages from
# *_MIRROR_BINARY: mirror which ends up in the image
# *_MIRROR_BINARY_SECURITY: security mirror which ends up in the image
# *_MIRROR_DEBIAN_INSTALLER: to fetch installer from
if [ "${LB_MODE}" = "debian" ]; then
LB_MIRROR_BOOTSTRAP="${LB_MIRROR_BOOTSTRAP:-http://deb.debian.org/debian/}"
LB_PARENT_MIRROR_BOOTSTRAP="${LB_PARENT_MIRROR_BOOTSTRAP:-${LB_MIRROR_BOOTSTRAP}}"
fi
LB_MIRROR_CHROOT="${LB_MIRROR_CHROOT:-${LB_MIRROR_BOOTSTRAP}}"
LB_PARENT_MIRROR_CHROOT="${LB_PARENT_MIRROR_CHROOT:-${LB_PARENT_MIRROR_BOOTSTRAP}}"
if [ "${LB_MODE}" = "debian" ]; then
2020-03-19 00:37:59 -01:00
LB_MIRROR_CHROOT_SECURITY="${LB_MIRROR_CHROOT_SECURITY:-http://security.debian.org/}"
LB_PARENT_MIRROR_CHROOT_SECURITY="${LB_PARENT_MIRROR_CHROOT_SECURITY:-${LB_MIRROR_CHROOT_SECURITY}}"
2007-09-23 08:04:46 +00:00
2020-03-19 00:37:59 -01:00
LB_MIRROR_BINARY="${LB_MIRROR_BINARY:-http://deb.debian.org/debian/}"
LB_PARENT_MIRROR_BINARY="${LB_PARENT_MIRROR_BINARY:-${LB_MIRROR_BINARY}}"
2007-09-23 08:04:46 +00:00
2020-03-19 00:37:59 -01:00
LB_MIRROR_BINARY_SECURITY="${LB_MIRROR_BINARY_SECURITY:-http://security.debian.org/}"
LB_PARENT_MIRROR_BINARY_SECURITY="${LB_PARENT_MIRROR_BINARY_SECURITY:-${LB_MIRROR_BINARY_SECURITY}}"
fi
LB_MIRROR_DEBIAN_INSTALLER="${LB_MIRROR_DEBIAN_INSTALLER:-${LB_MIRROR_CHROOT}}"
LB_PARENT_MIRROR_DEBIAN_INSTALLER="${LB_PARENT_MIRROR_DEBIAN_INSTALLER:-${LB_PARENT_MIRROR_CHROOT}}"
LB_CHROOT_FILESYSTEM="${LB_CHROOT_FILESYSTEM:-squashfs}"
2007-09-23 08:05:10 +00:00
LB_UNION_FILESYSTEM="${LB_UNION_FILESYSTEM:-overlay}"
2007-09-23 08:05:13 +00:00
LB_INTERACTIVE="${LB_INTERACTIVE:-false}"
2007-09-23 08:04:48 +00:00
LB_KEYRING_PACKAGES="${LB_KEYRING_PACKAGES:-debian-archive-keyring}"
2007-09-23 08:05:10 +00:00
# first, handle existing LB_LINUX_FLAVOURS for backwards compatibility
if [ -n "${LB_LINUX_FLAVOURS}" ]; then
LB_LINUX_FLAVOURS_WITH_ARCH="${LB_LINUX_FLAVOURS}"
fi
case "${LB_ARCHITECTURE}" in
arm64)
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="${LB_LINUX_FLAVOURS_WITH_ARCH:-arm64}"
;;
2010-12-27 16:12:36 -01:00
armel)
# armel will have special images: one rootfs image and many additional kernel images.
# therefore we default to all available armel flavours
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="${LB_LINUX_FLAVOURS_WITH_ARCH:-marvell}"
2010-12-27 16:12:36 -01:00
;;
armhf)
# armhf will have special images: one rootfs image and many additional kernel images.
# therefore we default to all available armhf flavours
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="${LB_LINUX_FLAVOURS_WITH_ARCH:-armmp armmp-lpae}"
;;
2010-12-27 16:12:36 -01:00
amd64)
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="${LB_LINUX_FLAVOURS_WITH_ARCH:-amd64}"
2010-12-27 16:12:36 -01:00
;;
2007-09-23 08:04:46 +00:00
2010-12-27 16:12:36 -01:00
i386)
LB_LINUX_FLAVOURS_WITH_ARCH="${LB_LINUX_FLAVOURS_WITH_ARCH:-686-pae}"
2010-12-27 16:12:36 -01:00
;;
2007-09-23 08:04:46 +00:00
2010-12-27 16:12:36 -01:00
ia64)
LB_LINUX_FLAVOURS_WITH_ARCH="${LB_LINUX_FLAVOURS_WITH_ARCH:-itanium}"
2010-12-27 16:12:36 -01:00
;;
2010-12-27 16:12:36 -01:00
powerpc)
LB_LINUX_FLAVOURS_WITH_ARCH="${LB_LINUX_FLAVOURS_WITH_ARCH:-powerpc64 powerpc}"
2010-12-27 16:12:36 -01:00
;;
2009-04-15 20:07:26 +00:00
s390x)
LB_LINUX_FLAVOURS_WITH_ARCH="${LB_LINUX_FLAVOURS_WITH_ARCH:-s390x}"
2010-12-27 16:12:36 -01:00
;;
2007-09-23 08:04:46 +00:00
2010-12-27 16:12:36 -01:00
*)
Echo_error "Architecture(s) ${LB_ARCHITECTURE} not yet supported (FIXME)"
2010-12-27 16:12:36 -01:00
exit 1
;;
esac
2007-09-23 08:04:46 +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=""
for FLAVOUR in ${LB_LINUX_FLAVOURS_WITH_ARCH}
do
ARCH_FILTERED_FLAVOUR="$(echo ${FLAVOUR} | awk -F':' '{print $1}')"
LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:+$LB_LINUX_FLAVOURS }${ARCH_FILTERED_FLAVOUR}"
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
done
LB_LINUX_PACKAGES="${LB_LINUX_PACKAGES:-linux-image}"
2007-09-23 08:04:46 +00:00
LB_BINARY_FILESYSTEM="${LB_BINARY_FILESYSTEM:-fat32}"
case "${LB_PARENT_DISTRIBUTION_BINARY}" in
sid)
LB_SECURITY="${LB_SECURITY:-false}"
;;
*)
LB_SECURITY="${LB_SECURITY:-true}"
;;
esac
2007-09-23 08:04:46 +00:00
case "${LB_PARENT_DISTRIBUTION_BINARY}" in
sid)
LB_UPDATES="${LB_UPDATES:-false}"
;;
*)
LB_UPDATES="${LB_UPDATES:-true}"
;;
esac
case "${LB_ARCHITECTURE}" in
2010-12-27 16:12:36 -01:00
amd64|i386)
LB_IMAGE_TYPE="${LB_IMAGE_TYPE:-iso-hybrid}"
;;
*)
LB_IMAGE_TYPE="${LB_IMAGE_TYPE:-iso}"
;;
esac
2007-09-23 08:05:10 +00:00
if [ -z "${LB_BOOTLOADERS}" ]
2007-09-23 08:05:10 +00:00
then
case "${LB_ARCHITECTURE}" in
amd64|i386)
case "${LB_IMAGE_TYPE}" in
hdd|netboot)
LB_BOOTLOADERS="syslinux"
;;
*)
LB_BOOTLOADERS="syslinux,grub-efi"
;;
esac
2007-09-23 08:05:10 +00:00
;;
esac
fi
LB_BOOTLOADERS="$(echo "${LB_BOOTLOADERS}" | tr "," " ")"
2007-09-23 08:05:10 +00:00
LB_FIRST_BOOTLOADER=$(echo "${LB_BOOTLOADERS}" | awk '{ print $1 }')
LB_CHECKSUMS="${LB_CHECKSUMS:-sha256}"
LB_COMPRESSION="${LB_COMPRESSION:-none}"
LB_ZSYNC="${LB_ZSYNC:-true}"
LB_BUILD_WITH_CHROOT="${LB_BUILD_WITH_CHROOT:-true}"
2007-09-23 08:05:15 +00:00
LB_BUILD_WITH_TMPFS="${LB_BUILD_WITH_TMPFS:-false}"
LB_DEBIAN_INSTALLER="${LB_DEBIAN_INSTALLER:-none}"
if [ "${LB_DEBIAN_INSTALLER}" = "false" ]
then
LB_DEBIAN_INSTALLER="none"
Echo_warning "A value of 'false' for option LB_DEBIAN_INSTALLER is deprecated, please use 'none' in future."
fi
if [ "${LB_DEBIAN_INSTALLER}" = "true" ]
then
LB_DEBIAN_INSTALLER="netinst"
Echo_warning "A value of 'true' for option LB_DEBIAN_INSTALLER is deprecated, please use 'netinst' in future."
fi
2007-09-23 08:04:48 +00:00
LB_DEBIAN_INSTALLER_DISTRIBUTION="${LB_DEBIAN_INSTALLER_DISTRIBUTION:-${LB_DISTRIBUTION}}"
2020-03-19 00:40:22 -01:00
LB_DEBIAN_INSTALLER_GUI="${LB_DEBIAN_INSTALLER_GUI:-true}"
if [ -z "${LB_DEBIAN_INSTALLER_PRESEEDFILE}" ]
then
if Find_files config/debian-installer/preseed.cfg
then
LB_DEBIAN_INSTALLER_PRESEEDFILE="/preseed.cfg"
fi
if Find_files config/debian-installer/*.cfg && [ ! -e config/debian-installer/preseed.cfg ]
then
Echo_warning "You have placed some preseeding files into config/debian-installer but you didn't specify the default preseeding file through LB_DEBIAN_INSTALLER_PRESEEDFILE. This means that debian-installer will not take up a preseeding file by default."
fi
fi
case "${LB_INITRAMFS}" in
live-boot)
LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE:-boot=live components quiet splash}"
LB_BOOTAPPEND_LIVE_FAILSAFE="${LB_BOOTAPPEND_LIVE_FAILSAFE:-boot=live components memtest noapic noapm nodma nomce nolapic nomodeset nosmp nosplash vga=788}"
;;
none)
LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE:-quiet splash}"
LB_BOOTAPPEND_LIVE_FAILSAFE="${LB_BOOTAPPEND_LIVE_FAILSAFE:-memtest noapic noapm nodma nomce nolapic nomodeset nosmp nosplash vga=788}"
;;
esac
local _LB_BOOTAPPEND_PRESEED
if [ -n "${LB_DEBIAN_INSTALLER_PRESEEDFILE}" ]
then
case "${LB_IMAGE_TYPE}" in
iso|iso-hybrid)
_LB_BOOTAPPEND_PRESEED="file=/cdrom/install/${LB_DEBIAN_INSTALLER_PRESEEDFILE}"
;;
hdd)
_LB_BOOTAPPEND_PRESEED="file=/hd-media/install/${LB_DEBIAN_INSTALLER_PRESEEDFILE}"
;;
netboot)
case "${LB_DEBIAN_INSTALLER_PRESEEDFILE}" in
2008-08-12 20:21:40 +00:00
*://*)
_LB_BOOTAPPEND_PRESEED="file=${LB_DEBIAN_INSTALLER_PRESEEDFILE}"
2008-08-12 20:21:40 +00:00
;;
*)
_LB_BOOTAPPEND_PRESEED="file=/${LB_DEBIAN_INSTALLER_PRESEEDFILE}"
2008-08-12 20:21:40 +00:00
;;
esac
;;
tar)
;;
esac
fi
if [ -n ${_LB_BOOTAPPEND_PRESEED} ]
then
LB_BOOTAPPEND_INSTALL="${LB_BOOTAPPEND_INSTALL} ${_LB_BOOTAPPEND_PRESEED}"
fi
LB_BOOTAPPEND_INSTALL="$(echo ${LB_BOOTAPPEND_INSTALL} | sed -e 's/[ \t]*$//')"
LB_ISO_APPLICATION="${LB_ISO_APPLICATION:-Debian Live}"
LB_ISO_PREPARER="${LB_ISO_PREPARER:-live-build \$VERSION; https://salsa.debian.org/live-team/live-build}"
LB_ISO_PUBLISHER="${LB_ISO_PUBLISHER:-Debian Live project; https://wiki.debian.org/DebianLive; debian-live@lists.debian.org}"
LB_ISO_VOLUME="${LB_ISO_VOLUME:-Debian ${LB_DISTRIBUTION} \$(date +%Y%m%d-%H:%M)}"
2007-09-23 08:04:52 +00:00
LB_HDD_LABEL="${LB_HDD_LABEL:-DEBIAN_LIVE}"
LB_HDD_SIZE="${LB_HDD_SIZE:-auto}"
2013-03-13 19:28:12 -01:00
LB_MEMTEST="${LB_MEMTEST:-none}"
if [ "${LB_MEMTEST}" = "false" ]; then
LB_MEMTEST="none"
Echo_warning "A value of 'false' for option LB_MEMTEST is deprecated, please use 'none' in future."
fi
2007-09-23 08:04:46 +00:00
case "${LB_ARCHITECTURE}" in
amd64|i386)
if [ "${LB_DEBIAN_INSTALLER}" != "none" ]; then
LB_LOADLIN="${LB_LOADLIN:-true}"
else
LB_LOADLIN="${LB_LOADLIN:-false}"
fi
;;
*)
LB_LOADLIN="${LB_LOADLIN:-false}"
;;
esac
case "${LB_ARCHITECTURE}" in
amd64|i386)
if [ "${LB_DEBIAN_INSTALLER}" != "none" ]; then
LB_WIN32_LOADER="${LB_WIN32_LOADER:-true}"
else
LB_WIN32_LOADER="${LB_WIN32_LOADER:-false}"
fi
2010-12-27 16:12:36 -01:00
;;
2010-12-27 16:12:36 -01:00
*)
LB_WIN32_LOADER="${LB_WIN32_LOADER:-false}"
2010-12-27 16:12:36 -01:00
;;
esac
LB_NET_TARBALL="${LB_NET_TARBALL:-true}"
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="${LB_ONIE:-false}"
LB_ONIE_KERNEL_CMDLINE="${LB_ONIE_KERNEL_CMDLINE:-}"
LB_FIRMWARE_CHROOT="${LB_FIRMWARE_CHROOT:-true}"
LB_FIRMWARE_BINARY="${LB_FIRMWARE_BINARY:-true}"
LB_SWAP_FILE_SIZE="${LB_SWAP_FILE_SIZE:-512}"
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="${LB_UEFI_SECURE_BOOT:-auto}"
LB_SOURCE="${LB_SOURCE:-false}"
LB_SOURCE_IMAGES="${LB_SOURCE_IMAGES:-tar}"
LB_SOURCE_IMAGES="$(echo "${LB_SOURCE_IMAGES}" | tr "," " ")"
# Foreign/port bootstrapping
if [ -n "${LB_BOOTSTRAP_QEMU_ARCHITECTURES}" ]; then
LB_BOOTSTRAP_QEMU_ARCHITECTURE="${LB_BOOTSTRAP_QEMU_ARCHITECTURES}"
unset LB_BOOTSTRAP_QEMU_ARCHITECTURES
Echo_warning "LB_BOOTSTRAP_QEMU_ARCHITECTURES was renamed to LB_BOOTSTRAP_QEMU_ARCHITECTURE, please updated your config."
fi
LB_BOOTSTRAP_QEMU_ARCHITECTURE="${LB_BOOTSTRAP_QEMU_ARCHITECTURE:-}"
LB_BOOTSTRAP_QEMU_EXCLUDE="${LB_BOOTSTRAP_QEMU_EXCLUDE:-}"
LB_BOOTSTRAP_QEMU_STATIC="${LB_BOOTSTRAP_QEMU_STATIC:-}"
2007-09-23 08:04:46 +00:00
}
Validate_config ()
{
Validate_config_permitted_values
Validate_config_dependencies
}
# Check values are individually permitted, including:
# - value in list of available values
# - string lengths within permitted ranges
Validate_config_permitted_values ()
{
if [ "${LB_APT_INDICES}" != "true" ] && [ "${LB_APT_INDICES}" != "false" ]; then
Echo_error "Value for LB_APT_INDICES (--apt-indices) can only be 'true' or 'false'!"
exit 1
fi
if [ "${LB_APT_RECOMMENDS}" != "true" ] && [ "${LB_APT_RECOMMENDS}" != "false" ]; then
Echo_error "Value for LB_APT_RECOMMENDS (--apt-recommends) can only be 'true' or 'false'!"
exit 1
fi
if [ "${LB_APT_SECURE}" != "true" ] && [ "${LB_APT_SECURE}" != "false" ]; then
Echo_error "Value for LB_APT_SECURE (--apt-secure) can only be 'true' or 'false'!"
exit 1
fi
if [ "${LB_APT_SOURCE_ARCHIVES}" != "true" ] && [ "${LB_APT_SOURCE_ARCHIVES}" != "false" ]; then
Echo_error "Value for LB_APT_SOURCE_ARCHIVES (--apt-source-archives) can only be 'true' or 'false'!"
exit 1
fi
if [ "${LB_BACKPORTS}" != "true" ] && [ "${LB_BACKPORTS}" != "false" ]; then
Echo_error "Value for LB_BACKPORTS (--backports) can only be 'true' or 'false'!"
exit 1
fi
if [ "${LB_BUILD_WITH_CHROOT}" != "true" ] && [ "${LB_BUILD_WITH_CHROOT}" != "false" ]; then
Echo_error "Value for LB_BUILD_WITH_CHROOT (--build-with-chroot) can only be 'true' or 'false'!"
exit 1
fi
if [ "${LB_CACHE}" != "true" ] && [ "${LB_CACHE}" != "false" ]; then
Echo_error "Value for LB_CACHE (--cache) can only be 'true' or 'false'!"
exit 1
fi
if [ "${LB_CACHE_INDICES}" != "true" ] && [ "${LB_CACHE_INDICES}" != "false" ]; then
Echo_error "Value for LB_CACHE_INDICES (--cache-indices) can only be 'true' or 'false'!"
exit 1
fi
if [ "${LB_CACHE_PACKAGES}" != "true" ] && [ "${LB_CACHE_PACKAGES}" != "false" ]; then
Echo_error "Value for LB_CACHE_PACKAGES (--cache-packages) can only be 'true' or 'false'!"
exit 1
fi
if [ "${LB_DEBIAN_INSTALLER_GUI}" != "true" ] && [ "${LB_DEBIAN_INSTALLER_GUI}" != "false" ]; then
Echo_error "Value for LB_DEBIAN_INSTALLER_GUI (--debian-installer-gui) can only be 'true' or 'false'!"
exit 1
fi
if [ "${LB_FIRMWARE_BINARY}" != "true" ] && [ "${LB_FIRMWARE_BINARY}" != "false" ]; then
Echo_error "Value for LB_FIRMWARE_BINARY (--firmware-binary) can only be 'true' or 'false'!"
exit 1
fi
if [ "${LB_FIRMWARE_CHROOT}" != "true" ] && [ "${LB_FIRMWARE_CHROOT}" != "false" ]; then
Echo_error "Value for LB_FIRMWARE_CHROOT (--firmware-chroot) can only be 'true' or 'false'!"
exit 1
fi
if [ "${LB_LOADLIN}" != "true" ] && [ "${LB_LOADLIN}" != "false" ]; then
Echo_error "Value for LB_LOADLIN (--loadlin) can only be 'true' or 'false'!"
exit 1
fi
if [ "${LB_NET_TARBALL}" != "true" ] && [ "${LB_NET_TARBALL}" != "false" ]; then
Echo_error "Value for LB_NET_TARBALL (--net-tarball) can only be 'true' or 'false'!"
exit 1
fi
if [ "${LB_ONIE}" != "true" ] && [ "${LB_ONIE}" != "false" ]; then
Echo_error "Value for LB_ONIE (--onie) can only be 'true' or 'false'!"
exit 1
fi
if [ "${LB_SECURITY}" != "true" ] && [ "${LB_SECURITY}" != "false" ]; then
Echo_error "Value for LB_SECURITY (--security) can only be 'true' or 'false'!"
exit 1
fi
if [ "${LB_SOURCE}" != "true" ] && [ "${LB_SOURCE}" != "false" ]; then
Echo_error "Value for LB_SOURCE (--source) can only be 'true' or 'false'!"
exit 1
fi
if [ "${LB_UPDATES}" != "true" ] && [ "${LB_UPDATES}" != "false" ]; then
Echo_error "Value for LB_UPDATES (--updates) can only be 'true' or 'false'!"
exit 1
fi
if [ "${LB_WIN32_LOADER}" != "true" ] && [ "${LB_WIN32_LOADER}" != "false" ]; then
Echo_error "Value for LB_WIN32_LOADER (--win32-loader) can only be 'true' or 'false'!"
exit 1
fi
if [ "${LB_ZSYNC}" != "true" ] && [ "${LB_ZSYNC}" != "false" ]; then
Echo_error "Value for LB_ZSYNC (--zsync) can only be 'true' or 'false'!"
exit 1
fi
if ! In_list "${LB_APT}" apt apt-get aptitude; then
Echo_error "You have specified an invalid value for LB_APT (--apt)."
exit 1
fi
if ! In_list "${LB_BINARY_FILESYSTEM}" fat16 fat32 ext2 ext3 ext4 ntfs; then
Echo_error "You have specified an invalid value for LB_BINARY_FILESYSTEM (--binary-filesystem)."
exit 1
fi
if ! In_list "${LB_IMAGE_TYPE}" iso iso-hybrid hdd tar netboot; then
Echo_error "You have specified an invalid value for --binary-image."
2020-03-28 07:08:11 -01:00
exit 1
fi
if [ -z "${LB_BOOTLOADERS}" ]; then
Echo_warning "You have specified no bootloaders; I predict that you will experience some problems!"
else
local BOOTLOADER
for BOOTLOADER in ${LB_BOOTLOADERS}; do
if ! In_list "${BOOTLOADER}" grub-legacy grub-pc grub-efi syslinux; then
Echo_error "The following is not a valid bootloader: '%s'" "${BOOTLOADER}"
exit 1
fi
done
fi
local CACHE_STAGE
for CACHE_STAGE in ${LB_CACHE_STAGES}; do
if ! In_list "${CACHE_STAGE}" bootstrap chroot installer binary source; then
Echo_warning "The following is not a valid stage: '%s'" "${CACHE_STAGE}"
fi
done
if ! In_list "${LB_CHECKSUMS}" md5 sha1 sha224 sha256 sha384 sha512 none; then
Echo_error "You have specified an invalid value for LB_CHECKSUMS (--checksums)."
exit 1
fi
if ! In_list "${LB_CHROOT_FILESYSTEM}" ext2 ext3 ext4 squashfs jffs2 none; then
Echo_error "You have specified an invalid value for LB_CHROOT_FILESYSTEM (--chroot-filesystem)."
exit 1
fi
if ! In_list "${LB_COMPRESSION}" bzip2 gzip lzip xz none; then
Echo_error "You have specified an invalid value for LB_COMPRESSION (--compression)."
exit 1
fi
if ! In_list "${LB_DEBCONF_FRONTEND}" dialog editor noninteractive readline; then
Echo_error "You have specified an invalid value for LB_DEBCONF_FRONTEND (--debconf-frontend)."
exit 1
fi
if ! In_list "${LB_DEBCONF_PRIORITY}" low medium high critical; then
Echo_error "You have specified an invalid value for LB_DEBCONF_PRIORITY (--debconf-priority)."
exit 1
fi
if ! In_list "${LB_DEBIAN_INSTALLER}" cdrom netinst netboot businesscard live none; then
Echo_error "You have specified an invalid value for LB_DEBIAN_INSTALLER (--debian-installer)."
exit 1
fi
2020-03-28 07:08:11 -01:00
if echo ${LB_HDD_LABEL} | grep -qs ' '; then
Echo_error "Whitespace is not currently supported in HDD labels (LB_HDD_LABEL; --hdd-label)."
exit 1
fi
if ! In_list "${LB_INITRAMFS}" none live-boot; then
Echo_error "You have specified an invalid value for LB_INITRAMFS (--initramfs)."
exit 1
fi
if ! In_list "${LB_INITRAMFS_COMPRESSION}" bzip2 gzip lzma; then
Echo_error "You have specified an invalid value for LB_INITRAMFS_COMPRESSION (--initramfs-compression)."
exit 1
fi
if ! In_list "${LB_INITSYSTEM}" sysvinit systemd none; then
Echo_error "You have specified an invalid value for LB_INITSYSTEM (--initsystem)."
exit 1
fi
if ! In_list "${LB_INTERACTIVE}" true shell x11 xnest false; then
Echo_error "You have specified an invalid value for LB_INTERACTIVE (--interactive)."
exit 1
fi
if [ "$(echo \"${LB_ISO_APPLICATION}\" | wc -c)" -gt 128 ]; then
Echo_warning "You have specified a value of LB_ISO_APPLICATION (--iso-application) that is too long; the maximum length is 128 characters."
fi
if [ "$(echo \"${LB_ISO_PREPARER}\" | wc -c)" -gt 128 ]; then
Echo_warning "You have specified a value of LB_ISO_PREPARER (--iso-preparer) that is too long; the maximum length is 128 characters."
fi
if [ "$(echo \"${LB_ISO_PUBLISHER}\" | wc -c)" -gt 128 ]; then
Echo_warning "You have specified a value of LB_ISO_PUBLISHER (--iso-publisher) that is too long; the maximum length is 128 characters."
fi
if [ "$(eval "echo \"${LB_ISO_VOLUME}\"" | wc -c)" -gt 32 ]; then
Echo_warning "You have specified a value of LB_ISO_VOLUME (--iso-volume) that is too long; the maximum length is 32 characters."
fi
if ! In_list "${LB_MEMTEST}" memtest86+ memtest86 none; then
Echo_error "You have specified an invalid value for LB_MEMTEST (--memtest)."
exit 1
fi
if ! In_list "${LB_SOURCE_IMAGES}" iso netboot tar hdd; then
Echo_error "You have specified an invalid value for LB_SOURCE_IMAGES (--source-images)."
exit 1
fi
if ! In_list "${LB_SYSTEM}" live normal; then
Echo_error "You have specified an invalid value for LB_SYSTEM (--system)."
exit 1
fi
if ! In_list "${LB_UEFI_SECURE_BOOT}" auto enable disable; then
Echo_error "You have specified an invalid value for LB_UEFI_SECURE_BOOT (--uefi-secure-boot)."
exit 1
fi
}
# Check option combinations and other extra stuff
Validate_config_dependencies ()
{
if [ "${LB_BINARY_FILESYSTEM}" = "ntfs" ] && ! command -v ntfs-3g >/dev/null; then
Echo_error "Using ntfs as the binary filesystem is currently only supported if ntfs-3g is installed on the host system."
exit 1
fi
2020-03-28 07:08:11 -01:00
if [ "${LB_DEBIAN_INSTALLER}" != "none" ]; then
# d-i true, no caching
if ! In_list "bootstrap" ${LB_CACHE_STAGES} || [ "${LB_CACHE}" != "true" ] || [ "${LB_CACHE_PACKAGES}" != "true" ]
then
Echo_warning "You have selected values of LB_CACHE, LB_CACHE_PACKAGES, LB_CACHE_STAGES and LB_DEBIAN_INSTALLER which will result in 'bootstrap' packages not being cached. This configuration is potentially unsafe as the bootstrap packages are re-used when integrating the Debian Installer."
fi
fi
2020-03-28 07:08:11 -01:00
if [ "${LB_FIRST_BOOTLOADER}" = "syslinux" ]; then
# syslinux + fat or ntfs, or extlinux + ext[234] or btrfs
2020-03-28 07:08:11 -01:00
if ! In_list "${LB_BINARY_FILESYSTEM}" fat16 fat32 ntfs ext2 ext3 ext4 btrfs; then
Echo_warning "You have selected values of LB_BOOTLOADERS and LB_BINARY_FILESYSTEM which are incompatible - the syslinux family only support FAT, NTFS, ext[234] or btrfs filesystems."
fi
fi
if In_list "grub-pc" ${LB_BOOTLOADERS} || In_list "grub-efi" ${LB_BOOTLOADERS} || In_list "grub-legacy" ${LB_BOOTLOADERS}; then
if In_list "${LB_IMAGE_TYPE}" hdd netboot; then
Echo_error "You have selected an invalid combination of bootloaders and live image type; the grub-* bootloaders are not compatible with hdd and netboot types."
exit 1
fi
fi
}