Compare commits

..

2 Commits

Author SHA1 Message Date
BodgeMaster 8ea9f547ea add backup script 2023-06-26 17:04:28 +02:00
BodgeMaster 383eb41189 grub-config: Fix paths of default linux some more 2023-06-21 07:42:21 +02:00
4 changed files with 75 additions and 4 deletions

View File

@ -55,6 +55,7 @@ The scripts will take it from there, asking you for information and downloading
- `install-stage1.sh`: sets up the base system and prepares for installation stage 2
- `install-stage2.sh`: continues setting up things after booting into the freshly installed base system
- `opt/grub-config`: the custom grub config generator to be installed in /opt/void-usb
- `opt/backup-fs`: helper script to regenerate the squashfs
- `procedure.txt`: notes to self, will disappear once finished
- `bootup.sh`: script that sets up the overlay
- `bashrc`: just a custom bashrc

View File

@ -185,6 +185,14 @@ echo "%wheel ALL=(ALL:ALL) ALL" > /mnt/target/etc/sudoers.d/wheel_as_sudo_group.
# TODO: add overlayfs scripts (bootup and shutdown)
mkdir -p /mnt/target/opt/void-usb
chmod 755 /mnt/target/opt/void-usb
wget --output-document=/mnt/target/opt/void-usb/backup-fs https://lostcave.ddnss.de/git/BodgeMaster/void-minecraft-usb/raw/branch/master/opt/backup-fs
chmod 744 /mnt/target/opt/void-usb/backup-fs
echo "
/opt/void-usb/backup-fs" >> /mnt/target/etc/rc.shutdown
echo "# See fstab(5).
# <device> <mount point> <fstype> <options> <dump> <pass>
@ -280,8 +288,6 @@ run_in_target grub-install --target=i386-pc --boot-directory=/boot/efi/LOADER --
run_in_target grub-install --target=i386-efi --boot-directory=/boot/efi/LOADER --efi-directory=/boot/efi --removable --no-nvram --modules="'$TARGET_PRELOAD_GRUB_MODULES'" "'/dev/$TARGET_DISK'"
run_in_target grub-install --target=x86_64-efi --boot-directory=/boot/efi/LOADER --efi-directory=/boot/efi --removable --no-nvram --modules="'$TARGET_PRELOAD_GRUB_MODULES'" "'/dev/$TARGET_DISK'"
mkdir -p /mnt/target/opt/void-usb
chmod 755 /mnt/target/opt/void-usb
wget --output-document=/mnt/target/opt/void-usb/grub-config https://lostcave.ddnss.de/git/BodgeMaster/void-minecraft-usb/raw/branch/master/opt/grub-config
chmod 744 /mnt/target/opt/void-usb/grub-config
@ -297,4 +303,6 @@ chmod 744 /mnt/target/etc/kernel.d/post-remove/99-void-usb
run_in_target xbps-reconfigure -fa
run_in_target /opt/void-usb/backup-fs
#

62
opt/backup-fs Normal file
View File

@ -0,0 +1,62 @@
#!/usr/bin/env bash
function yesno {
unset DISCARD_ME
while [ -z "$DISCARD_ME" ]; do
read -p "[y/n] " -n1 DISCARD_ME
case "$DISCARD_ME" in
y)
return 0
;;
n)
return 1
;;
*)
echo " Please enter y for yes or n for no."
unset DISCARD_ME
;;
esac
done
}
# Overlay should still be mounted, right?
cat /proc/mounts
read -p "
press any key" -n1 DISCARD_ME
# And no services running?
ps aux | grep -vF "[kworker"
read -p "
press any key" -n1 DISCARD_ME
#TODO: remove above debugging sanity checks
#TODO: refuse to run if system is running
#TODO: add a way to tell the system whether to back up before shutting down
#TODO: colors
echo "Back up system changes to disk?
This only affects things outside the /home directory.
Backing up the system will take some time.
"
if yesno; then
echo "Backing up..."
#TODO: fiddle with squashfs parameters to find optimal settings
#TODO: What (if any) device nods need to be created? (man mksquashfs -> pseudo file)
mksquashfs / /container/new_squashfs.img -b 1M -comp xz -one-file-system -progress -noappend -e /var/cache/xbps
#TODO: check if enough disk space
# yes -> create new image next to old image
# no -> create new image in RAM
#TODO: figure out when appending to existing squashfs is a good idea
mv /container/new_squashfs.img /container/squashfs.img
else
echo ""
echo "Not backing up."
fi

View File

@ -79,9 +79,9 @@ fi
menuentry '$OS_NAME' {
echo 'Loading Linux...'
linux $DEFAULT_LINUX
linux /$DEFAULT_LINUX
echo 'Loading initial ramdisk...'
initrd $DEFAULT_INITRAMFS
initrd /$DEFAULT_INITRAMFS
}
submenu 'Choose kernel version...' {" > "$GRUB_PREFIX/grub.cfg"