Everything: Move /container to /run/void-usb/container
parent
6ebde2efd1
commit
99a344d978
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
type getarg > /dev/null 2>&1 || source /lib/dracut-lib.sh
|
type getarg > /dev/null 2>&1 || source /lib/dracut-lib.sh
|
||||||
|
|
||||||
[ ! -d /sysroot/container ] && mkdir -p /sysroot/container
|
[ ! -d /run/void-usb/container ] && mkdir -p /run/void-usb/container
|
||||||
|
|
||||||
CONTAINER="$(getarg void-usb-container)"
|
CONTAINER="$(getarg void-usb-container)"
|
||||||
case "$CONTAINER" in
|
case "$CONTAINER" in
|
||||||
|
@ -19,7 +19,7 @@ esac
|
||||||
|
|
||||||
# try to wait for $CONTAINER to be available
|
# try to wait for $CONTAINER to be available
|
||||||
function mount_container {
|
function mount_container {
|
||||||
mount -t f2fs -o nodev,nosuid "$CONTAINER" /sysroot/container;
|
mount -t f2fs -o nodev,nosuid "$CONTAINER" /run/void-usb/container;
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -b "$CONTAINER" ]; then
|
if [ -b "$CONTAINER" ]; then
|
||||||
|
@ -52,8 +52,8 @@ else
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f /sysroot/container/squashfs.img ]; then
|
if [ -f /run/void-usb/container/squashfs.img ]; then
|
||||||
losetup -r -f /sysroot/container/squashfs.img
|
losetup -r -f /run/void-usb/container/squashfs.img
|
||||||
else
|
else
|
||||||
echo "Failed to find squashfs image. Dropping into an emergency shell. Good luck!"
|
echo "Failed to find squashfs image. Dropping into an emergency shell. Good luck!"
|
||||||
emergency_shell
|
emergency_shell
|
||||||
|
|
|
@ -35,7 +35,7 @@ function yesno {
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_in_target {
|
function run_in_target {
|
||||||
echo "$@" | xchroot /mnt/target sh
|
echo "$@" | chroot /mnt/target sh
|
||||||
}
|
}
|
||||||
|
|
||||||
clear
|
clear
|
||||||
|
@ -135,17 +135,29 @@ mkfs.f2fs -f -l "boot" "$TARGET_PART_BOOT"
|
||||||
mkfs.f2fs -f -l "container" "$TARGET_PART_BIG"
|
mkfs.f2fs -f -l "container" "$TARGET_PART_BIG"
|
||||||
|
|
||||||
mkdir -p /mnt/target
|
mkdir -p /mnt/target
|
||||||
mount -t tmpfs -o size=3g tmpfs /mnt/target
|
|
||||||
#TODO don't use default permissions for tmpfs
|
#TODO don't use default permissions for tmpfs
|
||||||
|
mount -t tmpfs -o size=3g tmpfs /mnt/target
|
||||||
|
|
||||||
|
# used for chroot later
|
||||||
|
mkdir /mnt/target/run
|
||||||
|
mount --rbind /run /mnt/target/run
|
||||||
|
mkdir /mnt/target/proc
|
||||||
|
mount --rbind /run /mnt/target/proc
|
||||||
|
mkdir /mnt/target/sys
|
||||||
|
mount --rbind /run /mnt/target/sys
|
||||||
|
mkdir /mnt/target/dev
|
||||||
|
mount --rbind /run /mnt/target/dev
|
||||||
|
|
||||||
|
# actual storage
|
||||||
mkdir /mnt/target/boot
|
mkdir /mnt/target/boot
|
||||||
mount "$TARGET_PART_BOOT" /mnt/target/boot
|
mount "$TARGET_PART_BOOT" /mnt/target/boot
|
||||||
mkdir /mnt/target/boot/efi
|
mkdir /mnt/target/boot/efi
|
||||||
mount "$TARGET_PART_EFI" /mnt/target/boot/efi
|
mount "$TARGET_PART_EFI" /mnt/target/boot/efi
|
||||||
mkdir /mnt/target/container
|
mkdir /mnt/target/run/void-usb/container
|
||||||
mount "$TARGET_PART_BIG" /mnt/target/container
|
mount "$TARGET_PART_BIG" /mnt/target/run/void-usb/container
|
||||||
mkdir /mnt/target/home
|
mkdir /mnt/target/home
|
||||||
mkdir /mnt/target/container/home
|
mkdir /mnt/target/run/void-usb/container/home
|
||||||
mount --bind /mnt/target/container/home /mnt/target/home
|
mount --bind /mnt/target/run/void-usb/container/home /mnt/target/home
|
||||||
|
|
||||||
clear
|
clear
|
||||||
echo "Storage is now prepared and ready for installation.
|
echo "Storage is now prepared and ready for installation.
|
||||||
|
@ -198,7 +210,6 @@ compress="xz"
|
||||||
add_dracutmodules+=" void-usb "
|
add_dracutmodules+=" void-usb "
|
||||||
omit_dracutmodules+=" nvdimm resume "' > /mnt/target/etc/dracut.conf.d/99-void-usb.conf
|
omit_dracutmodules+=" nvdimm resume "' > /mnt/target/etc/dracut.conf.d/99-void-usb.conf
|
||||||
|
|
||||||
#TODO: mount /container
|
|
||||||
mkdir -p /mnt/target/lib/dracut/modules.d/90void-usb
|
mkdir -p /mnt/target/lib/dracut/modules.d/90void-usb
|
||||||
chmod 755 /mnt/target/lib/dracut/modules.d/90void-usb
|
chmod 755 /mnt/target/lib/dracut/modules.d/90void-usb
|
||||||
wget --output-document=/mnt/target/lib/dracut/modules.d/90void-usb/module-setup.sh https://lostcave.ddnss.de/git/BodgeMaster/void-minecraft-usb/raw/branch/master/dracut-modules/90void-usb/module-setup.sh
|
wget --output-document=/mnt/target/lib/dracut/modules.d/90void-usb/module-setup.sh https://lostcave.ddnss.de/git/BodgeMaster/void-minecraft-usb/raw/branch/master/dracut-modules/90void-usb/module-setup.sh
|
||||||
|
@ -216,14 +227,13 @@ echo "
|
||||||
echo "# See fstab(5).
|
echo "# See fstab(5).
|
||||||
# <device> <mount point> <fstype> <options> <dump> <pass>
|
# <device> <mount point> <fstype> <options> <dump> <pass>
|
||||||
|
|
||||||
# /container and the underlying image for / are mounted by initramfs
|
# /run/void-usb/container and the underlying image for / are mounted by initramfs
|
||||||
# TODO: Do we need them here?
|
|
||||||
|
|
||||||
# TODO: add overlayfs
|
# TODO: add overlayfs
|
||||||
|
|
||||||
UUID=$(blkid --output value --match-tag UUID $TARGET_PART_BOOT) /boot f2fs defaults,nodev,nosuid 0 2
|
UUID=$(blkid --output value --match-tag UUID $TARGET_PART_BOOT) /boot f2fs defaults,nodev,nosuid 0 2
|
||||||
UUID=$(blkid --output value --match-tag UUID $TARGET_PART_EFI) /boot/efi vfat defaults,fmask=0077,dmask=0077 0 2
|
UUID=$(blkid --output value --match-tag UUID $TARGET_PART_EFI) /boot/efi vfat defaults,fmask=0077,dmask=0077 0 2
|
||||||
/container/home /home none bind 0 0
|
/run/void-usb/container/home /home none bind 0 0
|
||||||
" > /mnt/target/etc/fstab
|
" > /mnt/target/etc/fstab
|
||||||
|
|
||||||
if grep "#KEYMAP=" /mnt/target/etc/rc.conf; then
|
if grep "#KEYMAP=" /mnt/target/etc/rc.conf; then
|
||||||
|
@ -325,7 +335,7 @@ chmod 744 /mnt/target/etc/kernel.d/post-remove/99-void-usb
|
||||||
|
|
||||||
run_in_target xbps-reconfigure -fa
|
run_in_target xbps-reconfigure -fa
|
||||||
|
|
||||||
# running xchroot directly bc run_in_target function doesn’t allow user input
|
# running chroot directly bc run_in_target function doesn’t allow user input
|
||||||
xchroot /mnt/target /opt/void-usb/backup-fs
|
chroot /mnt/target /opt/void-usb/backup-fs
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -13,9 +13,9 @@ do not rely on the RTC
|
||||||
- use ntp to get time
|
- use ntp to get time
|
||||||
- only fall back to using rtc if offline
|
- only fall back to using rtc if offline
|
||||||
- do not set the RTC
|
- do not set the RTC
|
||||||
move /boot to /container instead of its own partition
|
move /boot to /run/void-usb/container instead of its own partition
|
||||||
look into UEFI specs and general availability of FAT16 support
|
look into UEFI specs and general availability of FAT16 support
|
||||||
- if possible, shrink ESP and move GRUB to /container
|
- if possible, shrink ESP and move GRUB to /run/void-usb/container
|
||||||
add manufacturer where users select the target device
|
add manufacturer where users select the target device
|
||||||
show user-firently status instead of scrolling output from all sorts of tools
|
show user-firently status instead of scrolling output from all sorts of tools
|
||||||
|
|
||||||
|
@ -39,13 +39,11 @@ f2fs for home
|
||||||
boot setup + dracut configuration
|
boot setup + dracut configuration
|
||||||
- root=/dev/loop0 ro
|
- root=/dev/loop0 ro
|
||||||
- custom dracut module
|
- custom dracut module
|
||||||
- pre-udev script
|
|
||||||
- make loop0 appear
|
|
||||||
- pre-mount script
|
- pre-mount script
|
||||||
- mount /container by UUID (possibly passed from a kernel command line parameter)
|
- mount /run/void-usb/container by UUID (passed from a kernel command line parameter)
|
||||||
- losetup the squashfs img
|
- losetup the squashfs img
|
||||||
- pre-pivot script?
|
- pre-pivot script?
|
||||||
- do we need one to move over the /container mount to real root?
|
- do we need one to move over the /run/void-usb/container mount to real root?
|
||||||
- overlayfs gets mounted from fstab
|
- overlayfs gets mounted from fstab
|
||||||
|
|
||||||
when backing up
|
when backing up
|
||||||
|
|
|
@ -49,13 +49,13 @@ Backing up the system will take some time.
|
||||||
if yesno; then
|
if yesno; then
|
||||||
echo "Backing up..."
|
echo "Backing up..."
|
||||||
#TODO: fiddle with squashfs parameters to find optimal settings
|
#TODO: fiddle with squashfs parameters to find optimal settings
|
||||||
#TODO: What (if any) device nods need to be created? (man mksquashfs -> pseudo file)
|
#TODO: exclude /tmp
|
||||||
mksquashfs / /container/new_squashfs.img -b 1M -comp xz -one-file-system -progress -noappend -e /var/cache/xbps
|
mksquashfs / /run/void-usb/container/new_squashfs.img -b 1M -comp xz -one-file-system -progress -noappend -e /var/cache/xbps
|
||||||
#TODO: check if enough disk space
|
#TODO: check if enough disk space
|
||||||
# yes -> create new image next to old image
|
# yes -> create new image next to old image
|
||||||
# no -> create new image in RAM
|
# no -> create new image in RAM
|
||||||
#TODO: figure out when appending to existing squashfs is a good idea
|
#TODO: figure out when appending to existing squashfs is a good idea
|
||||||
mv /container/new_squashfs.img /container/squashfs.img
|
mv /run/void-usb/container/new_squashfs.img /run/void-usb/container/squashfs.img
|
||||||
else
|
else
|
||||||
echo ""
|
echo ""
|
||||||
echo "Not backing up."
|
echo "Not backing up."
|
||||||
|
|
Loading…
Reference in New Issue