fst/config: autoetc read custom path
All checks were successful
Tests / Go tests (push) Successful in 43s
Nix / NixOS tests (push) Successful in 3m40s

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
Ophestra 2024-12-27 18:57:44 +09:00
parent 1f173a469c
commit fc26659ea1
Signed by: cat
SSH Key Fingerprint: SHA256:gQ67O0enBZ7UdZypgtspB2FDM1g3GVw8nX0XSdcFw8Q

View File

@ -153,14 +153,14 @@ func (s *SandboxConfig) Bwrap(os linux.System) (*bwrap.Config, error) {
}
if s.AutoEtc {
if s.Etc == "" {
conf.Bind("/etc", Tmp+"/etc")
} else {
conf.Bind(s.Etc, Tmp+"/etc")
etc := s.Etc
if etc == "" {
etc = "/etc"
}
conf.Bind(etc, Tmp+"/etc")
// link host /etc contents to prevent passwd/group from being overwritten
if d, err := os.ReadDir("/etc"); err != nil {
if d, err := os.ReadDir(etc); err != nil {
return nil, err
} else {
for _, ent := range d {