Comment __borg type.
This commit is contained in:
parent
1173805f7d
commit
169a584a81
1 changed files with 10 additions and 4 deletions
|
@ -1,9 +1,9 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Install the borg package
|
||||||
os=$(cat "${__global:?}/explorer/os")
|
os=$(cat "${__global:?}/explorer/os")
|
||||||
case "$os" in
|
case "$os" in
|
||||||
alpine|ubuntu|debian)
|
alpine|ubuntu|debian)
|
||||||
__package borgbackup
|
|
||||||
__package borgbackup
|
__package borgbackup
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -12,18 +12,24 @@ case "$os" in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
repository=$(cat "$__object/parameter/repository")
|
# Get the repository location.
|
||||||
if [ -f "$__object/parameter/exclude" ]; then
|
repository=$(cat "${__object:?}/parameter/repository")
|
||||||
|
|
||||||
|
# Use optionally specified excludes, or default ones for GNU/Linux.
|
||||||
|
if [ -f "${__object:?}/parameter/exclude" ]; then
|
||||||
excludes=$(cat "$__object/parameter/exclude")
|
excludes=$(cat "$__object/parameter/exclude")
|
||||||
else
|
else
|
||||||
excludes="/sys /proc /dev /run"
|
excludes="/sys /proc /dev /run"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Build command
|
||||||
|
unknown_repo_warning_fragment="BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes"
|
||||||
|
|
||||||
for path in $excludes; do
|
for path in $excludes; do
|
||||||
exclude_fragment="$exclude_fragment --exclude $path"
|
exclude_fragment="$exclude_fragment --exclude $path"
|
||||||
done
|
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) /\""
|
borg_command="sh -c \"$unknown_repo_warning_fragment borg create $exclude_fragment --stats $repository::daily-\\\$(date -I) /\""
|
||||||
|
|
||||||
|
# Setup cronjob.
|
||||||
require="__package/borgbackup" __cron daily-backup --user root --command "$borg_command" --hour 2
|
require="__package/borgbackup" __cron daily-backup --user root --command "$borg_command" --hour 2
|
||||||
|
|
Reference in a new issue