docker-images/images/shiori/run.sh

29 lines
739 B
Bash
Executable File

#!/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; };
export HOME="${data_dir}";
export SHIORI_DIR="${data_dir}";
if [[ "${1}" == "serve" ]]; then
exec /srv/shiori "$@" --port "${port}";
else
exec /srv/shiori "$@";
fi