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
|
|
|
|
|
|
|
cat /proc/cmdline | grep 'boot=live' || exit 0
|
|
|
|
|
|
|
|
### Config
|
|
|
|
MEDIUM_LABEL="PikaOS 4"
|
|
|
|
#TMPFS_SIZE="3G"
|
|
|
|
|
|
|
|
### Create mounting dirs
|
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 01:58:45 +01:00
|
|
|
busybox mount -o ro "$(busybox findfs LABEL="$MEDIUM_LABEL" | busybox head -n1)" /mnt/medium
|
2024-12-15 20:06:07 +01:00
|
|
|
|
|
|
|
### Create loop from squashfs
|
|
|
|
|
|
|
|
#losetup /dev/loop69 /mnt/medium/live/filesystem.squashfs
|
|
|
|
## Mount squashfs loop
|
|
|
|
#mount -o ro /dev/loop69 /mnt/filesystem
|
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
|
|
|
|
|
|
|
|
#mount -t tmpfs -o size="$TMPFS_SIZE",mode=1777 overlay_tmpfs /mnt/overlay
|
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 01:58:45 +01:00
|
|
|
busyboxmkdir -p /mnt/overlay/upper /mnt/overlay/work
|
2024-12-15 20:06:07 +01:00
|
|
|
|
|
|
|
### Create merged overlay
|
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
|
|
|
|
|
|
|
### mount kernel filesystems
|
2024-12-16 00:29:39 +01:00
|
|
|
#mount -n -t devtmpfs devtmpfs /booster.root/dev
|
|
|
|
#mount -n -t proc proc /booster.root/proc
|
|
|
|
#mount -n -t sysfs sysfs /booster.root/sys
|
|
|
|
#mount -n -t tmpfs tmpfs /booster.root/run
|
2024-12-15 20:06:07 +01:00
|
|
|
|
|
|
|
|
|
|
|
### Switch to new root
|
2024-12-15 22:47:40 +01:00
|
|
|
#switch_root "/booster.root/" "/booster.root/sbin/init"
|
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
|