1
0
Fork 0

entrypoint: Start secretsocket server if needed

If the `SECRET_SOCKET_PATH` environment variable is not set, or refers
to a non-existent path, then we assume we need to manage the
`secretsocket` server ourselves.
master
Dustin 2024-07-10 16:48:41 -05:00
parent 28fe49c2b2
commit bef7206642
2 changed files with 18 additions and 2 deletions

View File

@ -77,4 +77,4 @@ WORKDIR /var/lib/xactfetch
USER 2468:2468
ENTRYPOINT ["tini", "/entrypoint.sh", "--"]
ENTRYPOINT ["/entrypoint.sh"]

View File

@ -1,3 +1,19 @@
#!/bin/sh
exec xvfb-run -e /dev/stderr -s '-screen 0 1920x1080x24 -nolisten unix' xactfetch "$@"
if [ $$ -eq 1 ]; then
exec tini "$0" -- "$@"
fi
if [ -z "${SECRET_SOCKET_PATH}" ] || [ ! -e "${SECRET_SOCKET_PATH}" ]; then
export SECRET_SOCKET_PATH="${SECRET_SOCKET_PATH:-/tmp/.secretsocket}"
secretsocket &
sspid=$!
fi
xvfb-run -e /dev/stderr -s '-screen 0 1920x1080x24 -nolisten unix' xactfetch "$@"
rc=$?
if [ -n "${sspid}" ]; then
kill $sspid
fi
exit $rc