aboutsummarylogtreecommitdiffstats
path: root/setup.sh
diff options
context:
space:
mode:
Diffstat (limited to 'setup.sh')
-rw-r--r--setup.sh30
1 files changed, 18 insertions, 12 deletions
diff --git a/setup.sh b/setup.sh
index 2464837841a2..b82bc5cf430c 100644
--- a/setup.sh
+++ b/setup.sh
@@ -5,29 +5,35 @@ REG=${2:-no}
URL=${3:-http://localhost:8090}
RUNAS=${RUNAS:-synapse}
-if [[ "${USER}" = "none" ]] || [[ "${USER}" = "" ]] || [[ "${USER}" = "--register" ]]; then
+if [[ "${USER}" = "none" ]] || [[ "${USER}" = "" ]] ||\
+ [[ "${USER}" = "--register" ]] || [[ "${USER}" = "--help" ]] ||\
+ [[ "${REG}" = "--help" ]] || [[ "${URL}" = "--help" ]]; then
echo 'USER required'
echo ''
- echo 'usage $0 USER [--register [URL]]'
- echo '--register - generates registation.yaml file. Must edit config json first!!'
+ echo "usage $0 USER [--register [URL]]"
+ echo '--register - generates registation-USER.yaml file. Must edit config json first!!'
echo ' URL tells synapse how to reach the puppet daemon.'
echo ' defaults to http://localhost:8090'
echo ''
- echo 'Sets up some folders/symlinks to make up for a lack of configurability'
- echo 'in matrix-puppet-hangouts. After running this script, edit '
- echo ' /etc/synapse/matrix-puppet-hangouts/config-USER.json'
- echo 'Log into hangups and place the token in '
- echo ' /etc/synapse/matrix-puppet-hangouts/refresh_token-USER.txt'
- echo 'And place registration in'
- echo ' /etc/synapse/matrix-puppet-hangouts/registration-USER.yaml'
- echo 'Note that the registration path also goes in config-USER.json'
+ echo 'If only USER is provided:'
+ echo ' Sets up some folders/symlinks to make up for a lack of configurability'
+ echo ' in matrix-puppet-hangouts. After running this script, edit '
+ echo ' /etc/synapse/matrix-puppet-hangouts/config-USER.json'
+ echo ' Log into hangups and place the token in '
+ echo ' /etc/synapse/matrix-puppet-hangouts/refresh_token-USER.txt'
+ echo ' And place registration in'
+ echo ' /etc/synapse/matrix-puppet-hangouts/registration-USER.yaml'
+ echo ' Note that the registration path also goes in config-USER.json'
exit 1
fi
if [[ ${REG} = "--register" ]]; then
echo "Registering a puppet on ${URL}"
-sudo -u synapse HOME=/var/lib/matrix-puppet-hangouts/${USER}/ \
+sudo chown ${RUNAS}:${RUNAS} /etc/synapse/matrix-puppet-hangouts/config-${USER}.json
+sudo chmod u+rw /etc/synapse/matrix-puppet-hangouts/config-${USER}.json
+sudo -u ${RUNAS} HOME=/var/lib/matrix-puppet-hangouts/${USER}/ \
node /usr/lib/node_modules/matrix-puppet-hangouts/index.js -r -u "${URL}"
+sudo chown root:root /etc/synapse/matrix-puppet-hangouts/config-${USER}.json
else
echo Running initial setup