Browse Source

Undaemonize until network can be secure. Just for testing now

Joachim M. Giæver 3 years ago
parent
commit
b07f9ec8ff
3 changed files with 14 additions and 9 deletions
  1. 2 0
      snap/snapcraft.yaml
  2. 11 8
      src/bin/env-wrapper
  3. 1 1
      src/hooks/install

+ 2 - 0
snap/snapcraft.yaml

@@ -17,6 +17,8 @@ layout:
 
 apps:
   ozwdaemon:
+    # daemon: simple
+    # restart-condition: on-failure
     command: usr/local/bin/ozwdaemon
     command-chain:
       - bin/env-wrapper

+ 11 - 8
src/bin/env-wrapper

@@ -88,13 +88,16 @@ OZW_ARGS+=(--user-dir "${OZW_USER_DIR}")
 
 set -- "$@" "${OZW_ARGS[@]}"
 
-ARGC=$#
-ARGV=("$@")
-
-echo "Exec: $@"
-echo "Arguments: "
-for ((i = 0; i < ${ARGC}; i++)); do
-    echo "${ARGV[$i]}"
-done
+lprint "Env. variables"
+lprint $(printenv | grep "OZW_")
+lprint $(printenv | grep "MQTT_")
+# ARGC=$#
+# ARGV=("$@")
+#
+lprint "Exec: $@"
+# echo "Arguments: "
+# for ((i = 0; i < ${ARGC}; i++)); do
+#     echo "${ARGV[$i]}"
+# done
 
 exec "$@"

+ 1 - 1
src/hooks/install

@@ -13,7 +13,7 @@ snapctl set mqtt.connect-timeout=30
 snapctl set mqtt.tls=false
 
 snapctl set ozw.instance=1
-snapctl set ozw.network-key="$(cat /dev/urandom | LC_ALL=C tr -dc '0-9A-F' | fold -w 32 | head -n 1 | sed -e 's/\(..\)/0x\1, /g' -e 's/, $//')"
+snapctl set ozw.network-key="$(cat /dev/urandom | LC_ALL=C tr -dc '0-9A-F' | fold -w 32 | head -n 1 | sed -e 's/\(..\)/0x\1,/g' -e 's/,$//')"
 snapctl set ozw.config-dir="${SNAP_DATA}/config"
 snapctl set ozw.user-dir="${SNAP_DATA}/user"
 snapctl set ozw.auth-key=false