rename backup-fs to system-image

The terminology for "backing up" came from TinyCore Linux but it’s really more confusing than helpful for ppl who don’t know what’s happening under the hood.
master
BodgeMaster 2023-07-14 21:27:57 +02:00
parent eeda7c61c0
commit 0460940582
4 changed files with 23 additions and 19 deletions

View File

@ -70,7 +70,7 @@ The scripts will take it from there, asking you for information and downloading
- `install-stage2.sh`: continues setting up things after booting into the freshly installed base system
- `opt/`: contains files to be installed in /opt/void-usb/
- `grub-config`: custom grub config generator (probably not necessary but at this point I dont wanna dig into the default one)
- `backup-fs`: helper script to rebuild the squashfs
- `system-image`: helper script to rebuild the squashfs
- `kernel.d/`: kernel hooks to be installed in /etc/kernel.d
- `skel/`: files to be added to /etc/skel
- `bashrc`: my custom .bashrc

View File

@ -268,13 +268,13 @@ wget --output-document=/mnt/target/lib/dracut/modules.d/90void-usb/overlay.sh "$
chmod 744 /mnt/target/lib/dracut/modules.d/90void-usb/overlay.sh >> $LOGFILE 2>&1
echo "done"
echo -n "Adding file system helper... "
echo -n "Adding system-image helper... "
mkdir -p /mnt/target/opt/void-usb >> $LOGFILE 2>&1
chmod 755 /mnt/target/opt/void-usb >> $LOGFILE 2>&1
wget --output-document=/mnt/target/opt/void-usb/backup-fs "$GIT_REPO_BASE/opt/backup-fs" >> $LOGFILE 2>&1
chmod 744 /mnt/target/opt/void-usb/backup-fs >> $LOGFILE 2>&1
wget --output-document=/mnt/target/opt/void-usb/system-image "$GIT_REPO_BASE/opt/system-image" >> $LOGFILE 2>&1
chmod 744 /mnt/target/opt/void-usb/system-image >> $LOGFILE 2>&1
echo "
/opt/void-usb/backup-fs" >> /mnt/target/etc/rc.shutdown
/opt/void-usb/system-image" >> /mnt/target/etc/rc.shutdown
echo "done"
echo "Adding fstab."
@ -455,6 +455,6 @@ press_any_key
echo "Creating system image..."
#TODO: make this work without user interaction
run_in_target /opt/void-usb/backup-fs
run_in_target /opt/void-usb/system-image
reboot
#

View File

@ -31,7 +31,6 @@ put a README.txt on root dir of F2FS partition
add online check to all the selections that need internet
sort out /etc/resolv.conf for the chroot
set keyboard layout for initramfs
refer to creating a new system image as such instead of "backing up"
need some sort of notification handler?
when installing GUI also install elogind xdg-utils dbus-elogind dbus-elogind-libs dbus-elogind-x11

View File

@ -50,34 +50,39 @@ for I in ${!MOUNT_LIST[@]}; do
fi
done
touch /run/void-usb/backup-fs-excludes
touch /run/void-usb/backup-fs-pseudo
touch /run/void-usb/system-image-excludes
touch /run/void-usb/system-image-pseudo
for I in ${!EXCLUDE_LIST[@]}; do
echo "/${EXCLUDE_LIST[$I]}" >> /run/void-usb/backup-fs-excludes
echo "/${EXCLUDE_LIST[$I]}" >> /run/void-usb/system-image-excludes
FILE_PERMS="$(stat -c '%a %u %g' "${EXCLUDE_LIST[$I]}")"
echo "\"/${EXCLUDE_LIST[$I]}\" d $FILE_PERMS" >> /run/void-usb/backup-fs-pseudo
echo "\"/${EXCLUDE_LIST[$I]}\" d $FILE_PERMS" >> /run/void-usb/system-image-pseudo
done
#TODO: refuse to run if system is running
#TODO: add a way to force backing up without asking (for example a file in /run/void-usb)
#TODO: add a way to force a new system image up without asking (for example a file in /run/void-usb)
#TODO: colors (bright white / light gray for readability)
echo "Back up system changes to disk?
echo "Create a new system image?
This only affects things outside the /home directory.
Backing up the system will take some time.
This will replace the existing system image with a snapshot of the currently
running system. Choosing no here will discard any newly installed programs,
updates, system configuration changes, etc.
This should not affect your files in /home as they are stored to disk directly.
Check /TODO/README.txt for more information.
Creating a new system image will take some time.
"
if yesno; then
echo "Backing up..."
mksquashfs / /run/void-usb/container/new_squashfs.img -b 1M -comp xz -progress -noappend -pf /run/void-usb/backup-fs-pseudo -ef /run/void-usb/backup-fs-excludes
echo "Building image..."
mksquashfs / /run/void-usb/container/new_squashfs.img -b 1M -comp xz -progress -noappend -pf /run/void-usb/system-image-pseudo -ef /run/void-usb/system-image-excludes
#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 /run/void-usb/container/new_squashfs.img /run/void-usb/container/squashfs.img
else
echo ""
echo "Not backing up."
echo "Discarding system changes."
fi