mirror of
https://github.com/Icinga/docker-icingaweb2.git
synced 2025-10-24 21:40:59 +02:00
entrypoint: don't consider chown failure critical
as volumes may be mounted read-only.
This commit is contained in:
parent
43b34b05d0
commit
37fc5ea78f
@ -44,17 +44,19 @@ func entrypoint() error {
|
|||||||
if os.Getuid() == 0 {
|
if os.Getuid() == 0 {
|
||||||
logf("info", "Giving %s to the www-data user as we're root", dataVolume)
|
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 {
|
_ = filepath.WalkDir(dataVolume, func(path string, _ fs.DirEntry, err error) error {
|
||||||
if err != nil {
|
if err == nil {
|
||||||
return err
|
err = os.Lchown(path, wwwdataUid, wwwdataUid)
|
||||||
}
|
}
|
||||||
|
|
||||||
return os.Lchown(path, wwwdataUid, wwwdataUid)
|
|
||||||
})
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
logf("warn", "Can't chown %s: %s", path, err.Error())
|
||||||
|
return filepath.SkipDir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
logf("info", "Dropping privileges as we're root")
|
logf("info", "Dropping privileges as we're root")
|
||||||
|
|
||||||
if err := syscall.Setgid(wwwdataUid); err != nil {
|
if err := syscall.Setgid(wwwdataUid); err != nil {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user