2018-01-13 00:13:32 -05:00
|
|
|
#!/bin/sh
|
|
|
|
export PORT
|
|
|
|
export REDIRPORT
|
|
|
|
|
2018-01-13 13:18:00 -05:00
|
|
|
if [ "$1" != "" ] ; then
|
2018-01-13 00:13:32 -05:00
|
|
|
PORT=$1
|
|
|
|
fi
|
|
|
|
|
2018-01-13 13:18:00 -05:00
|
|
|
if [ "$2" != "" ]; then
|
2018-01-13 00:13:32 -05:00
|
|
|
REDIRPORT=$2
|
|
|
|
fi
|
|
|
|
|
2018-01-13 12:09:57 -05:00
|
|
|
su - meshcentral
|
2018-01-13 12:20:14 -05:00
|
|
|
cd /home/meshcentral/
|
2018-01-13 12:42:46 -05:00
|
|
|
npm install meshcentral
|
2018-01-13 10:44:22 -05:00
|
|
|
|
|
|
|
if ! [ -f node_modules/.meshcentral-data/agentserver-cert-private.key ] ;then
|
2018-01-13 13:41:39 -05:00
|
|
|
node node_modules/meshcentral/meshcentral.js --cert $HOSTNAME --port $PORT --redirport $REDIRPORT
|
2018-01-13 13:18:00 -05:00
|
|
|
elif [ -f ssl.key ]; then
|
2018-01-13 00:13:32 -05:00
|
|
|
ln -sf ssl.key node_modules/.meshcentral-data/agentserver-cert-private.key
|
|
|
|
ln -sf ssl.cert node_modules/.meshcentral-data/agentserver-cert-public.crt
|
|
|
|
ln -sf ssl.key node_modules/.meshcentral-data/root-cert-private.key
|
|
|
|
ln -sf ssl.cert node_modules/.meshcentral-data/root-cert-public.crt
|
|
|
|
ln -sf ssl.key node_modules/.meshcentral-data/webserver-cert-private.key
|
|
|
|
ln -sf ssl.cert node_modules/.meshcentral-data/webserver-cert-public.crt
|
|
|
|
ln -sf ssl.key node_modules/.meshcentral-data/mpsserver-cert-private.key
|
|
|
|
ln -sf ssl.cert node_modules/.meshcentral-data/mpsserver-cert-public.crt
|
2018-01-13 13:41:39 -05:00
|
|
|
node node_modules/meshcentral/meshcentral.js --port $PORT --redirport $REDIRPORT
|
2018-01-13 13:18:00 -05:00
|
|
|
else
|
2018-01-13 13:41:39 -05:00
|
|
|
node node_modules/meshcentral/meshcentral.js --port $PORT --redirport $REDIRPORT
|
2018-01-13 00:13:32 -05:00
|
|
|
fi
|
|
|
|
|