entrypoint: don't consider chown failure critical

as volumes may be mounted read-only.
This commit is contained in:
Alexander A. Klimov 2023-02-17 16:21:08 +01:00
parent 43b34b05d0
commit 37fc5ea78f

View File

@ -44,16 +44,18 @@ func entrypoint() error {
if os.Getuid() == 0 {
logf("info", "Giving %s to the www-data user as we're root", dataVolume)
err := filepath.WalkDir(dataVolume, func(path string, _ fs.DirEntry, err error) error {
if err != nil {
return err
_ = filepath.WalkDir(dataVolume, func(path string, _ fs.DirEntry, err error) error {
if err == nil {
err = os.Lchown(path, wwwdataUid, wwwdataUid)
}
return os.Lchown(path, wwwdataUid, wwwdataUid)
if err != nil {
logf("warn", "Can't chown %s: %s", path, err.Error())
return filepath.SkipDir
}
return nil
})
if err != nil {
return err
}
logf("info", "Dropping privileges as we're root")