Compare commits
4 Commits
1173805f7d
...
cadc027569
Author | SHA1 | Date |
---|---|---|
Joachim Desroches | cadc027569 | |
Joachim Desroches | 1db7d8b13e | |
Joachim Desroches | efcbc19e01 | |
Joachim Desroches | 169a584a81 |
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Reference in New Issue