no need for push/popd in sub-shell

This commit is contained in:
Bruno Windels 2018-07-27 14:10:19 +02:00
parent 96374f4e54
commit 5e1517eb4d
6 changed files with 10 additions and 21 deletions

View file

@ -6,15 +6,12 @@ if [[ -d $BASE_DIR/riot-web ]]; then
exit exit
fi fi
cd $BASE_DIR
pushd $BASE_DIR > /dev/null
curl -L https://github.com/vector-im/riot-web/archive/${RIOT_BRANCH}.zip --output riot.zip curl -L https://github.com/vector-im/riot-web/archive/${RIOT_BRANCH}.zip --output riot.zip
unzip riot.zip unzip riot.zip
rm riot.zip rm riot.zip
mv riot-web-${RIOT_BRANCH} riot-web mv riot-web-${RIOT_BRANCH} riot-web
cp config-template/config.json riot-web/ cp config-template/config.json riot-web/
pushd riot-web > /dev/null cd riot-web
npm install npm install
npm run build npm run build
popd > /dev/null
popd > /dev/null

View file

@ -1,10 +1,9 @@
PORT=8080 PORT=8080
echo "running riot on http://localhost:$PORT..." echo "running riot on http://localhost:$PORT..."
BASE_DIR=$(realpath $(dirname $0)) BASE_DIR=$(realpath $(dirname $0))
pushd $BASE_DIR > /dev/null cd $BASE_DIR/
pushd riot-web/webapp/ > /dev/null pushd riot-web/webapp/ > /dev/null
python -m SimpleHTTPServer $PORT > /dev/null 2>&1 & python -m SimpleHTTPServer $PORT > /dev/null 2>&1 &
PID=$! PID=$!
popd > /dev/null popd > /dev/null
echo $PID > riot.pid echo $PID > riot.pid
popd > /dev/null

View file

@ -1,6 +1,5 @@
BASE_DIR=$(realpath $(dirname $0)) BASE_DIR=$(realpath $(dirname $0))
pushd $BASE_DIR > /dev/null cd $BASE_DIR
PIDFILE=riot.pid PIDFILE=riot.pid
kill $(cat $PIDFILE) kill $(cat $PIDFILE)
rm $PIDFILE rm $PIDFILE
popd > /dev/null

View file

@ -12,13 +12,13 @@ if [[ -d $BASE_DIR/$SERVER_DIR ]]; then
exit exit
fi fi
pushd $BASE_DIR > /dev/null cd $BASE_DIR
mkdir -p installations/ mkdir -p installations/
curl https://codeload.github.com/matrix-org/synapse/zip/$SYNAPSE_BRANCH --output synapse.zip curl https://codeload.github.com/matrix-org/synapse/zip/$SYNAPSE_BRANCH --output synapse.zip
unzip synapse.zip unzip synapse.zip
mv synapse-$SYNAPSE_BRANCH $SERVER_DIR mv synapse-$SYNAPSE_BRANCH $SERVER_DIR
pushd $SERVER_DIR cd $SERVER_DIR
virtualenv -p python2.7 env virtualenv -p python2.7 env
source env/bin/activate source env/bin/activate
pip install --upgrade pip pip install --upgrade pip
@ -36,5 +36,3 @@ sed -i "s#{{SYNAPSE_PORT}}#${PORT}/#g" homeserver.yaml
sed -i "s#{{FORM_SECRET}}#$(uuidgen)#g" homeserver.yaml sed -i "s#{{FORM_SECRET}}#$(uuidgen)#g" homeserver.yaml
sed -i "s#{{REGISTRATION_SHARED_SECRET}}#$(uuidgen)#g" homeserver.yaml sed -i "s#{{REGISTRATION_SHARED_SECRET}}#$(uuidgen)#g" homeserver.yaml
sed -i "s#{{MACAROON_SECRET_KEY}}#$(uuidgen)#g" homeserver.yaml sed -i "s#{{MACAROON_SECRET_KEY}}#$(uuidgen)#g" homeserver.yaml
popd #back to synapse root dir
popd #back to wherever we were

View file

@ -1,7 +1,5 @@
BASE_DIR=$(realpath $(dirname $0)) BASE_DIR=$(realpath $(dirname $0))
pushd $BASE_DIR > /dev/null cd $BASE_DIR
pushd installations/consent > /dev/null cd installations/consent
source env/bin/activate source env/bin/activate
./synctl start 2> /dev/null ./synctl start 2> /dev/null
popd > /dev/null
popd > /dev/null

View file

@ -1,7 +1,5 @@
BASE_DIR=$(realpath $(dirname $0)) BASE_DIR=$(realpath $(dirname $0))
pushd $BASE_DIR > /dev/null cd $BASE_DIR
pushd installations/consent > /dev/null cd installations/consent
source env/bin/activate source env/bin/activate
./synctl stop ./synctl stop
popd > /dev/null
popd > /dev/null