Further work on getting configurable service setup
This commit is contained in:
parent
99d4b9218e
commit
473810e676
|
|
@ -1,12 +1,6 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
|
|
||||||
listen_port="$(snapctl get novncsvc.listen_port)"
|
listen_port="$(snapctl get novncsvc.listen-port)"
|
||||||
vnc_host_port="$(snapctl get novncsvc.vnc_host_port)"
|
vnc_host_port="$(snapctl get novncsvc.vnc-host-port)"
|
||||||
|
|
||||||
# Validate listen_port
|
snapctl restart novnc.novncsvc
|
||||||
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
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
# Initialise settings to blank default values so that novncsvc won't start unless the user sets these values to something meaningful
|
||||||
|
snapctl set novncsvc.listen-port=0
|
||||||
|
snapctl set novncsvc.vnc-host-port=''
|
||||||
|
|
@ -11,13 +11,14 @@ confinement: strict
|
||||||
|
|
||||||
parts:
|
parts:
|
||||||
novnc:
|
novnc:
|
||||||
source: https://github.com/tkedwards/noVNC.git # https://github.com/novnc/noVNC.git #https://github.com/novnc/noVNC/archive/v$SNAPCRAFT_PROJECT_VERSION.tar.gz
|
source: . #https://github.com/tkedwards/noVNC.git # https://github.com/novnc/noVNC.git #https://github.com/novnc/noVNC/archive/v$SNAPCRAFT_PROJECT_VERSION.tar.gz
|
||||||
plugin: dump
|
plugin: dump
|
||||||
source-branch: snap_package
|
|
||||||
stage-packages:
|
stage-packages:
|
||||||
- websockify
|
- websockify
|
||||||
|
|
||||||
hooks:
|
hooks:
|
||||||
|
install:
|
||||||
|
plugs: [network, network-bind]
|
||||||
configure:
|
configure:
|
||||||
plugs: [network, network-bind]
|
plugs: [network, network-bind]
|
||||||
|
|
||||||
|
|
@ -27,5 +28,5 @@ apps:
|
||||||
plugs: [network, network-bind]
|
plugs: [network, network-bind]
|
||||||
novncsvc:
|
novncsvc:
|
||||||
command: utils/svc_wrapper.sh
|
command: utils/svc_wrapper.sh
|
||||||
daemon: simple
|
daemon: forking
|
||||||
plugs: [network, network-bind]
|
plugs: [network, network-bind]
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,13 @@
|
||||||
#!/usr/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
listen_port="$(snapctl get novncsvc.listen_port)"
|
listen_port="$(snapctl get novncsvc.listen-port)"
|
||||||
vnc_host_port="$(snapctl get novncsvc.vnc_host_port)"
|
vnc_host_port="$(snapctl get novncsvc.vnc-host-port)"
|
||||||
|
|
||||||
utils/launch.sh --listen $listen_port --vnc $vnc_host_port
|
expr "$listen_port" : '^[0-9]\+$' > /dev/null
|
||||||
|
listen_port_valid=$?
|
||||||
|
if [ ! $listen_port_valid ] || [ -z "$vnc_host_port" ]; then
|
||||||
|
# invalid values mean the service is disabled, do nothing
|
||||||
|
echo "novncsvc disabled"
|
||||||
|
else
|
||||||
|
./utils/launch.sh --listen $listen_port --vnc $vnc_host_port
|
||||||
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue