mirror of
https://github.com/Icinga/docker-icingaweb2.git
synced 2025-10-23 13:00:59 +02:00
entrypoint: chown /data recursively
to handle subdirs pre-created as root to mount volumes.
This commit is contained in:
parent
9ebbb83dcb
commit
43b34b05d0
@ -8,6 +8,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/go-ini/ini"
|
||||
"io/fs"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
@ -43,7 +44,14 @@ func entrypoint() error {
|
||||
if os.Getuid() == 0 {
|
||||
logf("info", "Giving %s to the www-data user as we're root", dataVolume)
|
||||
|
||||
if err := os.Chown(dataVolume, wwwdataUid, wwwdataUid); err != nil {
|
||||
err := filepath.WalkDir(dataVolume, func(path string, _ fs.DirEntry, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return os.Lchown(path, wwwdataUid, wwwdataUid)
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user