Pull updates to __borg_repo from recycled.cloud types.

This commit is contained in:
sparrowhawk 2021-04-21 15:27:52 +02:00
parent ed2f891200
commit f181b5ddb4
No known key found for this signature in database
GPG key ID: 6778C9C29C02D691
4 changed files with 17 additions and 3 deletions

View file

@ -27,10 +27,15 @@ then
appendonly='--append-only'
fi
if [ -f "${__object:?}/parameter/owner" ];
then
doas="sudo -u '$(cat "${__object:?}/parameter/owner")'"
fi
cat <<- EOF
if ! borg check --repository-only 1>&2 2>/dev/null "/${__object_id:?}";
then
BORG_NEW_PASSPHRASE=$passphrase borg init -e ${enc:?} $appendonly /${__object_id:?}
set -x
if [ ! -d "/${__object_id:?}" ]; then
$doas BORG_NEW_PASSPHRASE=$passphrase borg init -e ${enc:?} $appendonly /${__object_id:?}
fi
EOF

View file

@ -26,6 +26,9 @@ OPTIONAL PARAMETERS
passphrase
The passphrase to encrypt the keyfile with.
owner
Remote user owning the repository.
BOOLEAN PARAMETERS
------------------
append-only

View file

@ -12,3 +12,8 @@ case "$os" in
esac
__package "$borg_package"
if [ -f "${__object:?}/parameter/owner" ];
then
__package sudo
fi

View file

@ -1 +1,2 @@
passphrase
owner