Include script in backup archive

This commit is contained in:
drduh 2020-05-25 14:58:56 -07:00
parent 883e68a95f
commit 7074a8bf4c
1 changed files with 4 additions and 2 deletions

View File

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