docker-images/images/shiori/run.sh

28 lines
706 B
Bash
Raw Normal View History

2021-04-03 19:09:57 +00:00
#!/usr/bin/env bash
data_dir="/srv/data";
# The port number to listen on
port="${NOMAD_PORT_SHIORI:-8080}";
echo "[run.sh] I am running as UID $UID" >&2;
echo "[run.sh] Arguments to pass to shiori: '${*}'";
if [[ "${1}" == "serve" ]]; then
echo "[run.sh] Going to tell Shiori to listen on port ${port}." >&2;
fi
if [[ ! -d "${data_dir}" ]]; then
echo "[run.sh] Error: The data directory at '${data_dir}' does not appear to exist." >&2;
exit 2;
fi
cd "${data_dir}" || { echo "Error: Failed to cd into '${data_dir}' (have you checked the permissions?)"; exit 2; };
2021-04-04 13:28:27 +00:00
export HOME="${data_dir}";
2021-04-03 19:09:57 +00:00
if [[ "${1}" == "serve" ]]; then
2021-04-04 02:03:58 +00:00
exec /srv/shiori "$@" --port "${port}";
2021-04-03 19:09:57 +00:00
else
exec /srv/shiori "$@";
2021-04-03 19:09:57 +00:00
fi