mirror of
https://github.com/YunoHost-Apps/borg_ynh.git
synced 2024-09-03 18:16:05 +02:00
Fix backup_method: don't use non existing activate script, use borg executable directly from the ven
This commit is contained in:
parent
0352f16586
commit
178a24b268
1 changed files with 7 additions and 7 deletions
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -Eeuo pipefail
|
set -Eeuo pipefail
|
||||||
|
|
||||||
source "__INSTALL_DIR__/venv/bin/activate"
|
borg="__INSTALL_DIR__/venv/bin/borg"
|
||||||
app="__APP__"
|
app="__APP__"
|
||||||
|
|
||||||
BORG_PASSPHRASE="$(yunohost app setting "$app" passphrase)"
|
BORG_PASSPHRASE="$(yunohost app setting "$app" passphrase)"
|
||||||
|
@ -34,7 +34,7 @@ do_backup() {
|
||||||
current_date=$(date +"%Y-%m-%d_%H:%M")
|
current_date=$(date +"%Y-%m-%d_%H:%M")
|
||||||
pushd "$work_dir"
|
pushd "$work_dir"
|
||||||
set +e
|
set +e
|
||||||
if borg init -e repokey "$repo" ; then
|
if "$borg" init -e repokey "$repo" ; then
|
||||||
# human_size=`echo $size | awk '{ suffix=" KMGT"; for(i=1; $1>1024 && i < length(suffix); i++) $1/=1024; print int($1) substr(suffix, i, 1), $3; }'`
|
# human_size=`echo $size | awk '{ suffix=" KMGT"; for(i=1; $1>1024 && i < length(suffix); i++) $1/=1024; print int($1) substr(suffix, i, 1), $3; }'`
|
||||||
# Speed in Kbps
|
# Speed in Kbps
|
||||||
# speed=1000
|
# speed=1000
|
||||||
|
@ -47,18 +47,18 @@ This is an automated message from your beloved YunoHost server." | /usr/bin/mail
|
||||||
fi
|
fi
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
borg create "$repo::_${name}-${current_date}" ./ 2>&1 >/dev/null | log_with_timestamp
|
"$borg" create "$repo::_${name}-${current_date}" ./ 2>&1 >/dev/null | log_with_timestamp
|
||||||
popd
|
popd
|
||||||
|
|
||||||
# About thi _20 it's a crazy fix to avoid pruning wordpress__2
|
# About thi _20 it's a crazy fix to avoid pruning wordpress__2
|
||||||
# if you prune wordpress
|
# if you prune wordpress
|
||||||
borg prune "$repo" -P "_${name}-" --keep-hourly 2 --keep-daily=7 --keep-weekly=8 --keep-monthly=12 2>&1 >/dev/null | log_with_timestamp
|
"$borg" prune "$repo" -P "_${name}-" --keep-hourly 2 --keep-daily=7 --keep-weekly=8 --keep-monthly=12 2>&1 >/dev/null | log_with_timestamp
|
||||||
|
|
||||||
# Prune legacy archive name without error on wordpress/wordpress__2
|
# Prune legacy archive name without error on wordpress/wordpress__2
|
||||||
borg prune "$repo" -P "${name}_" --keep-within 2m --keep-monthly=12 2>&1 >/dev/null | log_with_timestamp
|
"$borg" prune "$repo" -P "${name}_" --keep-within 2m --keep-monthly=12 2>&1 >/dev/null | log_with_timestamp
|
||||||
|
|
||||||
# We prune potential manual backup older than 1 year
|
# We prune potential manual backup older than 1 year
|
||||||
borg prune "$repo" --keep-within 1y 2>&1 >/dev/null | log_with_timestamp
|
"$borg" prune "$repo" --keep-within 1y 2>&1 >/dev/null | log_with_timestamp
|
||||||
}
|
}
|
||||||
|
|
||||||
do_mount() {
|
do_mount() {
|
||||||
|
@ -69,7 +69,7 @@ do_mount() {
|
||||||
repo="$3"
|
repo="$3"
|
||||||
size="$4"
|
size="$4"
|
||||||
description="$5"
|
description="$5"
|
||||||
borg mount "$repo::$name" "$work_dir" 2>&1 >/dev/null | log_with_timestamp
|
"$borg" mount "$repo::$name" "$work_dir" 2>&1 >/dev/null | log_with_timestamp
|
||||||
}
|
}
|
||||||
|
|
||||||
work_dir="$2"
|
work_dir="$2"
|
||||||
|
|
Loading…
Add table
Reference in a new issue