From 97f056d3b608e290cdb88cf9c0d541541e908fe7 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Mon, 13 Jun 2011 12:24:12 +0100 Subject: [PATCH] link output files to BuildLiveCD-compatible locations --- live-build/auto/build | 56 +++++++++++++++++++++++++++++++++++++++++++ live-build/auto/clean | 1 + 2 files changed, 57 insertions(+) diff --git a/live-build/auto/build b/live-build/auto/build index 0499a66d..ac8a7611 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -3,6 +3,13 @@ set -e export LC_ALL=C +. "${LB_BASE:-/usr/share/live/build}"/scripts/build.sh + +Arguments "${@}" + +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + ( lb bootstrap "$@" lb chroot "$@" @@ -27,3 +34,52 @@ export LC_ALL=C lb binary "$@" ) 2>&1 | tee binary.log + +# Link output files somewhere BuildLiveCD will be able to find them. +PREFIX="livecd.$PROJECT${SUBARCH:+-$SUBARCH}" + +case $LB_INITRAMFS in + casper) + INITFS="casper" + ;; + + live-boot) + INITFS="live" + ;; + + *) + INITFS="boot" + ;; +esac + +for OUTPUT in ext2 ext3 manifest manifest-remove size squashfs; do + [ -e "binary/$INITFS/filesystem.$OUTPUT" ] || continue + ln "binary/$INITFS/filesystem.$OUTPUT" "$PREFIX.$OUTPUT" + chmod 644 "$PREFIX.$OUTPUT" +done + +for FLAVOUR in $LB_LINUX_FLAVOURS; do + KVERS="$( (cd "binary/$INITFS"; ls vmlinu?-*) | sed -n "s/^vmlinu.-\\([^-]*-[^-]*-$FLAVOUR\\)/\\1/p" )" + if [ -z "$KVERS" ]; then + echo "No kernel output for $FLAVOUR!" >&2 + exit 1 + fi + NUMKVERS="$(set -- $KVERS; echo $#)" + if [ "$NUMKVERS" -gt 1 ]; then + echo "Cannot handle more than one kernel for $FLAVOUR ($KVERS)!" >&2 + exit 1 + fi + ln "binary/$INITFS/"vmlinu?-"$KVERS" "$PREFIX.kernel-$FLAVOUR" + chmod 644 "$PREFIX.kernel-$FLAVOUR" + if [ -e "binary/$INITFS/initrd.img-$KVERS" ]; then + ln "binary/$INITFS/initrd.img-$KVERS" "$PREFIX.initrd-$FLAVOUR" + chmod 644 "$PREFIX.initrd-$FLAVOUR" + fi +done + +NUMFLAVOURS="$(set -- $LB_LINUX_FLAVOURS; echo $#)" +if [ "$NUMFLAVOURS" = 1 ]; then + # only one kernel flavour + ln -sf "$PREFIX.kernel-$LB_LINUX_FLAVOURS" "$PREFIX.kernel" + ln -sf "$PREFIX.initrd-$LB_LINUX_FLAVOURS" "$PREFIX.initrd" +fi diff --git a/live-build/auto/clean b/live-build/auto/clean index 5158f42b..4711f35d 100755 --- a/live-build/auto/clean +++ b/live-build/auto/clean @@ -5,3 +5,4 @@ lb clean noauto "$@" rm -rf config rm -f binary.manifest binary.manifest-desktop binary.log +rm -f livecd.*