diff options
author | Bo Lorentsen <druppy@users.noreply.github.com> | 2022-03-11 05:29:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-11 12:29:51 +0800 |
commit | 61529fd78024f107a0064b091d81cabed8d50cca (patch) | |
tree | d1422093115ef3acdb9980e610d813a65f414624 /docker | |
parent | aac91b3611005992ce230b3d784844339f34095d (diff) |
docker: check "/data" mount ownership before forcing it (#6553)
Co-authored-by: bl <bl@moch.dk>
Diffstat (limited to 'docker')
-rwxr-xr-x | docker/start.sh | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/docker/start.sh b/docker/start.sh index b37acfe2..0ac47da9 100755 --- a/docker/start.sh +++ b/docker/start.sh @@ -31,8 +31,12 @@ cleanup() { } create_volume_subfolder() { - # Modify the owner of /data dir, make $USER(git) user have permission to create sub-dir in /data. - chown -R "$USER:$USER" /data + # only change ownership if needed, if using an nfs mount this could be expensive + if [ "$USER:$USER" != "$(stat /data -c '%U:%G')" ] + then + # Modify the owner of /data dir, make $USER(git) user have permission to create sub-dir in /data. + chown -R "$USER:$USER" /data + fi # Create VOLUME subfolder for f in /data/gogs/data /data/gogs/conf /data/gogs/log /data/git /data/ssh; do |