snapper-rollback
snapper-rollback copied to clipboard
Add support for systems with /boot outside the @-subvolume
Thanks for this nice tool.
If you have an encrypted system your /boot
is usually not part of the root-partition.
I`ve made a small patch which resets the boot-partition alongside with the @-subvolume.
It aussumes that you use the pacman-hook suggested in https://wiki.archlinux.org/title/System_backup#Snapshots_and_/boot_partition
I have patched this PR in my Arch PKGbuild and it seems to work fine. But not with the current pacman hook suggested in the wiki. There used to be a single hook listed, now it is for pre- and post- This example works fine:
[Trigger]
Type = Package
Operation = Install
Operation = Upgrade
Operation = Remove
Target = systemd
[Trigger]
Type = Path
Operation = Install
Operation = Upgrade
Target = boot/vmlinuz-*
Target = usr/lib/modules/*/vmlinuz
Target = usr/lib/initcpio/*
[Action]
Description = Backing up /boot...
When = PostTransaction
Exec = /usr/bin/bash -c '/usr/bin/rsync -arq --mkpath --delete /boot/ /.bootbackup/boot'
Depends = rsync
This works well, but one problem I see is that it relies on the conf. only for restoring /boot. If external_boot is true, and there is no backup in the snapshot, /boot will be removed and not replaced because of the missing backup in the snapshot. Maybe there should be a test so this does not happen? Just removing the rm -rf and replacing cp with rsync -aq --delete should do the trick and not wipe out the current /boot if there is nothing to cp.