diff options
author | June McEnroe <programble@gmail.com> | 2018-02-22 18:27:26 -0500 |
---|---|---|
committer | June McEnroe <programble@gmail.com> | 2018-02-22 18:27:26 -0500 |
commit | bcf4b48fd9d77e4c28ca51180a69a6b06231c7e4 (patch) | |
tree | 056712f5276b4f1f0f7d8e6d6eb2e655868b8140 /ssh-command.sh | |
parent | Indent list of streams (diff) | |
download | stream-bcf4b48fd9d77e4c28ca51180a69a6b06231c7e4.tar.gz stream-bcf4b48fd9d77e4c28ca51180a69a6b06231c7e4.zip |
Add setup, start command
Diffstat (limited to 'ssh-command.sh')
-rw-r--r-- | ssh-command.sh | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/ssh-command.sh b/ssh-command.sh index 98b959e..8461d3b 100644 --- a/ssh-command.sh +++ b/ssh-command.sh @@ -1,9 +1,10 @@ #!/bin/sh set -e -u -SSH_HOST=stream@ascii.town +SSH_URL=stream@ascii.town +GIT_URL=git@ascii.town:stream.git -if [ -z "${SSH_ORIGINAL_COMMAND:-}" ]; then +welcome() { echo echo 'Welcome to Twinch!' echo @@ -12,15 +13,37 @@ if [ -z "${SSH_ORIGINAL_COMMAND:-}" ]; then cd public for id in *; do - echo " ssh -t $SSH_HOST $id" + echo " ssh -t $SSH_URL $id" done echo +} - exit +start() { + local key + key=$(setup $1) + echo + echo 'Stream created!' + echo + echo 'To view the stream, run:' + echo + echo " ssh -t $SSH_URL $1" + echo + echo 'To broadcast to the stream, run:' + echo + echo " git clone $GIT_URL" + echo " cd stream" + echo " make broadcast" + echo " ./broadcast | ssh $SSH_URL ingest $key" + echo +} +if [ -z "${SSH_ORIGINAL_COMMAND:-}" ]; then + welcome + exit else set $SSH_ORIGINAL_COMMAND case $1 in + start) start ${2##*/} ;; ingest) exec ingest private/${2##*/} ;; view) exec view public/${2##*/} ;; *) exec view public/${1##*/} ;; |