You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
livecd-rootfs/live-build/auto/build

86 lines
2.3 KiB

#! /bin/sh
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 "$@"
echo "===== Checking size of /usr/share/doc ====="
echo BEGIN docdirs
(cd chroot && find usr/share/doc -maxdepth 1 -type d | xargs du -s | sort -nr)
echo END docdirs
if which fdupes >/dev/null 2>&1; then
echo "===== Checking for duplicate files ====="
echo "first line: <total size for dupes> <different dupes> <all dupes>"
echo "data lines: <size for dupes> <number of dupes> <file size> <filename> [<filename> ...]"
echo BEGIN fdupes
(cd chroot \
&& fdupes --recurse --noempty --sameline --size --quiet usr \
| awk '/bytes each/ {s=$1} /^usr/ { n+=1; n2+=NF-1; sum+=s*(NF-1); print s*(NF-1), NF-1, s, $0 } END {print sum, n, n2}' \
| sort -nr
)
echo END fdupes
fi
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