From 849a19d6366e6057697b5ebfd163d4990c2c9474 Mon Sep 17 00:00:00 2001 From: Ward from fusion-voyager-3 Date: Tue, 17 Dec 2024 18:23:29 +0300 Subject: [PATCH] Add booster hook model --- build.sh | 4 + data/refind/EFI/boot/refind.conf | 6 +- data/refind/refind_linux.conf | 6 +- hooks/4-booster-setup.chroot | 77 +------------------ live-lists/0-basics.list | 3 +- .../data/refind/EFI/boot/refind.conf | 6 +- .../data/refind/refind_linux.conf | 6 +- 7 files changed, 20 insertions(+), 88 deletions(-) diff --git a/build.sh b/build.sh index 472ef57..3a9ee98 100755 --- a/build.sh +++ b/build.sh @@ -67,6 +67,10 @@ cp -vf "$ROOTFS_PATH/boot"/booster.img-"$ISO_KERNEL" "./data/refind/EFI/initrd" EFI_BOOT_IMAGE_SIZE=$(($(du -s -B1048576 ./data/refind | cut -f1) + 10)) EFI_BOOT_IMAGE="$LIVE_BOOT_PATH/efiboot.img" +# Define VTOY_ISO_NAME in refind +sed -i "s#THE_NAME_OF_CURRENT_ISO_FOR_VENTOY#$ISO_IMAGE".iso"#g" ./data/refind/refind_linux.conf +sed -i "s#THE_NAME_OF_CURRENT_ISO_FOR_VENTOY#$ISO_IMAGE".iso"#g" ./data/refind/EFI/boot/refind.conf + # Create Refind Boot Image dd if=/dev/zero of="$EFI_BOOT_IMAGE" bs=1M count=$EFI_BOOT_IMAGE_SIZE mkfs.vfat -F 32 "$EFI_BOOT_IMAGE" diff --git a/data/refind/EFI/boot/refind.conf b/data/refind/EFI/boot/refind.conf index 6614a35..3c376b5 100644 --- a/data/refind/EFI/boot/refind.conf +++ b/data/refind/EFI/boot/refind.conf @@ -651,12 +651,12 @@ menuentry "PikaOS Live Image" { icon EFI/BOOT/REFIND-DARK/ICONS/OS_PIKAOS.PNG loader EFI/VMLINUZ initrd EFI/INITRD - options "boot=live booster.loadcdrom booster.skiproot quiet splash" + options "VTOY_ISO_NAME=THE_NAME_OF_CURRENT_ISO_FOR_VENTOY boot=live booster.loadcdrom booster.skiproot quiet splash" submenuentry "Boot live image with logging" { - options "boot=live booster.loadcdrom booster.skiproot" + options "VTOY_ISO_NAME=THE_NAME_OF_CURRENT_ISO_FOR_VENTOY boot=live booster.loadcdrom booster.skiproot" } submenuentry "Boot live image with safe graphics" { - options "boot=live booster.loadcdrom booster.skiproot nomodeset" + options "VTOY_ISO_NAME=THE_NAME_OF_CURRENT_ISO_FOR_VENTOY boot=live booster.loadcdrom booster.skiproot nomodeset" } } diff --git a/data/refind/refind_linux.conf b/data/refind/refind_linux.conf index 4b7d9f1..891a05c 100644 --- a/data/refind/refind_linux.conf +++ b/data/refind/refind_linux.conf @@ -1,3 +1,3 @@ -"Boot live image with standard options" "boot=live booster.loadcdrom booster.skiproot quiet splash ---" -"Boot live image with logging" "boot=live booster.loadcdrom booster.skiproot ---" -"Boot live image with safe graphics" "boot=live booster.loadcdrom booster.skiproot nomodeset ---" +"Boot live image with standard options" "VTOY_ISO_NAME=THE_NAME_OF_CURRENT_ISO_FOR_VENTOY boot=live booster.loadcdrom booster.skiproot quiet splash ---" +"Boot live image with logging" "VTOY_ISO_NAME=THE_NAME_OF_CURRENT_ISO_FOR_VENTOY boot=live booster.loadcdrom booster.skiproot ---" +"Boot live image with safe graphics" "VTOY_ISO_NAME=THE_NAME_OF_CURRENT_ISO_FOR_VENTOY boot=live booster.loadcdrom booster.skiproot nomodeset ---" diff --git a/hooks/4-booster-setup.chroot b/hooks/4-booster-setup.chroot index 49d837f..99d5876 100755 --- a/hooks/4-booster-setup.chroot +++ b/hooks/4-booster-setup.chroot @@ -1,85 +1,12 @@ #!/bin/sh - -# Create booster hook dirs -mkdir -p /usr/share/booster/hooks-early -mkdir -p /usr/share/booster/hooks-late - -# Create Early hook -touch /usr/share/booster/hooks-early/pika_live.sh -tee /usr/share/booster/hooks-early/pika_live.sh <<'EOF' -#! /bin/bash - -set -e - -# Mount the proc kernel temp mount -busybox mount -n -t proc proc /proc - -# Check if bootloader wants the hook to be executed -busybox cat /proc/cmdline | busybox grep 'boot=live' || exit 0 -busybox echo '[PikaOS Booster Live Hook]: boot=live detected in kernel cmdline, running LiveISO hooks...' - -busybox echo '[PikaOS Booster Live Hook]: Searching for Live medium...' -LIVE_MEDIA="$(busybox findfs LABEL="PikaOS 4" | busybox head -n1)" - -if [ -z "$LIVE_MEDIA" ] -then - busybox echo '[PikaOS Booster Live Hook]: Live medium could not be found among standard blocks.' - busybox echo '[PikaOS Booster Live Hook]: Attempting Ventoy mapping hook.' - if [ -f '/usr/share/booster/ventoy_injection.tar.xz' ] - then - busybox echo '[PikaOS Booster Live Hook]: Extracting Ventoy injection archive.' - tar -xf '/usr/share/booster/ventoy_injection.tar.xz' -C / - /ventoy/busybox/sh /ventoy/hook/debian/antix-disk.sh - else - busybox echo '[PikaOS Booster Live Hook]: Error: Ventoy injection archive could not be found!' - exit 31 - fi - if [ -f "/dev/mapper/ventoy" ] - then - busybox echo '[PikaOS Booster Live Hook]: Live medium found on /dev/mapper/ventoy !' - LIVE_MEDIA='/dev/mapper/ventoy' - else - busybox echo '[PikaOS Booster Live Hook]: Error: Live medium could not be found!' - exit 32 - fi -else - busybox echo "[PikaOS Booster Live Hook]: Live medium found on $LIVE_MEDIA !" -fi - -### Create mounting dirs -busybox echo '[PikaOS Booster Live Hook]: Creating mountpoints...' -busybox mkdir -p /mnt/medium /mnt/filesystem /mnt/overlay /booster.root - -### Mount live medium -busybox echo '[PikaOS Booster Live Hook]: Mounting Live medium...' -busybox mount -o ro $LIVE_MEDIA /mnt/medium - -### Create loop from squashfs -busybox echo '[PikaOS Booster Live Hook]: Mounting Live medium squashfs image...' -busybox mount -o loop,ro /mnt/medium/live/filesystem.squashfs /mnt/filesystem - -### Mount tmpfs on ram -busybox echo '[PikaOS Booster Live Hook]: Creating Ramfs...' -busybox mount -t tmpfs -o mode=1777 overlay_tmpfs /mnt/overlay - -### Create overlay dirs -busybox mkdir -p /mnt/overlay/upper /mnt/overlay/work - -### Create merged overlay -busybox echo '[PikaOS Booster Live Hook]: Creating writable overlay Rootfs on ramfs...' -busybox mount -t overlay overlay -o lowerdir=/mnt/filesystem:/mnt/medium,upperdir=/mnt/overlay/upper,workdir=/mnt/overlay/work /booster.root -EOF - -chmod +x /usr/share/booster/hooks-early/pika_live.sh - touch /etc/booster.yaml tee /etc/booster.yaml <<'EOF' vconsole: true extra_files: busybox enable_lvm: true -modules_force_load: usbhid,hid_generic +modules_force_load: usbhid,hid_generic,loop,usb_storage universal: true -modules: loop +modules: usbhid,hid_generic,loop,usb_storage enable_hooks: true enable_plymouth: true EOF diff --git a/live-lists/0-basics.list b/live-lists/0-basics.list index d07553b..f0cc711 100755 --- a/live-lists/0-basics.list +++ b/live-lists/0-basics.list @@ -24,4 +24,5 @@ refind mesa-hybrid console-data booster -plymouth \ No newline at end of file +plymouth +pika-live-booster-hooks \ No newline at end of file diff --git a/nvidia-enablement/data/refind/EFI/boot/refind.conf b/nvidia-enablement/data/refind/EFI/boot/refind.conf index e27bf58..e5595db 100644 --- a/nvidia-enablement/data/refind/EFI/boot/refind.conf +++ b/nvidia-enablement/data/refind/EFI/boot/refind.conf @@ -651,12 +651,12 @@ menuentry "PikaOS Live Image" { icon EFI/BOOT/REFIND-DARK/ICONS/OS_PIKAOS.PNG loader EFI/VMLINUZ initrd EFI/INITRD - options "boot=live booster.loadcdrom booster.skiproot modules_load=nvidia nvidia-drm.modeset=0 quiet splash" + options "VTOY_ISO_NAME=THE_NAME_OF_CURRENT_ISO_FOR_VENTOY boot=live booster.loadcdrom booster.skiproot modules_load=nvidia nvidia-drm.modeset=0 quiet splash" submenuentry "Boot live image with logging" { - options "boot=live booster.loadcdrom booster.skiproot modules_load=nvidia nvidia-drm.modeset=0" + options "VTOY_ISO_NAME=THE_NAME_OF_CURRENT_ISO_FOR_VENTOY boot=live booster.loadcdrom booster.skiproot modules_load=nvidia nvidia-drm.modeset=0" } submenuentry "Boot live image with safe graphics" { - options "boot=live booster.loadcdrom booster.skiproot nomodeset" + options "VTOY_ISO_NAME=THE_NAME_OF_CURRENT_ISO_FOR_VENTOY boot=live booster.loadcdrom booster.skiproot nomodeset" } } diff --git a/nvidia-enablement/data/refind/refind_linux.conf b/nvidia-enablement/data/refind/refind_linux.conf index a8ae61b..984d210 100644 --- a/nvidia-enablement/data/refind/refind_linux.conf +++ b/nvidia-enablement/data/refind/refind_linux.conf @@ -1,3 +1,3 @@ -"Boot live image with standard options" "boot=live booster.loadcdrom booster.skiproot modules_load=nvidia nvidia-drm.modeset=0 quiet splash ---" -"Boot live image with logging" "boot=live booster.loadcdrom booster.skiproot modules_load=nvidia nvidia-drm.modeset=0 ---" -"Boot live image with safe graphics" "boot=live booster.loadcdrom booster.skiproot nomodeset ---" +"Boot live image with standard options" "VTOY_ISO_NAME=THE_NAME_OF_CURRENT_ISO_FOR_VENTOY boot=live booster.loadcdrom booster.skiproot modules_load=nvidia nvidia-drm.modeset=0 quiet splash ---" +"Boot live image with logging" "VTOY_ISO_NAME=THE_NAME_OF_CURRENT_ISO_FOR_VENTOY boot=live booster.loadcdrom booster.skiproot modules_load=nvidia nvidia-drm.modeset=0 ---" +"Boot live image with safe graphics" "VTOY_ISO_NAME=THE_NAME_OF_CURRENT_ISO_FOR_VENTOY boot=live booster.loadcdrom booster.skiproot nomodeset ---"