#!/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 busybox mount -n -t proc proc /proc busybox cat /proc/cmdline | busybox grep 'boot=live booster.loadcdrom' || exit 0 ### Config MEDIUM_LABEL="PikaOS 4" #TMPFS_SIZE="3G" ### Create mounting dirs busybox mkdir -p /mnt/medium /mnt/filesystem /mnt/overlay /booster.root ### Mount live medium busybox mount -o ro "$(busybox findfs LABEL="$MEDIUM_LABEL" | busybox head -n1)" /mnt/medium ### Create loop from squashfs #losetup /dev/loop69 /mnt/medium/live/filesystem.squashfs ## Mount squashfs loop #mount -o ro /dev/loop69 /mnt/filesystem busybox mount -o loop,ro /mnt/medium/live/filesystem.squashfs /mnt/filesystem ### Mount tmpfs on ram #mount -t tmpfs -o size="$TMPFS_SIZE",mode=1777 overlay_tmpfs /mnt/overlay 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 mount -t overlay overlay -o lowerdir=/mnt/filesystem:/mnt/medium,upperdir=/mnt/overlay/upper,workdir=/mnt/overlay/work /booster.root ### mount kernel filesystems #busybox mount -n -t devtmpfs devtmpfs /booster.root/dev #busybox mount -n -t proc proc /booster.root/proc #busybox mount -n -t sysfs sysfs /booster.root/sys #busybox mount -n -t tmpfs tmpfs /booster.root/run ### Switch to new root #busybox switch_root "/booster.root/" "/booster.root/sbin/init" 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