Option for using systemd-nspawn instead of chroot for hooks.
Installation of flatpaks doesn't work with normal chroots. This patch enables support for using systemd-nspawn in hooks. Gbp-Dch: Short Closes: #965953
This commit is contained in:
parent
59380dddf0
commit
7b19209aae
|
@ -27,6 +27,7 @@ Recommends:
|
||||||
live-boot-doc,
|
live-boot-doc,
|
||||||
live-config-doc,
|
live-config-doc,
|
||||||
live-manual-html | live-manual,
|
live-manual-html | live-manual,
|
||||||
|
systemd-container,
|
||||||
wget,
|
wget,
|
||||||
xz-utils,
|
xz-utils,
|
||||||
Suggests:
|
Suggests:
|
||||||
|
|
|
@ -72,12 +72,20 @@ rmdir chroot/root/lb_chroot_hooks
|
||||||
rmdir --ignore-fail-on-non-empty chroot/root
|
rmdir --ignore-fail-on-non-empty chroot/root
|
||||||
|
|
||||||
## Processing local hooks
|
## Processing local hooks
|
||||||
if ls config/hooks/normal/*.chroot config/hooks/live/*.chroot > /dev/null 2>&1
|
if ls config/hooks/normal/*.chroot > /dev/null 2>&1 && (
|
||||||
|
ls config/hooks/live/*.chroot > /dev/null 2>&1 ||
|
||||||
|
ls config/hooks/live/*.container > /dev/null 2>&1 )
|
||||||
then
|
then
|
||||||
|
# If a systemd-nspawn hook exists check if package is installed
|
||||||
|
if ls config/hooks/live/*.container > /dev/null 2>&1
|
||||||
|
then
|
||||||
|
Check_package host /usr/bin/systemd-nspawn systemd-container
|
||||||
|
fi
|
||||||
|
|
||||||
# Restoring cache
|
# Restoring cache
|
||||||
Restore_package_cache chroot
|
Restore_package_cache chroot
|
||||||
|
|
||||||
for HOOK in config/hooks/normal/*.chroot config/hooks/live/*.chroot
|
for HOOK in config/hooks/normal/*.chroot config/hooks/live/*.chroot config/hooks/live/*.container
|
||||||
do
|
do
|
||||||
if [ ! -e "${HOOK}" ]
|
if [ ! -e "${HOOK}" ]
|
||||||
then
|
then
|
||||||
|
@ -94,7 +102,17 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Executing hook
|
# Executing hook
|
||||||
Chroot chroot "/root/$(basename ${HOOK})" || { Echo_error "${HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;}
|
Echo_message "Executing hook ${HOOK}..."
|
||||||
|
case "${HOOK}" in
|
||||||
|
*.container)
|
||||||
|
umount chroot/proc
|
||||||
|
systemd-nspawn --capability=all -D chroot "/root/$(basename ${HOOK})" || { Echo_error "${HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;}
|
||||||
|
mount proc-live -t proc chroot/proc
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
Chroot chroot "/root/$(basename ${HOOK})" || { Echo_error "${HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;}
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Removing hook
|
# Removing hook
|
||||||
rm -f chroot/root/"$(basename ${HOOK})"
|
rm -f chroot/root/"$(basename ${HOOK})"
|
||||||
|
|
Loading…
Reference in New Issue