blob: 0228469d04d8640f5b1d010ebe96e2b55ce78918 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
--- a/utils/launch.sh
+++ b/utils/launch.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/ash
# Copyright 2016 Joel Martin
# Copyright 2016 Solly Ross
@@ -25,8 +25,8 @@
exit 2
}
-NAME="$(basename $0)"
-REAL_NAME="$(readlink -f $0)"
+NAME="$(basename "$0")"
+REAL_NAME="$(readlink -f "$0")"
HERE="$(cd "$(dirname "$REAL_NAME")" && pwd)"
PORT="6080"
VNC_DEST="localhost:5900"
@@ -106,42 +106,11 @@
echo "Warning: could not find self.pem"
fi
-# try to find websockify (prefer local, try global, then download local)
-if [[ -e ${HERE}/websockify ]]; then
- WEBSOCKIFY=${HERE}/websockify/run
-
- if [[ ! -x $WEBSOCKIFY ]]; then
- echo "The path ${HERE}/websockify exists, but $WEBSOCKIFY either does not exist or is not executable."
- echo "If you intended to use an installed websockify package, please remove ${HERE}/websockify."
- exit 1
- fi
-
- echo "Using local websockify at $WEBSOCKIFY"
-else
- WEBSOCKIFY=$(which websockify 2>/dev/null)
-
- if [[ $? -ne 0 ]]; then
- echo "No installed websockify, attempting to clone websockify..."
- WEBSOCKIFY=${HERE}/websockify/run
- git clone https://github.com/kanaka/websockify ${HERE}/websockify
-
- if [[ ! -e $WEBSOCKIFY ]]; then
- echo "Unable to locate ${HERE}/websockify/run after downloading"
- exit 1
- fi
-
- echo "Using local websockify at $WEBSOCKIFY"
- else
- echo "Using installed websockify at $WEBSOCKIFY"
- fi
-fi
-
echo "Starting webserver and WebSockets proxy on port ${PORT}"
-#${HERE}/websockify --web ${WEB} ${CERT:+--cert ${CERT}} ${PORT} ${VNC_DEST} &
-${WEBSOCKIFY} --web ${WEB} ${CERT:+--cert ${CERT}} ${PORT} ${VNC_DEST} &
+websockify --web ${WEB} ${CERT:+--cert ${CERT}} ${PORT} ${VNC_DEST} &
proxy_pid="$!"
sleep 1
-if ! ps -p ${proxy_pid} >/dev/null; then
+if [ -z "$proxy_pid" ] || ! ps -o pid= | grep -qw ${proxy_pid}; then
proxy_pid=
echo "Failed to start WebSockets proxy"
exit 1
|