summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build/chroot_hooks24
1 files changed, 21 insertions, 3 deletions
diff --git a/scripts/build/chroot_hooks b/scripts/build/chroot_hooks
index ff06eac3e..4e3702b14 100755
--- a/scripts/build/chroot_hooks
+++ b/scripts/build/chroot_hooks
@@ -72,12 +72,20 @@ rmdir chroot/root/lb_chroot_hooks
rmdir --ignore-fail-on-non-empty chroot/root
## 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
+ # 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
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
if [ ! -e "${HOOK}" ]
then
@@ -94,7 +102,17 @@ then
fi
# 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
rm -f chroot/root/"$(basename ${HOOK})"