Add booster hook model

This commit is contained in:
Ward from fusion-voyager-3 2024-12-17 18:23:29 +03:00
parent 78df3d8921
commit 849a19d636
7 changed files with 20 additions and 88 deletions

View File

@ -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"

View File

@ -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"
}
}

View File

@ -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 ---"

View File

@ -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

View File

@ -24,4 +24,5 @@ refind
mesa-hybrid
console-data
booster
plymouth
plymouth
pika-live-booster-hooks

View File

@ -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"
}
}

View File

@ -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 ---"