diff --git a/snap/hooks/configure b/snap/hooks/configure index 1f6bbe7e..0b083945 100644 --- a/snap/hooks/configure +++ b/snap/hooks/configure @@ -1,10 +1,12 @@ #!/bin/sh -e -# Obtain sleep-time value -sleep_time="$(snapctl get sleep-time)" +listen_port="$(snapctl get novncsvc.listen_port)" +vnc_host_port="$(snapctl get novncsvc.vnc_host_port)" -# Validate it -if ! expr "$sleep_time" : '^[0-9]*$' > /dev/null; then - echo "\"$sleep_time\" is not a valid sleep time" >&2 - exit 1 + # Validate listen_port +if ! expr "$listen_port" : '^[0-9]\+$' > /dev/null; then + echo "\"$listen_port\" is not a valid port number" >&2 + return 1 fi + +snapctl restart novncsvc diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 0dee089d..7e6911cc 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -26,6 +26,6 @@ apps: command: utils/launch.sh plugs: [network, network-bind] novncsvc: - command: utils/svc_wrapper.py + command: utils/svc_wrapper.sh daemon: simple plugs: [network, network-bind] diff --git a/utils/svc_wrapper.py b/utils/svc_wrapper.py deleted file mode 100755 index 066c83ef..00000000 --- a/utils/svc_wrapper.py +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env python3 - - diff --git a/utils/svc_wrapper.sh b/utils/svc_wrapper.sh new file mode 100755 index 00000000..98b5861c --- /dev/null +++ b/utils/svc_wrapper.sh @@ -0,0 +1,6 @@ +#!/usr/bin/bash + +listen_port="$(snapctl get novncsvc.listen_port)" +vnc_host_port="$(snapctl get novncsvc.vnc_host_port)" + +utils/launch.sh --listen $listen_port --vnc $vnc_host_port