Skip to content

Instantly share code, notes, and snippets.

@dogtopus
Last active January 8, 2020 02:51
Show Gist options
  • Save dogtopus/4d95930fd10659010892600fd9aeb6f7 to your computer and use it in GitHub Desktop.
Save dogtopus/4d95930fd10659010892600fd9aeb6f7 to your computer and use it in GitHub Desktop.
Safer snap-pac boot backup hook for Raspberry Pi
#!/bin/bash
if [[ ! -d /.bootbackup ]]; then
mkdir /.bootbackup
fi
grep -qs '/boot ' /proc/mounts || mount /boot
rsync -av --delete /boot /.bootbackup
[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