-
Notifications
You must be signed in to change notification settings - Fork 4
/
bisq-desktop-vnc
executable file
·49 lines (34 loc) · 1.02 KB
/
bisq-desktop-vnc
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
#!/bin/bash
# $1 is the pid file path
# $2 is the signal name
function stopwait() {
test -f "$1" || return 0
pid=$(cat "$1")
kill -s "$2" $pid 2>/dev/null
while kill -0 $pid 2>/dev/null; do
sleep 1
done
rm -f "$1"
}
function cleanup() {
trap - TERM
stopwait "$HOME/bisq.pid" INT
stopwait "$HOME/.vnc/${HOSTNAME}${DISPLAY}.pid" TERM
rm -f /tmp/.X${DISPLAY#*:}-lock /tmp/.X11-unix/X${DISPLAY#*:}
}
export DISPLAY=:0
mkdir -p "$HOME/.vnc"
touch "$HOME/.vnc/passwd"
chmod 600 "$HOME/.vnc/passwd"
classpath="/usr/share/bisq/lib/*"
for lib in base controls fxml graphics swing; do
classpath=$classpath:/usr/share/openjfx/lib/javafx.${lib}.jar;
done
tor_opts="--torControlPort=9051 --torControlCookieFile=/etc/tor/control_auth_cookie --torControlUseSafeCookieAuth"
eval set -- $JAVA_OPTS -classpath "\"$classpath\"" bisq.desktop.app.BisqAppMain --appDataDir="$HOME/data" "$tor_opts" "$BISQ_DESKTOP_OPTS"
trap cleanup EXIT
vncserver $DISPLAY
(set -x; exec java "$@") &
pid=$!
echo $pid > "$HOME/bisq.pid"
wait $pid