From 99d4b9218e4024e5da9f9fee9e92633d030bb5d0 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Thu, 9 May 2019 02:46:35 +0200 Subject: [PATCH] Switched back to using a shell script for the wrapper, simplified service config to one service --- snap/hooks/configure | 14 ++++++++------ snap/snapcraft.yaml | 2 +- utils/svc_wrapper.py | 3 --- utils/svc_wrapper.sh | 6 ++++++ 4 files changed, 15 insertions(+), 10 deletions(-) delete mode 100755 utils/svc_wrapper.py create mode 100755 utils/svc_wrapper.sh 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