Add support for dracut
Mini case: `lb config --distribution sid --debian-installer none --cache-packages false --archive-areas "main" --initramfs dracut-live` Support includes debian-installer and Calamares Closes: #1031903
This commit is contained in:
parent
9ae2c0105c
commit
567e03034b
|
@ -303,7 +303,11 @@ Prepare_config ()
|
|||
|
||||
case "${LB_ARCHITECTURE}" in
|
||||
amd64|i386)
|
||||
LB_BOOTLOADER_BIOS="${LB_BOOTLOADER_BIOS:-syslinux}"
|
||||
if [ "${LB_INITRAMFS}" = "dracut-live" ]; then
|
||||
LB_BOOTLOADER_BIOS="${LB_BOOTLOADER_BIOS:-grub-pc}"
|
||||
else
|
||||
LB_BOOTLOADER_BIOS="${LB_BOOTLOADER_BIOS:-syslinux}"
|
||||
fi
|
||||
if ! In_list "${LB_IMAGE_TYPE}" hdd netboot; then
|
||||
LB_BOOTLOADER_EFI="${LB_BOOTLOADER_EFI:-grub-efi}"
|
||||
fi
|
||||
|
@ -385,12 +389,25 @@ Prepare_config ()
|
|||
fi
|
||||
fi
|
||||
|
||||
LB_ISO_APPLICATION="${LB_ISO_APPLICATION:-Debian Live}"
|
||||
LB_ISO_PREPARER="${LB_ISO_PREPARER:-live-build @LB_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}"
|
||||
# The string @ISOVOLUME_TS@ must have the same length as the output of `date +%Y%m%d-%H:%M`
|
||||
LB_ISO_VOLUME="${LB_ISO_VOLUME:-Debian ${LB_DISTRIBUTION} @ISOVOLUME_TS@}"
|
||||
|
||||
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 nosmp nosplash vga=788}"
|
||||
;;
|
||||
|
||||
dracut-live)
|
||||
# Replace all spaces with underscore for the CD label
|
||||
LB_ISO_VOLUME="$(echo "${LB_ISO_VOLUME}" | tr " " "_")"
|
||||
LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE:-boot=live components quiet splash rd.live.image root=live:CDLABEL=${LB_ISO_VOLUME} rd.live.dir=live rd.live.squashimg=filesystem.squashfs}"
|
||||
LB_BOOTAPPEND_LIVE_FAILSAFE="${LB_BOOTAPPEND_LIVE_FAILSAFE:-boot=live components memtest noapic noapm nodma nomce nosmp nosplash vga=788 rd.live.image root=live:CDLABEL=${LB_ISO_VOLUME} rd.live.dir=live rd.live.squashimg=filesystem.squashfs}"
|
||||
;;
|
||||
|
||||
none)
|
||||
LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE:-quiet splash}"
|
||||
LB_BOOTAPPEND_LIVE_FAILSAFE="${LB_BOOTAPPEND_LIVE_FAILSAFE:-memtest noapic noapm nodma nomce nosmp nosplash vga=788}"
|
||||
|
@ -433,12 +450,6 @@ Prepare_config ()
|
|||
|
||||
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 @LB_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}"
|
||||
# The string @ISOVOLUME_TS@ must have the same length as the output of `date +%Y%m%d-%H:%M`
|
||||
LB_ISO_VOLUME="${LB_ISO_VOLUME:-Debian ${LB_DISTRIBUTION} @ISOVOLUME_TS@}"
|
||||
|
||||
LB_HDD_LABEL="${LB_HDD_LABEL:-DEBIAN_LIVE}"
|
||||
LB_HDD_SIZE="${LB_HDD_SIZE:-auto}"
|
||||
|
||||
|
@ -697,11 +708,43 @@ Validate_config_permitted_values ()
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if ! In_list "${LB_INITRAMFS}" none live-boot; then
|
||||
if ! In_list "${LB_INITRAMFS}" none live-boot dracut-live; then
|
||||
Echo_error "You have specified an invalid value for LB_INITRAMFS (--initramfs)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${LB_INITRAMFS}" = "dracut-live" ]; then
|
||||
if [ "${LB_DM_VERITY}" = "true" ]; then
|
||||
Echo_error "Currently unsupported/untested: dm_verity and dracut."
|
||||
exit 1
|
||||
fi
|
||||
if [ "${LB_BOOTLOADER_BIOS}" = "grub-legacy" ]; then
|
||||
Echo_error "Currently unsupported/untested: grub-legacy and dracut."
|
||||
exit 1
|
||||
fi
|
||||
if [ "${LB_BOOTLOADER_BIOS}" = "syslinux" ]; then
|
||||
Echo_error "Currently unsupported/untested: syslinux and dracut."
|
||||
exit 1
|
||||
fi
|
||||
if ! In_list "${LB_IMAGE_TYPE}" iso iso-hybrid; then
|
||||
# The boot=live:CDLABEL requires a CD medium
|
||||
Echo_error "Currently unsupported/untested: image type ${LB_IMAGE_TYPE} and dracut."
|
||||
exit 1
|
||||
fi
|
||||
if [ "${LB_INITRAMFS_COMPRESSION}" != "gzip" ]; then
|
||||
Echo_error "Currently unsupported/untested: compression ${LB_INITRAMFS_COMPRESSION} and dracut."
|
||||
exit 1
|
||||
fi
|
||||
if [ "${LB_CHROOT_FILESYSTEM}" != "squashfs" ]; then
|
||||
Echo_error "Currently unsupported/untested: chroot filesystem ${LB_CHROOT_FILESYSTEM} and dracut."
|
||||
exit 1
|
||||
fi
|
||||
if [ "${LB_INITSYSTEM}" != systemd ]; then
|
||||
Echo_error "Currently unsupported/untested: init system ${LB_INITSYSTEM} and dracut."
|
||||
exit 1
|
||||
fi
|
||||
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
|
||||
|
|
|
@ -130,7 +130,7 @@
|
|||
.br
|
||||
[\fB\-\-image\-name\fR \fINAME\fR]
|
||||
.br
|
||||
[\fB\-\-initramfs\fR none|live\-boot]
|
||||
[\fB\-\-initramfs\fR none|live\-boot|dracut\-live]
|
||||
.br
|
||||
[\fB\-\-initramfs\-compression\fR bzip2|gzip|lzma]
|
||||
.br
|
||||
|
@ -362,8 +362,8 @@ defines the size for the HDD target. The unit is MiB. Defaults to 'auto', which
|
|||
\fBlb config\fR by default reads system defaults from \fI/etc/live/build.conf\fR and \fI/etc/live/build/*\fR when generating a new live system config directory. This is useful if you want to set global settings, such as mirror locations, and don't want to specify them all of the time. This option allows you to ignore such global settings.
|
||||
.IP "\fB\-\-image\-name\fR \fINAME\fR" 4
|
||||
sets the base name of the image. Defaults to live-image.
|
||||
.IP "\fB\-\-initramfs\fR none|live\-boot" 4
|
||||
sets the name of the package that contains the live system specific initramfs modification and defaults to live\-boot. Using 'none' is useful if the resulting system image should not be a live image (experimental).
|
||||
.IP "\fB\-\-initramfs\fR none|live\-boot|dracut\-live" 4
|
||||
sets the name of the package that contains the live system specific initramfs modification and defaults to live\-boot. Using 'none' is useful if the resulting system image should not be a live image (experimental). Note that dracut requires the CD label in the kernel command line, so you might want to set \fB\-\-iso\-volume\fR explicitly.
|
||||
.IP "\fB\-\-initramfs\-compression\fR bzip2|gzip|lzma]
|
||||
defines the compression program to be used to compress the initramfs. Defaults to 'gzip'.
|
||||
.IP "\fB\-\-initsystem\fR sysvinit|systemd|none]
|
||||
|
|
|
@ -98,6 +98,12 @@ case "${LB_INITRAMFS}" in
|
|||
INITFS="live"
|
||||
;;
|
||||
|
||||
dracut-live)
|
||||
INITFS="live"
|
||||
LB_BOOTAPPEND_LIVE="$(echo "${LB_BOOTAPPEND_LIVE}" | sed "s|@ISOVOLUME_TS@|$(date $DATE_UTC_OPTION -d@${SOURCE_DATE_EPOCH} +%Y%m%d-%H:%M)|")"
|
||||
LB_BOOTAPPEND_LIVE_FAILSAFE="$(echo "${LB_BOOTAPPEND_LIVE_FAILSAFE}" | sed "s|@ISOVOLUME_TS@|$(date $DATE_UTC_OPTION -d@${SOURCE_DATE_EPOCH} +%Y%m%d-%H:%M)|")"
|
||||
;;
|
||||
|
||||
*)
|
||||
INITFS="boot"
|
||||
;;
|
||||
|
|
|
@ -38,7 +38,7 @@ Check_stagefile
|
|||
Acquire_lockfile
|
||||
|
||||
case "${LB_INITRAMFS}" in
|
||||
live-boot)
|
||||
live-boot|dracut-live)
|
||||
DESTDIR="binary/live"
|
||||
;;
|
||||
|
||||
|
@ -71,6 +71,12 @@ case "${LB_INITRAMFS}" in
|
|||
cp chroot/usr/share/doc/live-boot/parameters.txt "${DESTDIR}"/parameters
|
||||
fi
|
||||
;;
|
||||
dracut-live)
|
||||
if [ -e chroot/usr/share/doc/live-boot/parameters.txt ]
|
||||
then
|
||||
Echo_message "The file parameters.txt will be ignored"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# Creating stage file
|
||||
|
|
|
@ -38,7 +38,7 @@ Check_stagefile
|
|||
Acquire_lockfile
|
||||
|
||||
case "${LB_INITRAMFS}" in
|
||||
live-boot)
|
||||
live-boot|dracut-live)
|
||||
INITFS="live"
|
||||
SUFFIX="packages"
|
||||
;;
|
||||
|
|
|
@ -43,7 +43,7 @@ case "${LB_ARCHITECTURE}" in
|
|||
esac
|
||||
|
||||
case "${LB_INITRAMFS}" in
|
||||
live-boot)
|
||||
live-boot|dracut-live)
|
||||
INITFS="live"
|
||||
;;
|
||||
|
||||
|
|
|
@ -62,18 +62,20 @@ esac
|
|||
# Update initramfs (always, because of udev rules in initrd)
|
||||
case "${LB_INITRAMFS}" in
|
||||
live-boot)
|
||||
#UPDATE_INITRAMFS_OPTIONS="LIVE_GENERATE_UUID=1"
|
||||
if [ ! -e chroot/initrd.img_has_already_been_regenerated ]; then
|
||||
Chroot chroot "${UPDATE_INITRAMFS_OPTIONS} update-initramfs -k all -t -u"
|
||||
fi
|
||||
;;
|
||||
dracut-live)
|
||||
# Enable the live module (with a unique name)
|
||||
echo "add_dracutmodules+=\" dmsquash-live \"" > chroot/etc/dracut.conf.d/20-live-module-${SOURCE_DATE_EPOCH}.conf
|
||||
# This ensures that dracut uses the same filename as initramfs-tools
|
||||
Chroot chroot dpkg-reconfigure dracut
|
||||
rm -f chroot/etc/dracut.conf.d/20-live-module-${SOURCE_DATE_EPOCH}.conf
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "${LB_INITRAMFS}" != "none" ]
|
||||
then
|
||||
if [ ! -e chroot/initrd.img_has_already_been_regenerated ]; then
|
||||
Chroot chroot "${UPDATE_INITRAMFS_OPTIONS} update-initramfs -k all -t -u"
|
||||
fi
|
||||
rm -f chroot/vmlinuz.old
|
||||
rm -f chroot/initrd.img.old
|
||||
fi
|
||||
rm -f chroot/vmlinuz.old
|
||||
rm -f chroot/initrd.img.old
|
||||
rm -f chroot/initrd.img_has_already_been_regenerated
|
||||
|
||||
# We probably ought to use COMPRESS= in a temporary file in
|
||||
|
@ -100,16 +102,6 @@ case "${LB_INITRAMFS_COMPRESSION}" in
|
|||
;;
|
||||
esac
|
||||
|
||||
case "${LB_INITRAMFS}" in
|
||||
live-boot)
|
||||
ID="1000"
|
||||
;;
|
||||
|
||||
*)
|
||||
ID=""
|
||||
;;
|
||||
esac
|
||||
|
||||
rm -f chroot/etc/hosts
|
||||
|
||||
if [ "${LB_DEBIAN_INSTALLER}" = "live" ]
|
||||
|
|
|
@ -76,14 +76,20 @@ then
|
|||
# Restoring cache
|
||||
Restore_package_cache chroot
|
||||
|
||||
if [ "${LB_INITRAMFS}" = "dracut-live" ]; then
|
||||
# Install each package separately, because the list contains conflicts
|
||||
_INSTALL_ONE_BY_ONE="--max-args 1"
|
||||
else
|
||||
_INSTALL_ONE_BY_ONE=""
|
||||
fi
|
||||
# Installing packages
|
||||
case "${LB_APT}" in
|
||||
apt|apt-get)
|
||||
Chroot chroot "xargs --arg-file=/root/packages.chroot apt-get ${APT_OPTIONS} install"
|
||||
Chroot chroot "xargs ${_INSTALL_ONE_BY_ONE} --arg-file=/root/packages.chroot apt-get ${APT_OPTIONS} install"
|
||||
;;
|
||||
|
||||
aptitude)
|
||||
Chroot chroot "xargs --arg-file=/root/packages.chroot aptitude ${APTITUDE_OPTIONS} install"
|
||||
Chroot chroot "xargs ${_INSTALL_ONE_BY_ONE} --arg-file=/root/packages.chroot aptitude ${APTITUDE_OPTIONS} install"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
|
@ -1383,18 +1383,28 @@ done
|
|||
LIVE_PKG_LIST="config/package-lists/live.list.chroot"
|
||||
if [ ! -e "${LIVE_PKG_LIST}" ]; then
|
||||
NEEDED_PACKAGES=""
|
||||
if [ "${LB_INITRAMFS}" = "live-boot" ]; then
|
||||
NEEDED_PACKAGES="live-boot live-config"
|
||||
case "${LB_INITSYSTEM}" in
|
||||
systemd)
|
||||
NEEDED_PACKAGES="${NEEDED_PACKAGES} live-config-systemd systemd-sysv"
|
||||
;;
|
||||
case "${LB_INITRAMFS}" in
|
||||
live-boot)
|
||||
NEEDED_PACKAGES="live-boot live-config"
|
||||
case "${LB_INITSYSTEM}" in
|
||||
systemd)
|
||||
NEEDED_PACKAGES="${NEEDED_PACKAGES} live-config-systemd systemd-sysv"
|
||||
;;
|
||||
|
||||
sysvinit)
|
||||
NEEDED_PACKAGES="${NEEDED_PACKAGES} live-config-sysvinit sysvinit-core"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
sysvinit)
|
||||
NEEDED_PACKAGES="${NEEDED_PACKAGES} live-config-sysvinit sysvinit-core"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
dracut-live)
|
||||
NEEDED_PACKAGES="live-config live-config-systemd systemd-sysv dracut-live dracut-config-generic dracut"
|
||||
# Ensure that the settings are present before dracut is installed
|
||||
mkdir -p config/includes.chroot_before_packages/etc/dracut.conf.d
|
||||
echo "reproducible=yes" > config/includes.chroot_before_packages/etc/dracut.conf.d/50-reproducible.conf
|
||||
# dracut-live (module dmsquash-live) will be enabled in chroot_hacks
|
||||
;;
|
||||
esac
|
||||
for PKG in $NEEDED_PACKAGES; do
|
||||
echo "${PKG}" >> "${LIVE_PKG_LIST}"
|
||||
done
|
||||
|
|
|
@ -873,7 +873,15 @@ EOF
|
|||
mv chroot/root/binary ./
|
||||
|
||||
# Add to sources.list with the path that is used inside the live environment
|
||||
echo "deb [trusted=yes] file:/run/live/medium ${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION} ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/chroot/etc/apt/sources.list
|
||||
case "${LB_INITRAMFS}" in
|
||||
live-boot)
|
||||
echo "deb [trusted=yes] file:/run/live/medium ${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION} ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/chroot/etc/apt/sources.list
|
||||
;;
|
||||
|
||||
dracut-live)
|
||||
echo "deb [trusted=yes] file:/run/initramfs/live ${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION} ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/chroot/etc/apt/sources.list
|
||||
;;
|
||||
esac
|
||||
|
||||
Echo_debug "Creating distribution directories/symlinks"
|
||||
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
# Adjust the remaining bits for dracut-live instead of initramfs-tools.
|
||||
|
||||
if [ ! -d /usr/share/doc/dracut-live ]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Get access to LB_PARENT_DISTRIBUTION_CHROOT
|
||||
. /live-build/config/bootstrap
|
||||
|
||||
# Remove remainder of initramfs-tools
|
||||
apt-get remove --purge --yes initramfs-tools
|
||||
# Remove live packages that work with initramfs-tools
|
||||
apt-get remove --purge --yes live-tools
|
||||
apt-get remove --purge --yes live-boot
|
||||
apt-get remove --purge --yes live-boot-initramfs-tools
|
||||
apt-get autoremove --yes
|
||||
|
||||
# Dracut mounts on /run/initramfs/live
|
||||
# d-i, calamares and debian-installer-launcher have /run/live/medium hardcoded
|
||||
# d-i -> fixed in live-build: installer_debian-installer
|
||||
# calamares -> fixed here
|
||||
# debian-installer-launcher -> probably not needed, is not part of the regular images
|
||||
|
||||
# Adjust the path for Calamares
|
||||
if [ -e /etc/calamares/modules/unpackfs.conf ]
|
||||
then
|
||||
sed -i -e 's|/run/live/medium|/run/initramfs/live|' /etc/calamares/modules/unpackfs.conf
|
||||
fi
|
||||
# Use dracut instead of initramfs-tools
|
||||
if [ -e /etc/calamares/settings.conf ]
|
||||
then
|
||||
sed -i -e '/initramfscfg/d;s/initramfs/dracut/' /etc/calamares/settings.conf
|
||||
fi
|
||||
# Add dracut-live to the list of packages to uninstall
|
||||
if [ -e /etc/calamares/modules/packages.conf ]
|
||||
then
|
||||
sed -i -e "s/'live-boot'/'dracut-live'/" /etc/calamares/modules/packages.conf
|
||||
fi
|
||||
# Calamares script for /etc/apt/sources.list during the installation
|
||||
SOURCES_MEDIA=/usr/share/calamares/helpers/calamares-sources-media
|
||||
if [ -e /usr/sbin/sources-media ]
|
||||
then
|
||||
# Until calamares-settings-debian 13.0.11 the filename was more generic
|
||||
SOURCES_MEDIA=/usr/sbin/sources-media
|
||||
fi
|
||||
if [ -e ${SOURCES_MEDIA} ]
|
||||
then
|
||||
sed -i -e 's|/run/live/medium|/run/initramfs/live|;s|/run/live|/run/initramfs|' ${SOURCES_MEDIA}
|
||||
sed -i -e "s|RELEASE=\".*\"|RELEASE=\"${LB_PARENT_DISTRIBUTION_CHROOT}\"|" ${SOURCES_MEDIA}
|
||||
fi
|
Loading…
Reference in New Issue