#!/usr/bin/sh -e usage() { echo 'Usage: kiss send-build [command] [options] build KISS packages on a remote server Options: -h, --help show this help message Subcommands: build [package] initiate a remote build status get current remote status status [package] get current remote status of a package get [package] receive a built package Configuration: Done via environment variables $KISS_SERV_HOST remote host to connect to (defaults to localhost) $KISS_SERV_USER remote host to connect to (defaults to $(whoami)) $KISS_SERV_PORT remote port to connect to (defaults to 22)' } parse_err() { echo "$1" $2 exit 2 } sshexec() { $sshcmd kiss serv $1 $2 exit } get() { pkg=$($sshcmd 'ls -1 ~/.cache/kiss/bin/' | sort | grep -m 1 "$2") rsync -azre "ssh -p $port" "$user@$host":/home/"$user"/.cache/kiss/bin/"$pkg" \ ~/.cache/kiss/bin echo "fetched $pkg from $host" exit } port=${KISS_SERV_PORT:-22} host=${KISS_SERV_HOST:-localhost} user=${KISS_SERV_USER:-$(whoami)} sshcmd="ssh -p $port $user@$host env KISS_PATH=$KISS_PATH" while [ "$1" != "" ]; do case $1 in -h | --help) usage exit ;; status | build) sshexec "$@" ;; get) "$1" "$@" ;; *) parse_err "ERROR: unknown option $1 \n" usage ;; esac shift 2 done parse_err "ERROR: no command given\n" usage