linux-live/build

64 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
# Linux Live Kit version 7
export PATH=.:./tools:../tools:/usr/sbin:/usr/bin:/sbin:/bin:/
CHANGEDIR=$(dirname $(readlink -f $0))
echo "Changing current directory to $CHANGEDIR"
cd $CHANGEDIR
. ./.config || exit 1
. ./livekitlib || exit 1
# only root can continue, because only root can read all files from your system
allow_only_root
# check for mksquashfs with xz compression
if [ "$(mksquashfs 2>&1 | grep "Xdict-size")" = "" ]; then
echo "mksquashfs not found or doesn't support -comp xz, aborting, no changes made"
exit 1
fi
# build initramfs image
echo "Building intramfs image using your current system binaries..."
cd initramfs
INITRAMFS=$(./initramfs_create "$LIVEKITNAME")
cd ..
# create live kit filesystem
rm -Rf "$LIVEKITDATA"
BOOT="$LIVEKITDATA"/"$LIVEKITNAME"/boot
mkdir -p "$BOOT"
mv "$INITRAMFS" $BOOT/initrfs.img
cp bootfiles/isolinux.bin $BOOT
cp bootfiles/vesamenu.c32 $BOOT
cp bootfiles/bootlogo.png $BOOT
cp bootfiles/syslinux.exe $BOOT
cp bootfiles/syslinux.com $BOOT
cat bootfiles/syslinux.cfg | sed -r "s:/boot/:/$LIVEKITNAME/boot/:" > $BOOT/syslinux.cfg
cat bootfiles/bootinst.bat | sed -r "s:/boot/:/$LIVEKITNAME/boot/:" | sed -r "s:\\\\boot\\\\:\\\\$LIVEKITNAME\\\\boot\\\\:" > $BOOT/bootinst.bat
cp /boot/vmlinuz $BOOT/
# create compressed bundles
# ... TODO!
# create ISO for CD image
echo "Creating ISO file for CD boot..."
cd "$LIVEKITDATA"
TARGET=/mnt/z
if [ ! -d $TARGET ]; then
TARGET=/tmp
fi
mkisofs -o "$TARGET/$LIVEKITNAME-$(uname -m).iso" -v -J -R -D -A "$LIVEKITNAME" -V "$LIVEKITNAME" \
-no-emul-boot -boot-info-table -boot-load-size 4 \
-b "$LIVEKITNAME"/boot/isolinux.bin -c "$LIVEKITNAME"/boot/isolinux.boot . \
>/dev/null 2>/dev/null
echo "Creating TAR for USB boot..."
tar -c ./* > "$TARGET/$LIVEKITNAME-$(uname -m).tar"
cd ..
rm -Rf "$LIVEKITDATA"
echo "finished. Find your result in $TARGET"