Merge branch 'sysvinit' into 'master'

debootstrap: fix use of sysvinit (Closes #992916)

See merge request live-team/live-build!257
This commit is contained in:
Lyndon Brown 2024-09-03 21:59:18 +00:00
commit d2aee0f794
2 changed files with 32 additions and 1 deletions

View File

@ -73,6 +73,11 @@ else
DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --force-check-gpg"
fi
if [ "${LB_INITSYSTEM}" = "sysvinit" ]
then
DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --include=sysvinit-core --exclude=systemd,systemd-sysv,systemd-timesyncd"
fi
if [ "${LB_CACHE_PACKAGES}" = "true" ]
then
if ls cache/packages.bootstrap/*.deb > /dev/null 2>&1
@ -96,6 +101,17 @@ fi
Print_breakage
Echo_message "Running debootstrap..."
Disable_systemd_hack ()
{
# note, these cope with both a space separated list form and one package per line form to
# account for potential differences between debootstrap versions.
# note, do **not** try to remove `libsystemd0` from `chroot/debootstrap/required`, this is
# required by `apt` and will break the setup.
sed -i -e 's/ systemd / /g' -e '/systemd/d' chroot/debootstrap/base
sed -i -e 's/ systemd-sysv / /g' -e '/systemd-sysv/d' chroot/debootstrap/base
sed -i -e 's/ systemd-timesyncd / /g' -e '/systemd-timesyncd/d' chroot/debootstrap/base
}
# Run appropriate bootstrap, i.e. foreign or regular bootstrap
if [ -n "${LB_BOOTSTRAP_QEMU_ARCHITECTURE}" ]; then
@ -107,8 +123,23 @@ if [ -n "${LB_BOOTSTRAP_QEMU_ARCHITECTURE}" ]; then
Echo_message "Bootstrap will be foreign"
debootstrap ${DEBOOTSTRAP_OPTIONS} --foreign "${LB_PARENT_DISTRIBUTION_CHROOT}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" ${DEBOOTSTRAP_SCRIPT}
if [ "${LB_INITSYSTEM}" = "sysvinit" ]; then
Disable_systemd_hack
fi
Echo_message "Running debootstrap second stage under QEMU"
Chroot chroot /bin/sh /debootstrap/debootstrap --second-stage ${FOREIGN_DEBOOTSTRAP_OPTIONS}
elif [ "${LB_INITSYSTEM}" = "sysvinit" ]; then
Echo_message "Performing first stage of two-stage setup for sysvinit issue workaround"
debootstrap ${DEBOOTSTRAP_OPTIONS} --foreign "${LB_PARENT_DISTRIBUTION_CHROOT}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" ${DEBOOTSTRAP_SCRIPT}
Disable_systemd_hack
Echo_message "Running debootstrap second stage"
Chroot chroot /bin/sh /debootstrap/debootstrap --second-stage ${FOREIGN_DEBOOTSTRAP_OPTIONS}
else
debootstrap ${DEBOOTSTRAP_OPTIONS} "${LB_PARENT_DISTRIBUTION_CHROOT}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" ${DEBOOTSTRAP_SCRIPT}
fi

View File

@ -1381,7 +1381,7 @@ if [ ! -e "${LIVE_PKG_LIST}" ]; then
;;
sysvinit)
NEEDED_PACKAGES="${NEEDED_PACKAGES} live-config-sysvinit sysvinit-core"
NEEDED_PACKAGES="${NEEDED_PACKAGES} live-config-sysvinit"
;;
esac
fi