1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/borg_ynh.git synced 2024-09-03 18:16:05 +02:00

backup_method coding style

This commit is contained in:
Salamandar 2024-05-04 17:30:25 +02:00
parent 5e2f1e7910
commit 75c2765211

View file

@ -1,13 +1,12 @@
#!/bin/bash #!/usr/bin/env bash
set -Eeuo pipefail
set -eo pipefail source "__INSTALL_DIR__/venv/bin/activate"
source __INSTALL_DIR__/venv/bin/activate app="__APP__"
app="${0#"./05-"}" BORG_PASSPHRASE="$(yunohost app setting "$app" passphrase)"
app="${app%"_app"}" repo="$(yunohost app setting "$app" repository)" #$4
BORG_PASSPHRASE="$(yunohost app setting $app passphrase)"
repo="$(yunohost app setting $app repository)" #$4
if ssh-keygen -F "__SERVER__" >/dev/null ; then if ssh-keygen -F "__SERVER__" >/dev/null ; then
BORG_RSH="ssh -i /root/.ssh/id_${app}_ed25519 -oStrictHostKeyChecking=yes " BORG_RSH="ssh -i /root/.ssh/id_${app}_ed25519 -oStrictHostKeyChecking=yes "
else else
@ -24,7 +23,6 @@ log_with_timestamp() {
} }
do_backup() { do_backup() {
export BORG_PASSPHRASE export BORG_PASSPHRASE
export BORG_RSH export BORG_RSH
export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes
@ -88,7 +86,7 @@ case "$1" in
do_backup "$work_dir" "$name" "$repo" "$size" "$description" do_backup "$work_dir" "$name" "$repo" "$size" "$description"
;; ;;
mount) mount)
do_mount do_mount "$work_dir" "$name" "$repo" "$size" "$description"
;; ;;
*) *)
echo "hook called with unknown argument \`$1'" >&2 echo "hook called with unknown argument \`$1'" >&2