aboutsummaryrefslogtreecommitdiffstats
path: root/backuper.sh
diff options
context:
space:
mode:
authorGravatar Robin Obůrka <r.oburka@gmail.com> 2017-04-03 12:25:20 +0200
committerGravatar Robin Obůrka <r.oburka@gmail.com> 2017-04-03 16:10:42 +0200
commit04b8bcbb6e5d7b8158e8ba161c0e5a8c99e7f765 (patch)
tree6ca1c44e898e0708b8f33b42cb956b30eded9f7d /backuper.sh
parentReorganize variables (diff)
downloadbackuper-04b8bcbb6e5d7b8158e8ba161c0e5a8c99e7f765.tar.xz
Add ssh_use_connection as a configuration option
Diffstat (limited to 'backuper.sh')
-rw-r--r--backuper.sh13
1 files changed, 11 insertions, 2 deletions
diff --git a/backuper.sh b/backuper.sh
index 3297780..436b791 100644
--- a/backuper.sh
+++ b/backuper.sh
@@ -25,6 +25,7 @@ EXCLUDE=""
GPG_RECIPIENTS=""
TAR_EXTRA_PARAMS=""
SSH_EXTRA_PARAMS=""
+SSH_CONNECTION=""
STORE=""
AFTER=""
FILE_TYPE=""
@@ -169,6 +170,11 @@ ssh_use_key() {
ssh_extra_param "-i "$KEY_PATH""
}
+ssh_use_connection() {
+ CONNSTR="$1"
+ SSH_CONNECTION="$CONNSTR"
+}
+
store() {
STORE="$@"
}
@@ -192,8 +198,11 @@ store_file() {
## This is not standart feature but it is common for several project I know
store_ssh() {
- [ -z "$1" ] && error "Specify server"
- CONNECTION="$1"
+ [ -z "$1" -a -z "$SSH_CONNECTION" ] && error "Specify server"
+ CONNECTION="$SSH_CONNECTION"
+ if [ -n "$1" ]; then
+ CONNECTION="$1"
+ fi
add_custom_stage "echo_and_copy "$FILENAME""
store "ssh $SSH_EXTRA_PARAMS "$CONNECTION""