diff --git a/src/freedombone-app-scuttlebot b/src/freedombone-app-scuttlebot index 32a52fd6a0b8daa0fe9b4e20f7dcf7292a28c1c3..1b64b6a452433426699645c0e5c74b1c0f6f1ccb 100755 --- a/src/freedombone-app-scuttlebot +++ b/src/freedombone-app-scuttlebot @@ -54,11 +54,19 @@ function logging_off_scuttlebot { echo -n '' } -function scuttlebot_create_invite { +function scuttlebot_create_single_invite { invite_string=$(su -c "/etc/scuttlebot/node_modules/.bin/sbot invite.create 1" - scuttlebot | sed 's/"//g') + if [ ! "$invite_string" ]; then + echo $'Unable to create scuttlebot invite' + exit 36583568 + fi + write_config_param SCUTTLEBOT_INVITE "$invite_string" +} +function scuttlebot_create_invite { + scuttlebot_create_single_invite clear - echo -e "\\n\\nYour Scuttlebot invite code is:\\n\\n${invite_string}\\n\\n" + echo -e "\\n\\nYour Scuttlebot invite code is:\\n\\n${SCUTTLEBOT_INVITE}\\n\\n" # shellcheck disable=SC2034 read -n1 -r -p $"Press any key to continue..." key } @@ -360,6 +368,8 @@ EOF firewall_add scuttlebot ${SCUTTLEBOT_PORT} + scuttlebot_create_single_invite + if ! grep -q "scuttlebot version:" "${COMPLETION_FILE}"; then echo "scuttlebot version:${SCUTTLEBOT_VERSION}" >> "${COMPLETION_FILE}" else