Fix ownership check in docker entrypoint script

This commit is contained in:
Slendy 2023-02-24 00:45:05 -06:00
parent 78dd5b6489
commit c48da8ccd7
No known key found for this signature in database
GPG key ID: 7288D68361B91428

View file

@ -1,11 +1,11 @@
#!/bin/sh
log() {
local type="$1"; shift
type="$1"; shift
printf '%s [%s] [Entrypoint]: %s\n' "$(date -Iseconds)" "$type" "$*"
}
log Note "Entrypoint script for Lighthouse $SERVER started".
log Note "Entrypoint script for Lighthouse $SERVER started"
if [ ! -d "/lighthouse/data" ]; then
log Note "Creating data directory"
@ -13,7 +13,7 @@ if [ ! -d "/lighthouse/data" ]; then
fi
owner=$(stat -c "%U %G" /lighthouse/data)
if [ owner != "lighthouse lighthouse" ]; then
if [ "$owner" != "lighthouse lighthouse" ]; then
log Note "Changing ownership of data directory"
chown -R lighthouse:lighthouse /lighthouse/data
fi
@ -27,7 +27,7 @@ fi
# Start server
log Note "Startup tasks finished, starting $SERVER..."
cd /lighthouse/data
cd /lighthouse/data || exit
exec su-exec lighthouse:lighthouse dotnet /lighthouse/app/LBPUnion.ProjectLighthouse.Servers."$SERVER".dll
exit $? # Expose error code from dotnet command