diff --git a/borg_backup.sh b/borg_backup.sh index f12eccb..ef9159e 100755 --- a/borg_backup.sh +++ b/borg_backup.sh @@ -1,10 +1,10 @@ -#!/bin/sh +#!/bin/bash ### ### borg_backup.sh ### ### Usage: -### "$0" [-f] +### borg_backup.sh [-f] ### ### Options: ### -f Force an update, even if one was already made today. @@ -16,7 +16,7 @@ print_help() { awk -F'### ' '/^###/ { print $2 }' "$0" } -cache_file='/home/flyingscorpio/.cache/borg_backup_hook_last_executed' +cache_file="$HOME/.cache/borg_backup_hook_last_executed" stat_cache_file() { # We only want this file to be executed at most once per day, so we stat a cache # file before running the rest of the code @@ -44,7 +44,8 @@ touch "$cache_file" BORG_REPO=ssh://flyingscorpio@2px.info:22/~/"$(hostname)".borg export BORG_REPO -export BORG_PASSPHRASE='ribosome66' +BORG_PASSPHRASE="$BORG_PASSPHRASE" +export BORG_PASSPHRASE # some helpers and error handling: info() { printf "\n%s %s\n\n" "$(date)" "$*" >&2; } diff --git a/pacman_hooks/borg_backup.hook b/pacman_hooks/borg_backup.hook index 38ffb19..9dc92df 100644 --- a/pacman_hooks/borg_backup.hook +++ b/pacman_hooks/borg_backup.hook @@ -6,7 +6,7 @@ Type = Package Target = * [Action] -Description = Update to lime2 +Description = Borg backup When = PreTransaction -Exec = /bin/sh /home/flyingscorpio/SetupCockpit/borg_backup.sh +Exec = source /home/flyingscorpio/SetupCockpit/secrets && /home/flyingscorpio/SetupCockpit/borg_backup.sh Depends = borg diff --git a/secrets.template b/secrets.template index 00cce75..02f52fe 100644 --- a/secrets.template +++ b/secrets.template @@ -1,3 +1,4 @@ # secrets - is sourced by some commands - this is a template SETUP_COCKPIT_EMAIL='' +BORG_PASSPHRASE=''