-
Notifications
You must be signed in to change notification settings - Fork 2
/
run.sh
executable file
·49 lines (40 loc) · 1.12 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
#!/usr/bin/env bash
set -euo pipefail
export CONTAINER=swayvnc
export LISTEN_ADDRESS="[::1]"
export VERBOSE=1
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 WLR_RENDERER=pixman \
-e SWAYSOCK=/tmp/sway-ipc.sock \
-p${LISTEN_ADDRESS}:5910:5910 \
-p${LISTEN_ADDRESS}:7000:7000 \
-p${LISTEN_ADDRESS}:7023:7023 \
--privileged \
${CONTAINER}