mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-03-25 09:51:23 +00:00
Run live specific scripts on non live layers
Allow execution of lb_binary_linux-image and lb_chroot_live-packages on any layer by setting LIVE_PASSES.
This commit is contained in:
parent
d1a2e24c41
commit
52d9bd3ead
@ -260,6 +260,22 @@ _sanitize_passes ()
|
||||
echo $passes
|
||||
}
|
||||
|
||||
_get_live_passes ()
|
||||
{
|
||||
# Returns a list of all passes that ends with .live for automated live passes detection
|
||||
# $1 list of passes
|
||||
local passes="$1"
|
||||
local livepasses=""
|
||||
[ -z "$passes" ] && return
|
||||
|
||||
for pass in $passes; do
|
||||
if echo $pass | grep -Eq '\.live*'; then
|
||||
livepasses="$pass $livepasses"
|
||||
fi
|
||||
done
|
||||
echo $livepasses
|
||||
}
|
||||
|
||||
if [ -z "${IMAGEFORMAT:-}" ]; then
|
||||
case $PROJECT:${SUBPROJECT:-} in
|
||||
ubuntu-cpc:*)
|
||||
@ -1031,6 +1047,12 @@ lb config noauto \
|
||||
"$@"
|
||||
|
||||
PASSES=$(_sanitize_passes "$PASSES")
|
||||
LIVE_PASSES=${LIVE_PASSES:-$(_get_live_passes "$PASSES")}
|
||||
|
||||
if [ -n "$PASSES" ] && [ -z "$LIVE_PASSES" ]; then
|
||||
Echo_warning "Multi-layered mode is enabled, but we didn't find any live pass." \
|
||||
"Either set \$LIVE_PASSES or add a pass ending with '.live'."
|
||||
fi
|
||||
|
||||
echo "LB_CHROOT_HOOKS=\"$CHROOT_HOOKS\"" >> config/chroot
|
||||
echo "SUBPROJECT=\"${SUBPROJECT:-}\"" >> config/chroot
|
||||
@ -1038,6 +1060,9 @@ echo "LB_DISTRIBUTION=\"$SUITE\"" >> config/chroot
|
||||
if [ -n "$PASSES" ]; then
|
||||
echo "PASSES=\"$PASSES\"" >> config/common
|
||||
fi
|
||||
if [ -n "$LIVE_PASSES" ]; then
|
||||
echo "LIVE_PASSES=\"$LIVE_PASSES\"" >> config/common
|
||||
fi
|
||||
echo "LB_BINARY_HOOKS=\"$BINARY_HOOKS\"" >> config/binary
|
||||
echo "BUILDSTAMP=\"$NOW\"" >> config/binary
|
||||
echo "SUBPROJECT=\"${SUBPROJECT:-}\"" >> config/binary
|
||||
|
@ -100,10 +100,14 @@ build_layered_squashfs () {
|
||||
# Prepare initrd + kernel
|
||||
# Main manifest and size files
|
||||
prefix="livecd.$PROJECT${SUBARCH:+-$SUBARCH}"
|
||||
if echo $pass | grep -Eq '\.live*' && test ! -e "${prefix}.manifest"; then
|
||||
lb binary_linux-image ${*}
|
||||
cp ${squashfs_f_size} "${prefix}.size"
|
||||
cp "${squashfs_f_manifest}.full" "${prefix}.manifest"
|
||||
if [ ! -e "${prefix}.manifest" ]; then
|
||||
for livepass in $LIVE_PASSES; do
|
||||
[ "$livepass" != "$pass" ] && continue
|
||||
lb binary_linux-image ${*}
|
||||
cp ${squashfs_f_size} "${prefix}.size"
|
||||
cp "${squashfs_f_manifest}.full" "${prefix}.manifest"
|
||||
break
|
||||
done
|
||||
fi
|
||||
|
||||
(cd "overlay.${pass}/" &&
|
||||
|
@ -220,9 +220,11 @@ create_chroot_pass () {
|
||||
Chroot chroot "apt-get --purge -y autoremove"
|
||||
|
||||
# Add live packages to live layers
|
||||
if echo $pass | grep -Eq '\.live*'; then
|
||||
for livepass in $LIVE_PASSES; do
|
||||
[ "$livepass" != "$pass" ] && continue
|
||||
lb chroot_live-packages ${*}
|
||||
fi
|
||||
break
|
||||
done
|
||||
|
||||
# Run includes by pass
|
||||
lb_chroot_includes ${pass} ${*}
|
||||
|
Loading…
x
Reference in New Issue
Block a user