#612029 etckeeper: Example hook for generating GPG-encrypted bundle after every commit

#612029#3
Date:
2011-02-04 22:19:18 UTC
From:
To:
On a couple of servers, I've set up automatic backups of /etc via git hooks, so
that after every commit I get a new GPG-encrypted git bundle in a backup
directory.  I thought this might make a useful example to include with
etckeeper.

/etc/.git/hooks/post-commit contains:
#!/bin/sh
exec /etc/post-commit-backup

/etc/post-commit-backup contains:
#!/bin/sh
echo '--- Backing up git repository ---' >&2
git bundle create - master | sudo -H -u someuser gpg --batch --encrypt --trust-model=always --recipient GPGKEYID > /srv/backups/etc.git-bundle.gpg
echo '--- Done backing up ---' >&2


- Josh Triplett