From d700b514941a69291e86d1d644a22859ae27fc71 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 14 Jun 2018 14:40:43 -0600 Subject: [PATCH 1/4] don't assume the use of /etc --- dist/etc/systemd/system/telebit-relay.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/etc/systemd/system/telebit-relay.service b/dist/etc/systemd/system/telebit-relay.service index 44323cc..b207d51 100644 --- a/dist/etc/systemd/system/telebit-relay.service +++ b/dist/etc/systemd/system/telebit-relay.service @@ -44,7 +44,7 @@ ProtectSystem=full # and /var/log/gitea because we want a place where logs can go. # This merely retains r/w access rights, it does not add any new. # Must still be writable on the host! -ReadWriteDirectories=/opt/telebit-relay /etc/telebit +ReadWriteDirectories=/opt/telebit-relay # Note: in v231 and above ReadWritePaths has been renamed to ReadWriteDirectories ; ReadWritePaths=/opt/telebit-relay /etc/telebit From c8d974884be0a63c098788f49cc528fb7f012f74 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 14 Jun 2018 20:45:51 +0000 Subject: [PATCH 2/4] read from /dev/tty direct --- installer/get.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/installer/get.sh b/installer/get.sh index c7e63a8..db16649 100644 --- a/installer/get.sh +++ b/installer/get.sh @@ -68,6 +68,7 @@ my_app="telebit-relay" my_bin="telebit-relay.js" my_name="Telebit Relay" my_repo="telebit-relay.js" +exec 3<>/dev/tty if [ -z "${my_email}" ]; then echo "" @@ -77,7 +78,7 @@ if [ -z "${my_email}" ]; then echo "To accept the Terms of Service for Telebit, Greenlock and Let's Encrypt," echo "please enter your email." echo "" - read -p "email: " my_email + read -u 3 -p "email: " my_email echo "" # UX - just want a smooth transition sleep 0.5 @@ -86,7 +87,7 @@ fi if [ -z "${my_servername}" ]; then echo "What is the domain of this server (for admin interface)?" echo "" - read -p "domain (ex: telebit-relay.example.com): " my_servername + read -u 3 -p "domain (ex: telebit-relay.example.com): " my_servername echo "" # UX - just want a smooth transition sleep 0.5 From 7e83b0c3c200375e6683e46957b578557e9227a1 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 14 Jun 2018 21:13:09 +0000 Subject: [PATCH 3/4] whitespace --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4530d17..de0fae8 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "sni": "^1.0.0", "ws": "^5.1.1" }, - "engineStrict" : true, + "engineStrict": true, "engines": { "node": "10.2.1" } From 4a3a395c142d94026a49e7f4c7306c8c872141f7 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 14 Jun 2018 20:51:50 +0000 Subject: [PATCH 4/4] de-hard-code TELEBIT_RELAY_PATH --- installer/get.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/installer/get.sh b/installer/get.sh index db16649..4e9e17d 100644 --- a/installer/get.sh +++ b/installer/get.sh @@ -121,8 +121,8 @@ mkdir -p $my_tmp echo "sudo mkdir -p '$TELEBIT_RELAY_PATH'" sudo mkdir -p "$TELEBIT_RELAY_PATH" -echo "sudo mkdir -p '/opt/$my_app/etc'" -sudo mkdir -p "/opt/$my_app/etc/" +echo "sudo mkdir -p '$TELEBIT_RELAY_PATH/etc'" +sudo mkdir -p "$TELEBIT_RELAY_PATH/etc/" set +e #https://git.coolaj86.com/coolaj86/telebit-relay.js.git @@ -173,17 +173,17 @@ if [ -z "$(cat /etc/passwd | grep $my_user)" ]; then sudo adduser --home $TELEBIT_RELAY_PATH --gecos '' --disabled-password $my_user >/dev/null 2>&1 fi -if [ ! -f "/opt/$my_app/etc/$my_app.yml" ]; then +if [ ! -f "$TELEBIT_RELAY_PATH/etc/$my_app.yml" ]; then echo "### Creating config file from template. sudo may be required" - #echo "sudo rsync -a examples/$my_app.yml /opt/$my_app/etc/$my_app.yml" - sudo bash -c "echo 'email: $my_email' >> /opt/$my_app/etc/$my_app.yml" - sudo bash -c "echo 'secret: $my_secret' >> /opt/$my_app/etc/$my_app.yml" - sudo bash -c "echo 'servernames: [ $my_servername ]' >> /opt/$my_app/etc/$my_app.yml" - sudo bash -c "cat examples/$my_app.yml.tpl >> /opt/$my_app/etc/$my_app.yml" + #echo "sudo rsync -a examples/$my_app.yml $TELEBIT_RELAY_PATH/etc/$my_app.yml" + sudo bash -c "echo 'email: $my_email' >> $TELEBIT_RELAY_PATH/etc/$my_app.yml" + sudo bash -c "echo 'secret: $my_secret' >> $TELEBIT_RELAY_PATH/etc/$my_app.yml" + sudo bash -c "echo 'servernames: [ $my_servername ]' >> $TELEBIT_RELAY_PATH/etc/$my_app.yml" + sudo bash -c "cat $TELEBIT_RELAY_PATH/examples/$my_app.yml.tpl >> $TELEBIT_RELAY_PATH/etc/$my_app.yml" fi -echo "sudo chown -R $my_user '$TELEBIT_RELAY_PATH' '/opt/$my_app/etc'" -sudo chown -R $my_user "$TELEBIT_RELAY_PATH" "/opt/$my_app/etc" +echo "sudo chown -R $my_user '$TELEBIT_RELAY_PATH'" +sudo chown -R $my_user "$TELEBIT_RELAY_PATH" echo "### Adding $my_app is a system service" echo "sudo rsync -a $TELEBIT_RELAY_PATH/dist/etc/systemd/system/$my_app.service /etc/systemd/system/$my_app.service" @@ -202,7 +202,7 @@ echo "==============================================" echo " Privacy Settings in Config" echo "==============================================" echo "" -echo "The example config file /opt/$my_app/etc/$my_app.yml opts-in to" +echo "The example config file $TELEBIT_RELAY_PATH/etc/$my_app.yml opts-in to" echo "contributing telemetrics and receiving infrequent relevant updates" echo "(probably once per quarter or less) such as important notes on" echo "a new release, an important API change, etc. No spam." @@ -219,13 +219,13 @@ echo "==============================================" echo "" echo "Edit the config and restart, if desired:" echo "" -echo " sudo vim /opt/$my_app/etc/$my_app.yml" +echo " sudo vim $TELEBIT_RELAY_PATH/etc/$my_app.yml" echo " sudo systemctl restart $my_app" echo "" echo "Or disabled the service and start manually:" echo "" echo " sudo systemctl stop $my_app" echo " sudo systemctl disable $my_app" -echo " $my_app --config /opt/$my_app/etc/$my_app.yml" +echo " $my_app --config $TELEBIT_RELAY_PATH/etc/$my_app.yml" echo "" sleep 1