init
This commit is contained in:
commit
1816522a71
11 changed files with 229 additions and 0 deletions
46
bin/sc
Executable file
46
bin/sc
Executable file
|
@ -0,0 +1,46 @@
|
|||
#!/bin/sh
|
||||
|
||||
SC_COMMAND="$0 $@"
|
||||
SC_SRC=${SC_SRC:-/opt/sconnect}
|
||||
. $SC_SRC/lib/setup-env
|
||||
|
||||
SC_HOSTS=""
|
||||
|
||||
while getopts "h:" opt; do
|
||||
case $opt in
|
||||
h)
|
||||
SC_HOSTS="$SC_HOSTS $OPTARG"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
([ $# -lt 1 ] || [ -z "$1" ]) && fatal_log "usage: $0 [...args] <command>"
|
||||
command=$1
|
||||
shift
|
||||
|
||||
for host in $SC_HOSTS; do
|
||||
case $command in
|
||||
install)
|
||||
if [ "$host" = "local" ]; then
|
||||
escalate_command cp -r $SC_SRC/. /opt/sconnect
|
||||
escalate_command install -m a+rx -o root /opt/sconnect/bin/sc /usr/bin
|
||||
escalate_command install -m a+rx -o root /opt/sconnect/bin/sc-client /usr/bin
|
||||
else
|
||||
LOGI "attempting to install on $host..."
|
||||
rsync -au $SC_SRC/. $host:/opt/sconnect
|
||||
ssh $host SC_SKIP_WELCOME_HEADER=1 /opt/sconnect/bin/sc-client lib privileges escalate_command install -m a+rx -o root /opt/sconnect/bin/sc /usr/bin
|
||||
ssh $host SC_SKIP_WELCOME_HEADER=1 /opt/sconnect/bin/sc-client lib privileges escalate_command install -m a+rx -o root /opt/sconnect/bin/sc-client /usr/bin
|
||||
LOGI "installed"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if [ "$host" = "local" ]; then
|
||||
$SC_SRC/bin/sc-client $@
|
||||
else
|
||||
ssh -t $host SC_SKIP_WELCOME_HEADER=1 /opt/sconnect/bin/sc-client check 2>/dev/null || fatal_log not installed
|
||||
ssh -t $host /opt/sconnect/bin/sc-client $command $@
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue