From 861af62208b5b6642c8dbee4f4f714d7157d8d0a Mon Sep 17 00:00:00 2001 From: Tom Lant Date: Thu, 27 Sep 2018 13:21:45 +0100 Subject: [PATCH] Make the sed usage cross-platform compatible --- synapse/install.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/synapse/install.sh b/synapse/install.sh index b80b1ac705..c83ca6512a 100755 --- a/synapse/install.sh +++ b/synapse/install.sh @@ -45,8 +45,11 @@ cp -r $BASE_DIR/config-templates/$CONFIG_TEMPLATE/. ./ # Hashes used instead of slashes because we'll get a value back from $(pwd) that'll be # full of un-escapable slashes. -sed -i '' "s#{{SYNAPSE_ROOT}}#$(pwd)/#g" homeserver.yaml -sed -i '' "s#{{SYNAPSE_PORT}}#${PORT}#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#{{MACAROON_SECRET_KEY}}#$(uuidgen)#g" homeserver.yaml +# Manually directing output to .templated file and then manually renaming back on top +# of the original file because -i is a nonstandard sed feature which is implemented +# differently, across os X and ubuntu at least +sed "s#{{SYNAPSE_ROOT}}#$(pwd)/#g" homeserver.yaml > homeserver.yaml.templated && mv homeserver.yaml.templated homeserver.yaml +sed "s#{{SYNAPSE_PORT}}#${PORT}#g" homeserver.yaml > homeserver.yaml.templated && mv homeserver.yaml.templated homeserver.yaml +sed "s#{{FORM_SECRET}}#$(uuidgen)#g" homeserver.yaml > homeserver.yaml.templated && mv homeserver.yaml.templated homeserver.yaml +sed "s#{{REGISTRATION_SHARED_SECRET}}#$(uuidgen)#g" homeserver.yaml > homeserver.yaml.templated && mv homeserver.yaml.templated homeserver.yaml +sed "s#{{MACAROON_SECRET_KEY}}#$(uuidgen)#g" homeserver.yaml > homeserver.yaml.templated && mv homeserver.yaml.templated homeserver.yaml