From e50420dd1baa991f9229f4dec10e82442684b7ac Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 27 Jul 2018 19:27:53 +0200 Subject: [PATCH] apply config file when starting riot, not installing, so we can support riots that were built by another process --- riot/install.sh | 1 - riot/start.sh | 7 +++++++ riot/stop.sh | 12 +++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/riot/install.sh b/riot/install.sh index d9cc7292f0..a215b46cea 100755 --- a/riot/install.sh +++ b/riot/install.sh @@ -12,7 +12,6 @@ curl -L https://github.com/vector-im/riot-web/archive/${RIOT_BRANCH}.zip --outpu unzip riot.zip rm riot.zip mv riot-web-${RIOT_BRANCH} riot-web -cp config-template/config.json riot-web/ cd riot-web npm install npm run build diff --git a/riot/start.sh b/riot/start.sh index 2c76747e46..35f66f68e3 100755 --- a/riot/start.sh +++ b/riot/start.sh @@ -12,6 +12,13 @@ fi echo "running riot on http://localhost:$PORT ..." pushd riot-web/webapp/ > /dev/null + +# backup config file before we copy template +if [ -f config.json ]; then + mv config.json $CONFIG_BACKUP +fi +cp $BASE_DIR/config-template/config.json . + python -m SimpleHTTPServer $PORT > /dev/null 2>&1 & PID=$! popd > /dev/null diff --git a/riot/stop.sh b/riot/stop.sh index 7ed18887f9..0773174fd1 100755 --- a/riot/stop.sh +++ b/riot/stop.sh @@ -1,9 +1,19 @@ #!/bin/bash BASE_DIR=$(readlink -f $(dirname $0)) -cd $BASE_DIR PIDFILE=riot.pid +CONFIG_BACKUP=config.e2etests_backup.json + +cd $BASE_DIR + if [ -f $PIDFILE ]; then echo "stopping riot server ..." kill $(cat $PIDFILE) rm $PIDFILE + + # revert config file + cd riot-web/webapp + rm config.json + if [ -f $CONFIG_BACKUP ]; then + mv $CONFIG_BACKUP config.json + fi fi