mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-05-06 16:31:35 +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
|
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
|
if [ -z "${IMAGEFORMAT:-}" ]; then
|
||||||
case $PROJECT:${SUBPROJECT:-} in
|
case $PROJECT:${SUBPROJECT:-} in
|
||||||
ubuntu-cpc:*)
|
ubuntu-cpc:*)
|
||||||
@ -1031,6 +1047,12 @@ lb config noauto \
|
|||||||
"$@"
|
"$@"
|
||||||
|
|
||||||
PASSES=$(_sanitize_passes "$PASSES")
|
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 "LB_CHROOT_HOOKS=\"$CHROOT_HOOKS\"" >> config/chroot
|
||||||
echo "SUBPROJECT=\"${SUBPROJECT:-}\"" >> config/chroot
|
echo "SUBPROJECT=\"${SUBPROJECT:-}\"" >> config/chroot
|
||||||
@ -1038,6 +1060,9 @@ echo "LB_DISTRIBUTION=\"$SUITE\"" >> config/chroot
|
|||||||
if [ -n "$PASSES" ]; then
|
if [ -n "$PASSES" ]; then
|
||||||
echo "PASSES=\"$PASSES\"" >> config/common
|
echo "PASSES=\"$PASSES\"" >> config/common
|
||||||
fi
|
fi
|
||||||
|
if [ -n "$LIVE_PASSES" ]; then
|
||||||
|
echo "LIVE_PASSES=\"$LIVE_PASSES\"" >> config/common
|
||||||
|
fi
|
||||||
echo "LB_BINARY_HOOKS=\"$BINARY_HOOKS\"" >> config/binary
|
echo "LB_BINARY_HOOKS=\"$BINARY_HOOKS\"" >> config/binary
|
||||||
echo "BUILDSTAMP=\"$NOW\"" >> config/binary
|
echo "BUILDSTAMP=\"$NOW\"" >> config/binary
|
||||||
echo "SUBPROJECT=\"${SUBPROJECT:-}\"" >> config/binary
|
echo "SUBPROJECT=\"${SUBPROJECT:-}\"" >> config/binary
|
||||||
|
@ -100,10 +100,14 @@ build_layered_squashfs () {
|
|||||||
# Prepare initrd + kernel
|
# Prepare initrd + kernel
|
||||||
# Main manifest and size files
|
# Main manifest and size files
|
||||||
prefix="livecd.$PROJECT${SUBARCH:+-$SUBARCH}"
|
prefix="livecd.$PROJECT${SUBARCH:+-$SUBARCH}"
|
||||||
if echo $pass | grep -Eq '\.live*' && test ! -e "${prefix}.manifest"; then
|
if [ ! -e "${prefix}.manifest" ]; then
|
||||||
lb binary_linux-image ${*}
|
for livepass in $LIVE_PASSES; do
|
||||||
cp ${squashfs_f_size} "${prefix}.size"
|
[ "$livepass" != "$pass" ] && continue
|
||||||
cp "${squashfs_f_manifest}.full" "${prefix}.manifest"
|
lb binary_linux-image ${*}
|
||||||
|
cp ${squashfs_f_size} "${prefix}.size"
|
||||||
|
cp "${squashfs_f_manifest}.full" "${prefix}.manifest"
|
||||||
|
break
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
(cd "overlay.${pass}/" &&
|
(cd "overlay.${pass}/" &&
|
||||||
|
@ -220,9 +220,11 @@ create_chroot_pass () {
|
|||||||
Chroot chroot "apt-get --purge -y autoremove"
|
Chroot chroot "apt-get --purge -y autoremove"
|
||||||
|
|
||||||
# Add live packages to live layers
|
# 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 ${*}
|
lb chroot_live-packages ${*}
|
||||||
fi
|
break
|
||||||
|
done
|
||||||
|
|
||||||
# Run includes by pass
|
# Run includes by pass
|
||||||
lb_chroot_includes ${pass} ${*}
|
lb_chroot_includes ${pass} ${*}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user