dispatch.sh: Make dispatching actually work for rrsync and diff

Make it work. Basic BSD shell doesn't seem to have array support (read
failed and ${!VAR[@]} as well). Also I don't know integer arithmetic so
I do a runtime length for the loop.

As we don't put $MACHINE/$RELASE into an `` block we should be okay
and not run into remote execution.
This commit is contained in:
Holger Hans Peter Freyther 2017-08-07 15:53:55 +08:00
parent 2061115bbf
commit a7fc6e6009
1 changed files with 27 additions and 4 deletions

31
scripts/dispatch.sh Normal file → Executable file
View File

@ -4,14 +4,37 @@
# TODO: Make this interactive and show the diff before and then
# do the merge?
case "$SSH_ORIGINAL_COMMAND" in
set -e
# Extract first part...
item=1
for i in $SSH_ORIGINAL_COMMAND;
do
if [ $item = "1" ]; then
CMD=$i
elif [ $item = "11" ]; then
MACHINE=$i
elif [ $item = "111" ]; then
RELEASE=$i
else
echo "Unknown.. $i"
fi
item="1$item"
done
case "$CMD" in
"rsync")
exec /usr/local/bin/rrsync web-files
exec /usr/local/bin/rrsync $1
;;
"diff-testing")
exec `dirname $0`/make-stable.sh $1 $2 dry-run
cd $1
cd ../
exec `dirname $0`/make-stable.sh $MACHINE $RELEASE dry-run
;;
"merge-testing")
exec `dirname $0`/make-stable.sh $1 $2
cd $1
cd ../
exec `dirname $0`/make-stable.sh $MACHINE $RELEASE
;;
esac