Switched back to using a shell script for the wrapper, simplified service config to one service

This commit is contained in:
Tim Edwards 2019-05-09 02:46:35 +02:00
parent cdf6ebc219
commit 99d4b9218e
4 changed files with 15 additions and 10 deletions

14
snap/hooks/configure vendored
View File

@ -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

View File

@ -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]

View File

@ -1,3 +0,0 @@
#!/usr/bin/env python3

6
utils/svc_wrapper.sh Executable file
View File

@ -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