6
0
Fork 0

Compare commits

...

4 Commits

Author SHA1 Message Date
Joachim Desroches cadc027569
Fix typo in Prometheus. 2021-02-22 16:35:10 +01:00
Joachim Desroches 1db7d8b13e
Fix error message in __opennebula_repo. 2021-02-22 16:33:57 +01:00
Joachim Desroches efcbc19e01
Indent __borg_repo. 2021-02-22 16:31:36 +01:00
Joachim Desroches 169a584a81
Comment __borg type. 2021-02-22 16:27:53 +01:00
4 changed files with 13 additions and 7 deletions

View File

@ -1,9 +1,9 @@
#!/bin/sh
# Install the borg package
os=$(cat "${__global:?}/explorer/os")
case "$os" in
alpine|ubuntu|debian)
__package borgbackup
__package borgbackup
;;
*)
@ -12,18 +12,24 @@ case "$os" in
;;
esac
repository=$(cat "$__object/parameter/repository")
if [ -f "$__object/parameter/exclude" ]; then
# Get the repository location.
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")
else
excludes="/sys /proc /dev /run"
fi
# Build command
unknown_repo_warning_fragment="BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes"
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) /\""
# Setup cronjob.
require="__package/borgbackup" __cron daily-backup --user root --command "$borg_command" --hour 2

View File

@ -33,7 +33,7 @@ then
fi
cat <<- EOF
set -x
set -x
if [ ! -d "/${__object_id:?}" ]; then
$doas BORG_NEW_PASSPHRASE=$passphrase borg init -e ${enc:?} $appendonly /${__object_id:?}
fi

View File

@ -26,7 +26,7 @@ case "$os" in
--component opennebula
;;
*)
echo "This type is expected to run on Ubuntu, not $os. Exiting." >&2
echo "This type is expected to run on Debian or Ubuntu, not $os. Exiting." >&2
exit 1
;;
esac

View File

@ -6,7 +6,7 @@ case "$os" in
__package prometheus
;;
*)
echo "This type does not supper $os. Exiting." >&2
echo "This type does not support $os. Exiting." >&2
exit 1
;;
esac