This commit is contained in:
mudler
2023-02-06 15:28:22 +01:00
parent fcdc2f28b6
commit 4011c3f41c
6 changed files with 5 additions and 49 deletions

View File

@@ -9,7 +9,6 @@ import (
"github.com/containerd/containerd/mount" "github.com/containerd/containerd/mount"
"github.com/deniswernert/go-fstab" "github.com/deniswernert/go-fstab"
"github.com/kairos-io/immucore/pkg/profile"
"github.com/kairos-io/kairos/pkg/utils" "github.com/kairos-io/kairos/pkg/utils"
"github.com/moby/sys/mountinfo" "github.com/moby/sys/mountinfo"
) )
@@ -35,7 +34,7 @@ func appendSlash(path string) string {
} }
// https://github.com/kairos-io/packages/blob/94aa3bef3d1330cb6c6905ae164f5004b6a58b8c/packages/system/dracut/immutable-rootfs/30cos-immutable-rootfs/cos-mount-layout.sh#L129 // https://github.com/kairos-io/packages/blob/94aa3bef3d1330cb6c6905ae164f5004b6a58b8c/packages/system/dracut/immutable-rootfs/30cos-immutable-rootfs/cos-mount-layout.sh#L129
func baseOverlay(overlay profile.Overlay) (mountOperation, error) { func baseOverlay(overlay Overlay) (mountOperation, error) {
if err := os.MkdirAll(overlay.Base, 0700); err != nil { if err := os.MkdirAll(overlay.Base, 0700); err != nil {
return mountOperation{}, err return mountOperation{}, err
} }

View File

@@ -3,17 +3,17 @@ package mount
import ( import (
"context" "context"
"fmt" "fmt"
"github.com/rs/zerolog"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
"time" "time"
"github.com/rs/zerolog"
"github.com/containerd/containerd/mount" "github.com/containerd/containerd/mount"
"github.com/deniswernert/go-fstab" "github.com/deniswernert/go-fstab"
"github.com/hashicorp/go-multierror" "github.com/hashicorp/go-multierror"
"github.com/joho/godotenv" "github.com/joho/godotenv"
"github.com/kairos-io/immucore/pkg/profile"
"github.com/kairos-io/kairos/pkg/utils" "github.com/kairos-io/kairos/pkg/utils"
"github.com/spectrocloud-labs/herd" "github.com/spectrocloud-labs/herd"
) )
@@ -274,7 +274,7 @@ func (s *State) Register(g *herd.Graph) error {
err = g.Add(opMountBaseOverlay, err = g.Add(opMountBaseOverlay,
herd.WithCallback( herd.WithCallback(
func(ctx context.Context) error { func(ctx context.Context) error {
op, err := baseOverlay(profile.Overlay{ op, err := baseOverlay(Overlay{
Base: "/run/overlay", Base: "/run/overlay",
BackingBase: "tmpfs:20%", BackingBase: "tmpfs:20%",
}) })

View File

@@ -1,4 +1,4 @@
package profile package mount
type Layout struct { type Layout struct {
Overlay Overlay Overlay Overlay

View File

@@ -1,32 +0,0 @@
package prepare
/*
func hasMountpoint(path string, mounts []string) bool {
for _, mount := range mounts {
if strings.HasSuffix(mount, path) {
return true
}
}
return false
}
func getStateMountpoints(statePaths []string, mountpoints []string) string {
var stateMounts string
for _, path := range statePaths {
if !hasMountpoint(path, mountpoints) {
stateMounts += path + " "
}
}
return stateMounts
}
func getOverlayMountpoints(rwPaths []string, mounts []string) string {
var mountpoints string
for _, path := range rwPaths {
if !hasMountpoint(path, mounts) {
mountpoints += path + ":overlay "
}
}
return mountpoints
}
*/

View File

@@ -1,7 +0,0 @@
package profile
func Apply() {
// Load all profiles
// Apply mounts
// Apply configurations to sysroot (/) or (/sysroot)
}

View File

@@ -1,4 +0,0 @@
package profile
// profile.Mount mounts a profile to the system.
func Mount() {}