#!/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 universal: true modules: loop enable_hooks: true enable_plymouth: true EOF update-initramfs -c -k all