Compare commits

..

3 Commits

3 changed files with 30 additions and 5 deletions

View File

@ -1 +1,27 @@
#!/bin/bash #!/bin/bash
type getarg > /dev/null 2>&1 || source /lib/dracut-lib.sh
[ ! -d /sysroot/container ] && mkdir -p /sysroot/container
CONTAINER="$(getarg void-usb-container)"
case "$CONTAINER" in
LABEL=* | UUID=* | PARTUUID=* | PARTLABEL=*)
CONTAINER="$(label_uuid_to_dev "$CONTAINER")"
;;
/dev/*)
true
;;
*)
echo -e "Invalid value for 'void-usb-container' kernel command line parameter!\nDropping into emergency shell."
emergency_shell
esac
mount -t f2fs -o nodev,nosuid "$CONTAINER" /sysroot/container
if [ -f /sysroot/container/squashfs.img ]; then
losetup -r -f /sysroot/container/squashfs.img
else
echo "Failed to find squashfs image. Dropping into an emergency shell. Good luck!"
emergency_shell
fi

View File

@ -188,7 +188,7 @@ echo "%wheel ALL=(ALL:ALL) ALL" > /mnt/target/etc/sudoers.d/wheel_as_sudo_group.
mkdir -p /mnt/target/opt/void-usb mkdir -p /mnt/target/opt/void-usb
chmod 755 /mnt/target/opt/void-usb chmod 755 /mnt/target/opt/void-usb
echo "UUID=$(blkid --output value --match-tag UUID $TARGET_PART_BIG) /container f2fs defaults,rw,nodev,nosuid 0 1" > /mnt/target/opt/void-usb/initramfs-fstab echo "UUID=$(blkid --output value --match-tag UUID $TARGET_PART_BIG)" > /mnt/target/opt/void-usb/container
echo '# Void USB dracut configuration echo '# Void USB dracut configuration
@ -196,8 +196,7 @@ hostonly="no"
compress="xz" compress="xz"
add_dracutmodules+=" void-usb " add_dracutmodules+=" void-usb "
omit_dracutmodules+=" nvdimm resume " omit_dracutmodules+=" nvdimm resume "' > /mnt/target/etc/dracut.conf.d/99-void-usb.conf
add_fstab+=" /opt/void-usb/initramfs-fstab "' > /mnt/target/etc/dracut.conf.d/99-void-usb.conf
#TODO: mount /container #TODO: mount /container
mkdir -p /mnt/target/lib/dracut/modules.d/90void-usb mkdir -p /mnt/target/lib/dracut/modules.d/90void-usb

View File

@ -4,7 +4,7 @@ OS_NAME="Void Linux USB"
GRUB_PREFIX="/boot/efi/LOADER/grub" GRUB_PREFIX="/boot/efi/LOADER/grub"
CFG_CUSTOM_BEFORE="custom_before.cfg" CFG_CUSTOM_BEFORE="custom_before.cfg"
CFG_CUSTOM_AFTER="custom_after.cfg" CFG_CUSTOM_AFTER="custom_after.cfg"
LINUX_CMDLINE="root=/dev/loop0 ro" LINUX_CMDLINE="root=/dev/loop0 ro void-usb-container=$(cat /opt/void-usb/container)"
DEFAULT_LINUX=/boot/vmlinu? DEFAULT_LINUX=/boot/vmlinu?
if [ ! -f "$DEFAULT_LINUX" ]; then if [ ! -f "$DEFAULT_LINUX" ]; then
@ -79,7 +79,7 @@ fi
menuentry '$OS_NAME' { menuentry '$OS_NAME' {
echo 'Loading Linux...' echo 'Loading Linux...'
linux /$DEFAULT_LINUX linux /$DEFAULT_LINUX $LINUX_CMDLINE
echo 'Loading initial ramdisk...' echo 'Loading initial ramdisk...'
initrd /$DEFAULT_INITRAMFS initrd /$DEFAULT_INITRAMFS
} }