Last active
January 8, 2020 02:51
-
-
Save dogtopus/4d95930fd10659010892600fd9aeb6f7 to your computer and use it in GitHub Desktop.
Safer snap-pac boot backup hook for Raspberry Pi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ ! -d /.bootbackup ]]; then | |
mkdir /.bootbackup | |
fi | |
grep -qs '/boot ' /proc/mounts || mount /boot | |
rsync -av --delete /boot /.bootbackup |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Trigger] | |
Operation = Upgrade | |
Operation = Install | |
Operation = Remove | |
Type = File | |
Target = boot/* | |
Target = usr/lib/modules/*/vmlinuz | |
Target = usr/lib/initcpio/* | |
[Action] | |
Depends = rsync | |
Description = Backing up /boot... | |
When = PostTransaction | |
Exec = /opt/backup-boot.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment