summaryrefslogtreecommitdiff
path: root/bin/slave-build-connect
blob: e773256d88f2ddc599c709c16742ee8492f07d7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh

# shellcheck source=conf/default.conf
. "${0%/*}/../conf/default.conf"

if [ "${SSH_ORIGINAL_COMMAND%% *}" = "get-assignment" ] || \
  [ "${SSH_ORIGINAL_COMMAND%% *}" = "return-assignment" ]; then
  export slave="$1"
  # this is somewhat cumbersome, but we want:
  #  - no expansion of special shell-chars (*,;,\n,&&,~,$HOME)
  #  - splitting of arguments on spaces
  echo "${SSH_ORIGINAL_COMMAND#* }" | \
    xargs "${base_dir}/bin/${SSH_ORIGINAL_COMMAND%% *}"
else
  >&2 echo "Invalid command: '${SSH_ORIGINAL_COMMAND%% *}'"
  exit 42
fi