Add quiet mode
This commit is contained in:
parent
d3367f6b68
commit
f2f680e37b
@ -1,4 +1,4 @@
|
|||||||
pika-live-booster-hooks (1.0-101pika1) pika; urgency=medium
|
pika-live-booster-hooks (1.0-101pika2) pika; urgency=medium
|
||||||
|
|
||||||
* Initial release.
|
* Initial release.
|
||||||
|
|
||||||
|
@ -14,64 +14,112 @@ then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check if quiet is used
|
||||||
|
if [[ "$(busybox cat /proc/cmdline)" =~ (^|[[:space:]])quiet($|[[:space:]]) ]]; then
|
||||||
|
QUIET_MODE=true
|
||||||
|
else
|
||||||
|
QUIET_MODE=false
|
||||||
|
fi
|
||||||
|
|
||||||
VTOY_ISO_NAME_PARAM="$(busybox grep -o 'VTOY_ISO_NAME=[^ ]*' /proc/cmdline | busybox awk -F= '{print $2}')"
|
VTOY_ISO_NAME_PARAM="$(busybox grep -o 'VTOY_ISO_NAME=[^ ]*' /proc/cmdline | busybox awk -F= '{print $2}')"
|
||||||
|
|
||||||
busybox echo '[PikaOS Booster Live Hook]: boot=live detected in kernel cmdline, running LiveISO hooks...'
|
if [ "$QUIET_MODE" = false ]
|
||||||
|
then
|
||||||
|
busybox echo '[PikaOS Booster Live Hook]: boot=live detected in kernel cmdline, running LiveISO hooks...'
|
||||||
|
fi
|
||||||
### Create mounting dirs
|
### Create mounting dirs
|
||||||
busybox echo '[PikaOS Booster Live Hook]: Creating mountpoints...'
|
if [ "$QUIET_MODE" = false ]
|
||||||
|
then
|
||||||
|
busybox echo '[PikaOS Booster Live Hook]: Creating mountpoints...'
|
||||||
|
fi
|
||||||
busybox mkdir -p /mnt/medium /mnt/filesystem /mnt/overlay /booster.root
|
busybox mkdir -p /mnt/medium /mnt/filesystem /mnt/overlay /booster.root
|
||||||
|
|
||||||
# Try finding Appended partition among standard partition blocks.
|
# Try finding Appended partition among standard partition blocks.
|
||||||
busybox echo '[PikaOS Booster Live Hook]: Searching for Live medium...'
|
if [ "$QUIET_MODE" = false ]
|
||||||
|
then
|
||||||
|
busybox echo '[PikaOS Booster Live Hook]: Searching for Live medium...'
|
||||||
|
fi
|
||||||
LIVE_MEDIA="$(busybox blkid | busybox grep "PikaOS 4" | busybox grep "iso9660" | busybox head -n1 | busybox awk -F: '{print $1}')"
|
LIVE_MEDIA="$(busybox blkid | busybox grep "PikaOS 4" | busybox grep "iso9660" | busybox head -n1 | busybox awk -F: '{print $1}')"
|
||||||
|
|
||||||
if [ -z "$LIVE_MEDIA" ]
|
if [ -z "$LIVE_MEDIA" ]
|
||||||
then
|
then
|
||||||
# Try getting appended partition from Ventoy ISO Partition
|
# Try getting appended partition from Ventoy ISO Partition
|
||||||
|
if [ "$QUIET_MODE" = false ]
|
||||||
|
then
|
||||||
busybox echo '[PikaOS Booster Live Hook]: Live medium could not be found among standard blocks.'
|
busybox echo '[PikaOS Booster Live Hook]: Live medium could not be found among standard blocks.'
|
||||||
|
fi
|
||||||
|
if [ "$QUIET_MODE" = false ]
|
||||||
|
then
|
||||||
busybox echo '[PikaOS Booster Live Hook]: Attempting Ventoy mapping hook.'
|
busybox echo '[PikaOS Booster Live Hook]: Attempting Ventoy mapping hook.'
|
||||||
|
fi
|
||||||
# Get Ventoy ISO Partition ID
|
# Get Ventoy ISO Partition ID
|
||||||
VENTOY_DEVICE="$(busybox blkid | busybox grep "Ventoy" | busybox head -n1 | busybox awk -F: '{print $1}')"
|
VENTOY_DEVICE="$(busybox blkid | busybox grep "Ventoy" | busybox head -n1 | busybox awk -F: '{print $1}')"
|
||||||
# Keep retrying 10 times incase usb_storage has yet to pick up
|
# Keep retrying 10 times incase usb_storage has yet to pick up
|
||||||
while [ -z "$VENTOY_DEVICE" ]
|
while [ -z "$VENTOY_DEVICE" ]
|
||||||
do
|
do
|
||||||
|
if [ "$QUIET_MODE" = false ]
|
||||||
|
then
|
||||||
busybox echo '[PikaOS Booster Live Hook]: Ventoy Device not found retrying...'
|
busybox echo '[PikaOS Booster Live Hook]: Ventoy Device not found retrying...'
|
||||||
|
fi
|
||||||
VENTOY_DEVICE="$(busybox blkid | busybox grep "Ventoy" | busybox head -n1 | busybox awk -F: '{print $1}')"
|
VENTOY_DEVICE="$(busybox blkid | busybox grep "Ventoy" | busybox head -n1 | busybox awk -F: '{print $1}')"
|
||||||
((c++)) && ((c==10)) && break
|
((c++)) && ((c==10)) && break
|
||||||
sleep 5
|
busybox sleep 5
|
||||||
done
|
done
|
||||||
# Get filesystem if iso was found
|
# Get filesystem if iso was found
|
||||||
if [ ! -z "$VENTOY_DEVICE" ]
|
if [ ! -z "$VENTOY_DEVICE" ]
|
||||||
|
then
|
||||||
|
if [ "$QUIET_MODE" = false ]
|
||||||
then
|
then
|
||||||
busybox echo "[PikaOS Booster Live Hook]: Ventoy device found as $VENTOY_DEVICE !"
|
busybox echo "[PikaOS Booster Live Hook]: Ventoy device found as $VENTOY_DEVICE !"
|
||||||
|
fi
|
||||||
busybox mkdir -p /mnt/ventoy
|
busybox mkdir -p /mnt/ventoy
|
||||||
busybox mount -o ro "$VENTOY_DEVICE" /mnt/ventoy
|
busybox mount -o ro "$VENTOY_DEVICE" /mnt/ventoy
|
||||||
### Mount live medium
|
### Mount live medium
|
||||||
|
if [ "$QUIET_MODE" = false ]
|
||||||
|
then
|
||||||
busybox echo '[PikaOS Booster Live Hook]: Mounting Live medium...'
|
busybox echo '[PikaOS Booster Live Hook]: Mounting Live medium...'
|
||||||
|
fi
|
||||||
busybox mount -o ro,loop /mnt/ventoy/$VTOY_ISO_NAME_PARAM /mnt/medium
|
busybox mount -o ro,loop /mnt/ventoy/$VTOY_ISO_NAME_PARAM /mnt/medium
|
||||||
else
|
else
|
||||||
|
if [ "$QUIET_MODE" = false ]
|
||||||
|
then
|
||||||
busybox echo '[PikaOS Booster Live Hook]: Error: Live medium could not be found!'
|
busybox echo '[PikaOS Booster Live Hook]: Error: Live medium could not be found!'
|
||||||
|
fi
|
||||||
exit 32
|
exit 32
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
if [ "$QUIET_MODE" = false ]
|
||||||
|
then
|
||||||
busybox echo "[PikaOS Booster Live Hook]: Live medium found on $LIVE_MEDIA !"
|
busybox echo "[PikaOS Booster Live Hook]: Live medium found on $LIVE_MEDIA !"
|
||||||
|
fi
|
||||||
### Mount live medium
|
### Mount live medium
|
||||||
|
if [ "$QUIET_MODE" = false ]
|
||||||
|
then
|
||||||
busybox echo '[PikaOS Booster Live Hook]: Mounting Live medium...'
|
busybox echo '[PikaOS Booster Live Hook]: Mounting Live medium...'
|
||||||
|
fi
|
||||||
busybox mount -o ro $LIVE_MEDIA /mnt/medium
|
busybox mount -o ro $LIVE_MEDIA /mnt/medium
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Create loop from squashfs
|
### Create loop from squashfs
|
||||||
busybox echo '[PikaOS Booster Live Hook]: Mounting Live medium squashfs image...'
|
if [ "$QUIET_MODE" = false ]
|
||||||
|
then
|
||||||
|
busybox echo '[PikaOS Booster Live Hook]: Mounting Live medium squashfs image...'
|
||||||
|
fi
|
||||||
busybox mount -o loop,ro /mnt/medium/live/filesystem.squashfs /mnt/filesystem
|
busybox mount -o loop,ro /mnt/medium/live/filesystem.squashfs /mnt/filesystem
|
||||||
|
|
||||||
### Mount tmpfs on ram
|
### Mount tmpfs on ram
|
||||||
busybox echo '[PikaOS Booster Live Hook]: Creating Ramfs...'
|
if [ "$QUIET_MODE" = false ]
|
||||||
|
then
|
||||||
|
busybox echo '[PikaOS Booster Live Hook]: Creating Ramfs...'
|
||||||
|
fi
|
||||||
busybox mount -t tmpfs -o mode=1777 overlay_tmpfs /mnt/overlay
|
busybox mount -t tmpfs -o mode=1777 overlay_tmpfs /mnt/overlay
|
||||||
|
|
||||||
### Create overlay dirs
|
### Create overlay dirs
|
||||||
busybox mkdir -p /mnt/overlay/upper /mnt/overlay/work
|
busybox mkdir -p /mnt/overlay/upper /mnt/overlay/work
|
||||||
|
|
||||||
### Create merged overlay
|
### Create merged overlay
|
||||||
busybox echo '[PikaOS Booster Live Hook]: Creating writable overlay Rootfs on ramfs...'
|
if [ "$QUIET_MODE" = false ]
|
||||||
|
then
|
||||||
|
busybox echo '[PikaOS Booster Live Hook]: Creating writable overlay Rootfs on ramfs...'
|
||||||
|
fi
|
||||||
busybox mount -t overlay overlay -o lowerdir=/mnt/filesystem:/mnt/medium,upperdir=/mnt/overlay/upper,workdir=/mnt/overlay/work /booster.root
|
busybox mount -t overlay overlay -o lowerdir=/mnt/filesystem:/mnt/medium,upperdir=/mnt/overlay/upper,workdir=/mnt/overlay/work /booster.root
|
||||||
|
Loading…
x
Reference in New Issue
Block a user