2020-10-20 12:47:04 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
if [[ ${UMASK} ]]; then
|
|
|
|
umask "${UMASK}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ ${UID} ]] && [[ ${GID} ]] && [[ ${UID} != "0" ]] && [[ $(id -u) = "0" ]]; then
|
|
|
|
groupadd -f -g "${GID}" "${GID}"
|
|
|
|
usermod -o -u "${UID}" -g "${GID}" photoprism
|
2021-01-17 11:56:28 +01:00
|
|
|
chown -Rf photoprism /photoprism /var/lib/photoprism /tmp/photoprism
|
2020-10-20 12:47:04 +02:00
|
|
|
gosu "${UID}:${GID}" "$@" &
|
|
|
|
elif [[ ${UID} ]] && [[ ${UID} != "0" ]] && [[ $(id -u) = "0" ]]; then
|
|
|
|
usermod -o -u "${UID}" photoprism
|
2021-01-17 11:56:28 +01:00
|
|
|
chown -Rf photoprism /photoprism /var/lib/photoprism /tmp/photoprism
|
2020-10-20 12:47:04 +02:00
|
|
|
gosu "${UID}" "$@" &
|
|
|
|
else
|
|
|
|
"$@" &
|
|
|
|
fi
|
|
|
|
|
|
|
|
PID=$!
|
|
|
|
|
|
|
|
trap "kill $PID" INT TERM
|
|
|
|
wait
|