mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-07-13 16:04:13 +00:00
Fix journald mount on non systemd systems (#800)
This commit is contained in:
parent
694a280959
commit
67e7590170
@ -38,13 +38,20 @@ type Chroot struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewChroot(path string, config *agentConfig.Config) *Chroot {
|
func NewChroot(path string, config *agentConfig.Config) *Chroot {
|
||||||
return &Chroot{
|
chroot := &Chroot{
|
||||||
path: path,
|
path: path,
|
||||||
defaultMounts: []string{"/dev", "/dev/pts", "/proc", "/sys", "/run/systemd/journal/"}, // Add journal so we keep logs
|
defaultMounts: []string{"/dev", "/dev/pts", "/proc", "/sys"},
|
||||||
extraMounts: map[string]string{},
|
extraMounts: map[string]string{},
|
||||||
activeMounts: []string{},
|
activeMounts: []string{},
|
||||||
config: config,
|
config: config,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we have systemd running, we need to mount the journal directory to keep logger open
|
||||||
|
if fi, err := os.Lstat("/run/systemd/system"); err == nil && fi.IsDir() {
|
||||||
|
chroot.defaultMounts = append(chroot.defaultMounts, "/run/systemd/journal/")
|
||||||
|
}
|
||||||
|
|
||||||
|
return chroot
|
||||||
}
|
}
|
||||||
|
|
||||||
// ChrootedCallback runs the given callback in a chroot environment
|
// ChrootedCallback runs the given callback in a chroot environment
|
||||||
|
Loading…
Reference in New Issue
Block a user