diff --git a/internal/constants/constants.go b/internal/constants/constants.go index 8114699..daa1dd8 100644 --- a/internal/constants/constants.go +++ b/internal/constants/constants.go @@ -3,9 +3,8 @@ package constants import "errors" func DefaultRWPaths() []string { - // Default RW_PATHS to mount - // If none defined, your system wont even boot probably - return []string{"/var", "/etc", "/srv"} + // Default RW_PATHS to mount if not overriden by the cos-layout.env file + return []string{"/etc", "/root", "/home", "/opt", "/srv", "/usr/local", "/var"} } var ErrAlreadyMounted = errors.New("already mounted") diff --git a/pkg/mount/dag_steps.go b/pkg/mount/dag_steps.go index a53599c..f650d65 100644 --- a/pkg/mount/dag_steps.go +++ b/pkg/mount/dag_steps.go @@ -120,9 +120,11 @@ func (s *State) LoadEnvLayoutDagStep(g *herd.Graph) error { return err } // populate from env here - s.OverlayDirs = strings.Split(env["RW_PATHS"], " ") - // Append default RW_Paths - s.OverlayDirs = append(s.OverlayDirs, cnst.DefaultRWPaths()...) + s.OverlayDirs = internalUtils.CleanupSlice(strings.Split(env["RW_PATHS"], " ")) + // Append default RW_Paths if list is empty, otherwise we won't boot properly + if len(s.OverlayDirs) == 0 { + s.OverlayDirs = cnst.DefaultRWPaths() + } // Remove any duplicates s.OverlayDirs = internalUtils.UniqueSlice(internalUtils.CleanupSlice(s.OverlayDirs))