bundles/backup-client: add backup-pre-hooks (fixes #24)

This commit is contained in:
Franzi 2021-02-07 20:47:22 +01:00
parent a8690b13b8
commit 0d1e987a6f
Signed by: kunsi
GPG key ID: 12E3D2136B818350
3 changed files with 41 additions and 21 deletions

View file

@ -27,6 +27,12 @@ elif status[0] == 'rsync_error':
', '.join(status[1:])
))
exit(2)
elif status[0] == 'hook':
print('run-parts /etc/backup-pre-hook.d failed with exit code {}'.format(status[1]))
exit(2)
elif status[0] == 'abort_no_key':
print('no ssh key found in /etc/backup.priv!')
exit(1)
else:
# garbage in file
print(' '.join(status))

View file

@ -9,6 +9,14 @@ then
exit 1
fi
run-parts --exit-on-error -- /etc/backup-pre-hooks.d
exitcode=$?
if [[ $exitcode != 0]]
then
echo "hook $exitcode" > "$statusfile"
exit 1
fi
rsync_errors=""
% for path in sorted(paths):
rsync -zaAP --numeric-ids --delete --relative \