-
Notifications
You must be signed in to change notification settings - Fork 5
/
run.sh
executable file
·55 lines (47 loc) · 1.33 KB
/
run.sh
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
#!/usr/bin/env bash
set -euo pipefail
export CONTAINER=swayvnc-firefox
readonly CONTAINER
export LISTEN_ADDRESS="[::1]"
readonly LISTEN_ADDRESS
export VERBOSE=1
readonly VERBOSE
export DEFAULT_URL="https://uhr.ptb.de/"
readonly DEFAULT_URL
SCRIPT_NAME=$(basename $0)
readonly SCRIPT_NAME
log() {
if (( 1=="${VERBOSE}" )); then
echo "$@" >&2
fi
logger -p user.notice -t ${SCRIPT_NAME} "$@"
}
error() {
echo "$@" >&2
logger -p user.error -t ${SCRIPT_NAME} "$@"
}
if [[ -z $(which podman) ]]; then
if [[ -z $(which docker) ]]; then
error "Could not find container executor."
error "Install either podman or docker"
exit 1
else
executor=docker
log "Using ${executor} to run ${CONTAINER}"
fi
else
executor=podman
log "Using ${executor} to run ${CONTAINER}"
fi
${executor} run -e XDG_RUNTIME_DIR=/tmp \
-e WLR_BACKENDS=headless \
-e WLR_LIBINPUT_NO_DEVICES=1 \
-e SWAYSOCK=/tmp/sway-ipc.sock \
-e MOZ_ENABLE_WAYLAND=1 \
-e URL="${DEFAULT_URL}" \
-e BROWSER_FULLSCREEN=1 \
-p${LISTEN_ADDRESS}:5910:5910 \
-p${LISTEN_ADDRESS}:7000:7000 \
-p${LISTEN_ADDRESS}:7023:7023 \
--privileged \
${CONTAINER}