101 lines
2.4 KiB
Bash
Executable File
101 lines
2.4 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
DISC_NAME="${WDVN_VER:0:3} $WDVN_ARCH $WDVN_DATE"
|
|
DISC_NAME="${DISC_NAME:0:32}"
|
|
CHROOT="$1"
|
|
IMAGE="$2.tmp"
|
|
|
|
if [ -d "$IMAGE" ]; then
|
|
rm -r -f "$IMAGE"
|
|
fi
|
|
|
|
EXIT=0
|
|
if [ ! -d "/usr/lib/ISOLINUX" ]; then
|
|
echo "ERROR: /usr/lib/ISOLINUX not found. Run 'apt install isolinux'."
|
|
EXIT=1
|
|
fi
|
|
|
|
if [ ! -d "/usr/lib/syslinux" ]; then
|
|
echo "ERROR: /usr/lib/syslinux not found. Run 'apt install syslinux-common'."
|
|
EXIT=1
|
|
fi
|
|
|
|
if [ ! -d "$CHROOT/lib/live/boot" ]; then
|
|
echo "ERROR: /lib/live/boot not found within chroot. On your chroot, run 'apt install live-boot'."
|
|
EXIT=1
|
|
fi
|
|
|
|
if [ ! -f "$CHROOT/usr/share/initramfs-tools/hooks/live" ]; then
|
|
echo "ERROR: /usr/share/initramfs-tools/hooks/live not found within chroot. On your chroot, run 'apt install live-boot-initramfs-tools'."
|
|
EXIT=1
|
|
fi
|
|
|
|
if ! command -v xorriso &> /dev/null
|
|
then
|
|
echo "ERROR: xorriso not found. Run 'apt install xorriso'."
|
|
EXIT=1
|
|
fi
|
|
|
|
|
|
if [ -f "$2" ]; then
|
|
echo "ERROR: $2 already exists."
|
|
EXIT=1
|
|
fi
|
|
|
|
if [ "$EXIT" == "1" ]; then
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p "$IMAGE"
|
|
mkdir -p "$IMAGE/live"
|
|
mkdir -p "$IMAGE/isolinux"
|
|
|
|
cp -fv "$CHROOT/boot"/vmlinuz-* "$IMAGE/live/vmlinuz"
|
|
cp -fv "$CHROOT/boot"/initrd.img-* "$IMAGE/live/initrd.img"
|
|
mksquashfs "$CHROOT" "$IMAGE/live/filesystem.squashfs"
|
|
#mksquashfs -comp zstd -Xcompression-level 22 "$CHROOT" "$IMAGE/live/filesystem.squashfs"
|
|
|
|
echo "UI menu.c32
|
|
|
|
MENU TITLE $WDVN_NAME $WDVN_ARCH $WDVN_VER $WDVN_DATE live
|
|
TIMEOUT 600
|
|
|
|
LABEL linux
|
|
MENU LABEL Linux
|
|
KERNEL /live/vmlinuz
|
|
APPEND initrd=/live/initrd.img boot=live noautologin quiet
|
|
|
|
LABEL linux-nomodeset
|
|
MENU LABEL Linux (nomodeset)
|
|
KERNEL /live/vmlinuz
|
|
APPEND initrd=/live/initrd.img boot=live noautologin quiet nomodeset
|
|
|
|
LABEL linux-debug
|
|
MENU LABEL Linux (nomodeset, not quiet)
|
|
KERNEL /live/vmlinuz
|
|
APPEND initrd=/live/initrd.img boot=live noautologin nomodeset
|
|
" > "$IMAGE/isolinux/isolinux.cfg"
|
|
|
|
cp /usr/lib/ISOLINUX/isolinux.bin "$IMAGE/isolinux/"
|
|
cp /usr/lib/syslinux/modules/bios/* "$IMAGE/isolinux/"
|
|
|
|
xorriso \
|
|
-as mkisofs \
|
|
-iso-level 3 \
|
|
-full-iso9660-filenames \
|
|
-volid "$DISC_NAME" \
|
|
-output "$2" \
|
|
-isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin \
|
|
-eltorito-boot \
|
|
isolinux/isolinux.bin \
|
|
-no-emul-boot \
|
|
-boot-load-size 4 \
|
|
-boot-info-table \
|
|
--eltorito-catalog isolinux/isolinux.cat \
|
|
"$IMAGE"
|
|
# -eltorito-alt-boot \
|
|
# -e /EFI/boot/efiboot.img \
|
|
# -no-emul-boot \
|
|
# -isohybrid-gpt-basdat \
|
|
# -append_partition 2 0xef EFI/boot/efiboot.img \
|
|
# "$IMAGE" |