6
0
Fork 0
This repository has been archived on 2022-03-14. You can view files and clone it, but cannot push or open issues or pull requests.
cdist-recycledcloud/type/__borg/manifest

30 lines
794 B
Bash

#!/bin/sh
os=$(cat "${__global:?}/explorer/os")
case "$os" in
alpine|ubuntu|debian)
__package borgbackup
__package borgbackup
;;
*)
echo "This type does not support $os. Exiting." >&2
exit 1
;;
esac
repository=$(cat "$__object/parameter/repository")
if [ -f "$__object/parameter/exclude" ]; then
excludes=$(cat "$__object/parameter/exclude")
else
excludes="/sys /proc /dev /run"
fi
for path in $excludes; do
exclude_fragment="$exclude_fragment --exclude $path"
done
unknown_repo_warning_fragment="BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes"
borg_command="sh -c \"$unknown_repo_warning_fragment borg create $exclude_fragment --stats $repository::daily-\\\$(date -I) /\""
require="__package/borgbackup" __cron daily-backup --user root --command "$borg_command" --hour 2