#! /bin/bash -ex

name=shell-env
source="https://github.com/guppy4j/shell-env.git"
target=$1

ssh_run() {
  ssh $target -C "$1"
}

ssh_run "svn co ${source} .${name}" || ssh_run "git clone ${source} .${name}"

scripts=".${name}/src/main/scripts"
etc=".${name}/src/main/config/etc"

ssh_run "ln -s --force --backup=simple ${etc} .etc"
ssh_run "ln -s --force --backup=simple ${scripts} ."
ssh_run "chmod ugo+x ${scripts}/*.sh"

ssh_run "${scripts}/setup-symlinks.sh"


#! /bin/bash -ex

host=$1
name=shell-env
repo="https://github.com/guppy4j/${name}.git"
dir=".${name}"

ssh_run() {
  ssh "${host}" -C "$1"
}

ssh_run "rm -rf ${dir}"
ssh_run "svn co ${repo} ${dir}" || ssh_run "git clone ${repo} ${dir}"

etc="${dir}/src/main/config/etc"
scripts="${dir}/src/main/scripts"

ssh_run "ln -s --force --backup=simple ${etc} .etc"
ssh_run "ln -s --force --backup=simple ${scripts} ."
ssh_run "chmod ugo+x ${scripts}/*.sh"

ssh_run "${scripts}/setup-symlinks.sh"


Use simpler variables and always clear install dir
Use simpler variables and always clear install dir
