1
0
mirror of https://github.com/octoleo/Purse.git synced 2024-12-28 03:45:04 +00:00

Include script in backup archive

This commit is contained in:
drduh 2020-05-25 14:58:56 -07:00
parent 883e68a95f
commit 7074a8bf4c

View File

@ -17,6 +17,7 @@ gpgconf="${HOME}/.gnupg/gpg.conf"
backuptar="${PURSE_BACKUP:=purse.$(hostname).$(date +%F).tar}"
safeix="${PURSE_INDEX:=purse.index}"
safedir="${PURSE_SAFE:=safe}"
script="$(basename $BASH_SOURCE)"
timeout=10
fail () {
@ -155,11 +156,12 @@ list_entry () {
}
backup () {
# Archive encrypted index and safe directory.
# Create an archive for backup.
if [[ -f "${safeix}" ]] ; then
cp "${gpgconf}" "gpg.conf.${now}"
tar cfv "${backuptar}" "${safeix}" "${safedir}" "gpg.conf.${now}"
tar cfv "${backuptar}" \
"${safeix}" "${safedir}" "gpg.conf.${now}" "${script}"
rm "gpg.conf.${now}"
else fail "Nothing to archive" ; fi