Adds is_root_layer

Factored the code to detect if a layer is a root layer in function
is_root_layer and execute lb_chroot_archives only on root layers.
sil2100/core18-pi3-arm64
Jean-Baptiste Lallement 6 years ago
parent 283871573d
commit 402cdd15be

@ -759,3 +759,11 @@ rm -f /usr/sbin/update-initramfs
dpkg-divert --quiet --remove --rename /usr/sbin/update-initramfs dpkg-divert --quiet --remove --rename /usr/sbin/update-initramfs
EOF EOF
} }
is_root_layer () {
local pass=$1
if [ -z "$(get_parent_pass $pass)" ]; then
return 0
fi
return 1
}

@ -120,7 +120,7 @@ create_chroot_pass () {
# Only get some function executed on root passes # Only get some function executed on root passes
# Copy bootstrap on root layers # Copy bootstrap on root layers
if [ -z "$(get_parent_pass $pass)" ]; then if $(is_root_layer $pass); then
rm -f .build/chroot_linux-image .build/chroot_preseed .build/chroot_hacks rm -f .build/chroot_linux-image .build/chroot_preseed .build/chroot_hacks
cp -a chroot.bootstrap/ "$overlay_dir/" cp -a chroot.bootstrap/ "$overlay_dir/"
fi fi
@ -144,7 +144,7 @@ create_chroot_pass () {
lb chroot_proc install ${*} lb chroot_proc install ${*}
lb chroot_sysfs install ${*} lb chroot_sysfs install ${*}
# We run chroot_hacks only on root layers (update-initramfs diverted) # We run chroot_hacks only on root layers (update-initramfs diverted)
if [ -z "$(get_parent_pass $pass)" ]; then if $(is_root_layer $pass); then
divert_update_initramfs divert_update_initramfs
fi fi
lb chroot_debianchroot install ${*} lb chroot_debianchroot install ${*}
@ -155,13 +155,11 @@ create_chroot_pass () {
lb chroot_hostname install ${*} lb chroot_hostname install ${*}
lb chroot_apt install ${*} lb chroot_apt install ${*}
# Note: this triggers an upgrade + dist-ugprade; which may impact sublayers with more # Note: this triggers an upgrade + dist-ugprade; which may impact sublayers with more
# diff content than desired. However, we still need to setup the archive and teardown # diff content than desired. So only running this on root pass.
# for each layer. # Also configure universe
# We could modify livebuild if necessary to have conditional upgrade (root pass only).
lb chroot_archives chroot install ${*}
# Only configure universe on root passes # Only configure universe on root passes
if [ -z "$(get_parent_pass $pass)" ]; then if $(is_root_layer $pass); then
lb chroot_archives chroot install ${*}
configure_universe configure_universe
fi fi
@ -215,7 +213,9 @@ create_chroot_pass () {
Chroot chroot "dpkg-query -W" > chroot.packages.${pass} Chroot chroot "dpkg-query -W" > chroot.packages.${pass}
# Deconfiguring chroot # Deconfiguring chroot
if $(is_root_layer $pass); then
lb chroot_archives chroot remove ${*} lb chroot_archives chroot remove ${*}
fi
lb chroot_apt remove ${*} lb chroot_apt remove ${*}
lb chroot_hostname remove ${*} lb chroot_hostname remove ${*}
lb chroot_resolv remove ${*} lb chroot_resolv remove ${*}

Loading…
Cancel
Save