forked from github-mirrorer/taskchampion-sync-server
allow running with custom PUID and PGID
This commit is contained in:
@ -2,11 +2,14 @@
|
||||
set -e
|
||||
echo "starting entrypoint script..."
|
||||
if [ "$1" = "/bin/taskchampion-sync-server-postgres" ]; then
|
||||
: ${PUID:-1092}
|
||||
: ${PGID:-1092}
|
||||
|
||||
: ${DATA_DIR:=/var/lib/taskchampion-sync-server/data}
|
||||
export DATA_DIR
|
||||
echo "setting up data directory ${DATA_DIR}"
|
||||
mkdir -p "${DATA_DIR}"
|
||||
chown -R taskchampion:users "${DATA_DIR}"
|
||||
chown -R "${PUID}:${PGID}" "${DATA_DIR}"
|
||||
chmod -R 700 "${DATA_DIR}"
|
||||
|
||||
: ${LISTEN:=0.0.0.0:8080}
|
||||
@ -20,10 +23,8 @@ if [ "$1" = "/bin/taskchampion-sync-server-postgres" ]; then
|
||||
unset CLIENT_ID
|
||||
fi
|
||||
|
||||
if [ "$(id -u)" = "0" ]; then
|
||||
echo "Running server as user 'taskchampion'"
|
||||
exec su-exec taskchampion "$@"
|
||||
fi
|
||||
echo "Running server as user ${PUID} (group ${PGID})"
|
||||
exec su-exec "${PUID}":"${PGID}" "$@"
|
||||
else
|
||||
eval "${@}"
|
||||
fi
|
||||
|
||||
@ -2,11 +2,14 @@
|
||||
set -e
|
||||
echo "starting entrypoint script..."
|
||||
if [ "$1" = "/bin/taskchampion-sync-server" ]; then
|
||||
: ${PUID:-1092}
|
||||
: ${PGID:-1092}
|
||||
|
||||
: ${DATA_DIR:=/var/lib/taskchampion-sync-server/data}
|
||||
export DATA_DIR
|
||||
echo "setting up data directory ${DATA_DIR}"
|
||||
mkdir -p "${DATA_DIR}"
|
||||
chown -R taskchampion:users "${DATA_DIR}"
|
||||
chown -R ${PUID}:${PGID} "${DATA_DIR}"
|
||||
chmod -R 700 "${DATA_DIR}"
|
||||
|
||||
: ${LISTEN:=0.0.0.0:8080}
|
||||
@ -20,10 +23,8 @@ if [ "$1" = "/bin/taskchampion-sync-server" ]; then
|
||||
unset CLIENT_ID
|
||||
fi
|
||||
|
||||
if [ "$(id -u)" = "0" ]; then
|
||||
echo "Running server as user 'taskchampion'"
|
||||
exec su-exec taskchampion "$@"
|
||||
fi
|
||||
echo "Running server as user ${PUID} (group ${PGID})"
|
||||
exec su-exec "${PUID}":"${PGID}" "$@"
|
||||
else
|
||||
eval "${@}"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user