windvn/path/wdvn-image-iso

101 lines
2.4 KiB
Plaintext
Raw Normal View History

2022-08-10 00:00:49 +00:00
#!/bin/bash
set -e
2022-08-10 16:31:18 +00:00
DISC_NAME="${WDVN_VER:0:3} $WDVN_ARCH $WDVN_DATE"
DISC_NAME="${DISC_NAME:0:32}"
2022-08-10 00:00:49 +00:00
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"
2022-08-10 16:31:57 +00:00
#mksquashfs -comp zstd -Xcompression-level 22 "$CHROOT" "$IMAGE/live/filesystem.squashfs"
2022-08-10 00:00:49 +00:00
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
2022-08-10 16:31:57 +00:00
APPEND initrd=/live/initrd.img boot=live noautologin quiet
2022-08-10 00:00:49 +00:00
LABEL linux-nomodeset
MENU LABEL Linux (nomodeset)
KERNEL /live/vmlinuz
2022-08-10 16:31:57 +00:00
APPEND initrd=/live/initrd.img boot=live noautologin quiet nomodeset
LABEL linux-debug
MENU LABEL Linux (nomodeset, not quiet)
KERNEL /live/vmlinuz
2022-08-10 00:00:49 +00:00
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"