fix: server string

master
Kebler Network System Administrator 2021-08-29 09:30:12 -07:00
parent b1fd4a6dc6
commit b6e3f1bb2b
2 changed files with 18 additions and 6 deletions

View File

@ -23,13 +23,16 @@ root_command() {
eval $(parse_yaml $settings "s_") eval $(parse_yaml $settings "s_")
echo $s_source echo $s_source
echo $s_target echo $s_target
echo $s_host
fi fi
if [[ $s_server_host ]]; then if [[ $s_server_host ]]; then
s_server="rest:http$([[ $s_server_secure ]] && echo "s")://${s_server_host}$([[ $s_server_port ]] && echo :${s_server_port})" s_server="http$([[ $s_server_secure ]] && echo "s")://${s_server_host}$([[ $s_server_port ]] && echo :${s_server_port} || echo "")"
fi fi
local password=${args[--password]:-$BACKUP_PASSWORD} local password=${args[--password]:-$BACKUP_PASSWORD}
password=${password:-$s_password} password=${password:-$s_password}
[[ ! $password ]] && echo restic requires a backup repository password, exiting && return 2 [[ ! $password ]] && echo restic requires a backup repository password, exiting && return 2
@ -38,6 +41,9 @@ root_command() {
local server=${args[--server]:-$BACKUP_SERVER} local server=${args[--server]:-$BACKUP_SERVER}
server=${server:-$s_server} server=${server:-$s_server}
echo server $s_server
echo server $server
local backup_dir=${args[--backup_dir]:-$BACKUP_DIR} local backup_dir=${args[--backup_dir]:-$BACKUP_DIR}
backup_dir=${backup_dir:-$s_backup_dir} backup_dir=${backup_dir:-$s_backup_dir}
backup_dir=${backup_dir:-"/backup"} backup_dir=${backup_dir:-"/backup"}
@ -53,9 +59,9 @@ root_command() {
if [[ $(isAbsPath $target) ]]; then if [[ $(isAbsPath $target) ]]; then
echo absolute target directory echo absolute target directory
else else
target="/${HOSTNAME}/${target}" target="/${s_host:-$HOSTNAME}/${target}"
if [[ $server ]]; then if [[ $server ]]; then
target="${server}${target}" target="rest:${server}${target}"
else else
target=${backup_dir}${target} target=${backup_dir}${target}
fi fi

View File

@ -16,13 +16,16 @@ if [[ -f $settings ]]; then
eval $(parse_yaml $settings "s_") eval $(parse_yaml $settings "s_")
echo $s_source echo $s_source
echo $s_target echo $s_target
echo $s_host
fi fi
if [[ $s_server_host ]]; then if [[ $s_server_host ]]; then
s_server="rest:http$([[ $s_server_secure ]] && echo "s")://${s_server_host}$([[ $s_server_port ]] && echo :${s_server_port})" s_server="http$([[ $s_server_secure ]] && echo "s")://${s_server_host}$([[ $s_server_port ]] && echo :${s_server_port} || echo "")"
fi fi
local password=${args[--password]:-$BACKUP_PASSWORD} local password=${args[--password]:-$BACKUP_PASSWORD}
password=${password:-$s_password} password=${password:-$s_password}
[[ ! $password ]] && echo restic requires a backup repository password, exiting && return 2 [[ ! $password ]] && echo restic requires a backup repository password, exiting && return 2
@ -31,6 +34,9 @@ password="RESTIC_PASSWORD=${password}"
local server=${args[--server]:-$BACKUP_SERVER} local server=${args[--server]:-$BACKUP_SERVER}
server=${server:-$s_server} server=${server:-$s_server}
echo server $s_server
echo server $server
local backup_dir=${args[--backup_dir]:-$BACKUP_DIR} local backup_dir=${args[--backup_dir]:-$BACKUP_DIR}
backup_dir=${backup_dir:-$s_backup_dir} backup_dir=${backup_dir:-$s_backup_dir}
backup_dir=${backup_dir:-"/backup"} backup_dir=${backup_dir:-"/backup"}
@ -46,9 +52,9 @@ fi
if [[ $(isAbsPath $target) ]]; then if [[ $(isAbsPath $target) ]]; then
echo absolute target directory echo absolute target directory
else else
target="/${HOSTNAME}/${target}" target="/${s_host:-$HOSTNAME}/${target}"
if [[ $server ]]; then if [[ $server ]]; then
target="${server}${target}" target="rest:${server}${target}"
else else
target=${backup_dir}${target} target=${backup_dir}${target}
fi fi