Attempt to get multiple ports working, just the --vnc option isn't being parsed properly yet
This commit is contained in:
parent
24be1cdd8a
commit
9e9cd87659
|
|
@ -15,6 +15,8 @@ parts:
|
||||||
plugin: dump
|
plugin: dump
|
||||||
stage-packages:
|
stage-packages:
|
||||||
- websockify
|
- websockify
|
||||||
|
- bash
|
||||||
|
- jq
|
||||||
|
|
||||||
hooks:
|
hooks:
|
||||||
install:
|
install:
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,19 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
listen_port="$(snapctl get novncsvc.listen-port)"
|
echo "snactp get services is: $(snapctl get services)"
|
||||||
vnc_host_port="$(snapctl get novncsvc.vnc-host-port)"
|
|
||||||
|
|
||||||
expr "$listen_port" : '^[0-9]\+$' > /dev/null
|
#for service in $(snapctl get services | cut -f1 -d' ' |cut -f2 -d".") # the cut calls get only the first column and then change 'service.n6801' to 'n6801'
|
||||||
listen_port_valid=$?
|
snapctl get services | jq -c '.[]' | while read service; do
|
||||||
if [ ! $listen_port_valid ] || [ -z "$vnc_host_port" ]; then
|
listen_port="$(echo $service | jq '.listen')"
|
||||||
# invalid values mean the service is disabled, do nothing
|
vnc_host_port="$(echo $service | jq '.vnc')"
|
||||||
echo "novncsvc disabled"
|
|
||||||
else
|
# check for valid values
|
||||||
$SNAP/utils/launch.sh --listen $listen_port --vnc $vnc_host_port
|
expr "$listen_port" : '^[0-9]\+$' > /dev/null
|
||||||
fi
|
listen_port_valid=$?
|
||||||
|
if [ ! $listen_port_valid ] || [ -z "$vnc_host_port" ]; then
|
||||||
|
# invalid values mean the service is disabled, do nothing
|
||||||
|
echo "novnc: not starting service ${service} with listen_port ${listen_port} and vnc_host_port ${vnc_host_port}"
|
||||||
|
else
|
||||||
|
$SNAP/utils/launch.sh --listen $listen_port --vnc $vnc_host_port
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue