2024-12-15 20:06:07 +01:00
|
|
|
#!/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'
|
2024-12-16 00:29:47 +01:00
|
|
|
#! /bin/bash
|
2024-12-15 20:06:07 +01:00
|
|
|
|
2024-12-16 00:29:39 +01:00
|
|
|
set -e
|
2024-12-15 20:06:07 +01:00
|
|
|
|
2024-12-16 02:14:54 +01:00
|
|
|
busybox mount -n -t proc proc /proc
|
|
|
|
|
2024-12-16 16:04:00 +01:00
|
|
|
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...'
|
2024-12-15 20:06:07 +01:00
|
|
|
|
|
|
|
### Config
|
2024-12-16 16:04:00 +01:00
|
|
|
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.'
|
2024-12-16 16:34:07 +01:00
|
|
|
if [ -f '/usr/share/booster/ventoy_injection.tar.xz' ]
|
|
|
|
then
|
|
|
|
busybox echo '[PikaOS Booster Live Hook]: Extracting Ventoy injection archive.'
|
|
|
|
busybox tar -xvf '/usr/share/booster/ventoy_injection.tar.xz' -C /
|
|
|
|
/ventoy/busybox/sh /ventoy/hook/debian/disk_mount_hook.sh
|
2024-12-16 17:02:53 +01:00
|
|
|
/ventoy/busybox/sh /ventoy/hook/debian/antix-disk.sh
|
2024-12-16 16:34:07 +01:00
|
|
|
else
|
|
|
|
busybox echo '[PikaOS Booster Live Hook]: Error: Ventoy injection archive could not be found!'
|
|
|
|
exit 31
|
|
|
|
fi
|
2024-12-16 16:04:00 +01:00
|
|
|
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
|
2024-12-15 20:06:07 +01:00
|
|
|
|
|
|
|
### Create mounting dirs
|
2024-12-16 16:34:07 +01:00
|
|
|
busybox echo '[PikaOS Booster Live Hook]: Creating mountpoints...'
|
2024-12-16 01:58:45 +01:00
|
|
|
busybox mkdir -p /mnt/medium /mnt/filesystem /mnt/overlay /booster.root
|
2024-12-15 20:06:07 +01:00
|
|
|
|
|
|
|
### Mount live medium
|
2024-12-16 16:34:07 +01:00
|
|
|
busybox echo '[PikaOS Booster Live Hook]: Mounting Live medium...'
|
2024-12-16 16:04:00 +01:00
|
|
|
busybox mount -o ro $LIVE_MEDIA /mnt/medium
|
2024-12-15 20:06:07 +01:00
|
|
|
|
|
|
|
### Create loop from squashfs
|
2024-12-16 16:34:07 +01:00
|
|
|
busybox echo '[PikaOS Booster Live Hook]: Mounting Live medium squashfs image...'
|
2024-12-16 01:58:45 +01:00
|
|
|
busybox mount -o loop,ro /mnt/medium/live/filesystem.squashfs /mnt/filesystem
|
2024-12-15 20:06:07 +01:00
|
|
|
|
|
|
|
### Mount tmpfs on ram
|
2024-12-16 16:34:07 +01:00
|
|
|
busybox echo '[PikaOS Booster Live Hook]: Creating Ramfs...'
|
2024-12-16 01:58:45 +01:00
|
|
|
busybox mount -t tmpfs -o mode=1777 overlay_tmpfs /mnt/overlay
|
2024-12-15 20:06:07 +01:00
|
|
|
|
|
|
|
### Create overlay dirs
|
2024-12-16 02:14:54 +01:00
|
|
|
busybox mkdir -p /mnt/overlay/upper /mnt/overlay/work
|
2024-12-15 20:06:07 +01:00
|
|
|
|
|
|
|
### Create merged overlay
|
2024-12-16 16:34:07 +01:00
|
|
|
busybox echo '[PikaOS Booster Live Hook]: Creating writable overlay Rootfs on ramfs...'
|
2024-12-16 01:58:45 +01:00
|
|
|
busybox mount -t overlay overlay -o lowerdir=/mnt/filesystem:/mnt/medium,upperdir=/mnt/overlay/upper,workdir=/mnt/overlay/work /booster.root
|
2024-12-15 20:06:07 +01:00
|
|
|
EOF
|
|
|
|
|
2024-12-15 21:47:24 +01:00
|
|
|
chmod +x /usr/share/booster/hooks-early/pika_live.sh
|
|
|
|
|
2024-12-15 20:06:07 +01:00
|
|
|
touch /etc/booster.yaml
|
|
|
|
tee /etc/booster.yaml <<'EOF'
|
|
|
|
vconsole: true
|
|
|
|
extra_files: busybox
|
|
|
|
enable_lvm: true
|
2024-12-16 01:14:28 +01:00
|
|
|
modules_force_load: usbhid,hid_generic
|
2024-12-15 20:06:07 +01:00
|
|
|
universal: true
|
2024-12-16 01:14:28 +01:00
|
|
|
modules: loop
|
2024-12-15 20:06:07 +01:00
|
|
|
enable_hooks: true
|
|
|
|
enable_plymouth: true
|
|
|
|
EOF
|
2024-12-15 22:47:40 +01:00
|
|
|
|
|
|
|
update-initramfs -c -k all
|