Commit 228e71c9 authored by Nicolas Reboul's avatar Nicolas Reboul

--host rename to --repo : permit to abstract if this is a remote or a local repo

parent a0eb5202
#!/usr/bin/env bash
# TODO: BUG SSH command in authrized_key file --> not executed
# --> due to the order of authorize key file, if there is an other rule before the private key specify
# is not considerered
# TODO: BUG interpretation root@niirvana.nii
# --> due to the order of authorize key file, if there is an other rule before the private key specify
# is not considerered
BACKUNIIN_BIN_ROOT=$(realpath $(dirname $0))
HELP_PADDING=30
BACKUNIIN_REMOTE_HOST=""
BACKUNIIN_REPO=""
BACKUNIIN_ROOT_CONF=${XDG_CONFIG_HOME:-$HOME/.config}/backuniin
HELP=0
......@@ -37,8 +42,8 @@ while [ $# -gt 0 ]
do
key="$1"
case $key in
--host)
BACKUNIIN_REMOTE_HOST=$2
--repo)
BACKUNIIN_REPO=$2
shift
;;
-h|--help)
......
......@@ -12,6 +12,7 @@ backuniin_help_init_detail(){
echo_notice " init repo"
}
function backuniin_init(){
INIT_ACTION=$1
shift
......
......@@ -7,7 +7,6 @@
function init_repo(){
echo_info "Initializing backuniin repo..."
echo "borg init $BACKUNIIN_REMOTE_HOST:$@ -e repokey-blake2"
borg init $BACKUNIIN_REMOTE_HOST:$@ -e repokey-blake2 --debug
borg init $BACKUNIIN_REPO:$@ -e repokey-blake2 --debug
echo_ok "OK"
}
\ No newline at end of file
......@@ -16,7 +16,7 @@ function init_ssh(){
# 4- run borg serve on a specific repo in authorized_key
echo "command=\"cd ~/backuniin_repos; borg serve --restrict-to-path ~/backuniin_repos \",restrict \
`cat $BACKUNIIN_ROOT_CONF/ssh/backuniin_key.pub`" \
| ssh $BACKUNIIN_REMOTE_HOST sh -c 'cat >> ~/.ssh/authorized_keys; mkdir -p ~/backuniin_repos'
| ssh $BACKUNIIN_REPO sh -c 'cat >> ~/.ssh/authorized_keys; mkdir -p ~/.config/backuniin/repos'
echo_notice "Backuniin key added to authorized key file on remote."
echo -e "#SSH key used by borg
export BORG_RSH=\"ssh -o IdentitiesOnly=yes -i $BACKUNIIN_ROOT_CONF/ssh/backuniin_key\"" >> $BACKUNIIN_ROOT_CONF/env
......@@ -24,4 +24,4 @@ export BORG_RSH=\"ssh -o IdentitiesOnly=yes -i $BACKUNIIN_ROOT_CONF/ssh/backunii
echo_ok "Backuniin ssh config OK."
}
#function ssh_keygen()
function ssh_config(){}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment