live-iso-gnome/build.sh
Ward from fusion-voyager-3 f7e2450cb9
Some checks failed
Push ISO / build (push) Failing after 6m22s
Fix data path
2024-08-01 19:16:30 +03:00

84 lines
2.1 KiB
Bash
Executable File

#! /bin/bash
set -e
source ./info.sh
if [[ -z $ROOTFS_PATH ]]
then
echo "Error: ROOTFS PATH is not set!"
exit 1
fi
# Mount
mount --bind /dev "$ROOTFS_PATH/dev"
mount -t tmpfs run "$ROOTFS_PATH/run" -o mode=0755,nosuid,nodev
mount -t proc proc "$ROOTFS_PATH/proc" -o nosuid,nodev,noexec
mount -t sysfs sys "$ROOTFS_PATH/sys" -o nosuid,nodev,noexec,ro
# Setup Chroot scripts
cp -rvf ./chroot_scripts "$ROOTFS_PATH/"
cp -rvf ./hooks "$ROOTFS_PATH/chroot_scripts/"
cp -rvf ./live-lists "$ROOTFS_PATH/chroot_scripts/"
cp -rvf ./pool-lists "$ROOTFS_PATH/chroot_scripts/"
cp -rvf ./rem-lists "$ROOTFS_PATH/chroot_scripts/"
cp -rvf ./info.sh "$ROOTFS_PATH/chroot_scripts/"
# Run chroot_script inside ROOTFS
chroot "$ROOTFS_PATH" bash -c "/chroot_scripts/0-chroot.sh"
rm -rfv "$ROOTFS_PATH/chroot_scripts"
# Unmount
umount "$ROOTFS_PATH/dev" || umount -lf "$ROOTFS_PATH/dev" || true
umount "$ROOTFS_PATH/run" || umount -lf "$ROOTFS_PATH/run" || true
umount "$ROOTFS_PATH/proc" || umount -lf "$ROOTFS_PATH/proc" || true
umount "$ROOTFS_PATH/sys" || umount -lf "$ROOTFS_PATH/sys" || true
# Generate Squashfs image
mksquashfs \
"$ROOTFS_PATH" \
"$LIVE_BOOT_LIVE_PATH/filesystem.squashfs" \
-e boot \
-noappend \
-comp xz \
-b 1M \
-Xdict-size 1M \
-Xbcj x86
# Copy Kernel to live
cp "$ROOTFS_PATH/boot"/vmlinuz-* \
"$LIVE_BOOT_LIVE_PATH/vmlinuz" && \
cp "$ROOTFS_PATH/boot"/initrd.img-* \
"$LIVE_BOOT_LIVE_PATH/initrd" && \
cp ./data/refind/refind_linux.conf \
"$LIVE_BOOT_LIVE_PATH/refind_linux.conf"
# Generate bootable EFI Image from refind
dd if=/dev/zero of=disk.img bs=1M count=20
losetup --offset 1048576 --sizelimit 46934528 /dev/loop5 disk.img
mkfs.vfat /dev/loop5
mkdir -p /mnt/efi-disk
mount /dev/loop5 /mnt/efi-disk
mkdir -p /mnt/efi-disk/EFI
rsync -av ./data/refind/EFI/* /mnt/efi-disk/EFI/
mkisofs -o "$LIVE_BOOT_PATH/efiboot.img" /mnt/efi-disk/
umount -l /mnt/efi-disk
rm -rfv disk.img
# Create Bootable UEFI Full Image
mkdir -p ./output
xorriso \
-as mkisofs \
-V $LIVE_BOOT_VOLUME_NAME \
-e "$LIVE_BOOT_PATH/efiboot.img" \
-no-emul-boot \
-o "./output/$ISO_IMAGE" \
"$LIVE_BOOT_DATA_PATH"