From 7d9accccd7c23957425b614d91fbeae3f315ebcd Mon Sep 17 00:00:00 2001 From: Dimitris Karakasilis Date: Fri, 23 Feb 2024 11:47:15 +0200 Subject: [PATCH 1/9] [WIP] Try to see which code breaks it Fixes https://github.com/kairos-io/kairos/issues/2281 Signed-off-by: Dimitris Karakasilis --- internal/agent/install.go | 11 +++++++---- pkg/action/install.go | 3 +++ pkg/config/spec.go | 3 +++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/internal/agent/install.go b/internal/agent/install.go index 5ba1a151..5fb3ce78 100644 --- a/internal/agent/install.go +++ b/internal/agent/install.go @@ -213,9 +213,10 @@ func RunInstall(c *config.Config) error { utils.SetEnv(c.Env) utils.SetEnv(c.Install.Env) - if c.Install.Device == "" || c.Install.Device == "auto" { - c.Install.Device = detectDevice() - } + // if c.Install.Device == "" || c.Install.Device == "auto" { + // c.Install.Device = detectDevice() + // } + c.Install.Device = "/dev/vdb" // UKI path. Check if we are on UKI AND if we are running off a cd, otherwise it makes no sense to run the install // From the installed system @@ -267,7 +268,9 @@ func runInstall(c *config.Config) error { } // TODO: This should not be neccessary - installSpec.NoFormat = c.Install.NoFormat + fmt.Printf("!!!!!!!!!! installSpec.NoFormat = %+v\n", installSpec.NoFormat) + fmt.Printf("!!!!!!!!!! c.Install.NoFormat = %+v\n", c.Install.NoFormat) + //installSpec.NoFormat = c.Install.NoFormat // Set our cloud-init to the file we just created f, err := dumpCCStringToFile(c) diff --git a/pkg/action/install.go b/pkg/action/install.go index 54a3214a..be4fe008 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -146,6 +146,7 @@ func (i InstallAction) Run() (err error) { // Check no-format flag if i.spec.NoFormat { + fmt.Println("!!!!!!!!!!!! won't format") // Check force flag against current device labels := []string{i.spec.Active.Label, i.spec.Recovery.Label} if e.CheckActiveDeployment(labels) && !i.spec.Force { @@ -164,6 +165,8 @@ func (i InstallAction) Run() (err error) { } } + fmt.Printf("!!!!!!!!!!!! i.spec.Target = %+v\n", i.spec.Target) + err = e.MountPartitions(i.spec.Partitions.PartitionsByMountPoint(false)) if err != nil { return err diff --git a/pkg/config/spec.go b/pkg/config/spec.go index 2862276f..d2a971be 100644 --- a/pkg/config/spec.go +++ b/pkg/config/spec.go @@ -97,6 +97,7 @@ func NewInstallSpec(cfg *Config) (*v1.InstallSpec, error) { FS: constants.LinuxImgFs, Size: constants.ImgSize, } + fmt.Printf("!!!!!!!!!!!!!!! cfg.Install.Device = %+v\n", cfg.Install.Device) spec := &v1.InstallSpec{ Target: cfg.Install.Device, @@ -564,6 +565,8 @@ func ReadInstallSpecFromConfig(c *Config) (*v1.InstallSpec, error) { // So instead we do the check here and override the installSpec.Target with the Config.Install.Device // as its the soonest we have access to both if installSpec.Target == "auto" { + fmt.Printf("!!!!!!! installSpec.Target = %+v\n", installSpec.Target) + fmt.Printf("!!!!!!! c.Install.Device = %+v\n", c.Install.Device) installSpec.Target = c.Install.Device } return installSpec, nil From 804462e2729200effb9928cc57b7a693c5866c43 Mon Sep 17 00:00:00 2001 From: Dimitris Karakasilis Date: Wed, 28 Feb 2024 08:51:06 +0200 Subject: [PATCH 2/9] WIP Signed-off-by: Dimitris Karakasilis --- config.yaml | 48 ++++++++++++++++ go.mod | 1 + go.sum | 40 -------------- internal/agent/install.go | 11 ++-- internal/agent/interactive_install.go | 17 ------ pkg/config/config.go | 4 +- pkg/config/spec.go | 79 +++++++++++++++++++++++++-- 7 files changed, 129 insertions(+), 71 deletions(-) create mode 100644 config.yaml diff --git a/config.yaml b/config.yaml new file mode 100644 index 00000000..48ac73c2 --- /dev/null +++ b/config.yaml @@ -0,0 +1,48 @@ +#cloud-config + +strict: true +debug: true + +install: + no-format: true + auto: true + poweroff: false + reboot: false + grub_options: + extra_cmdline: "rd.immucore.debug" +users: + - name: "kairos" + passwd: "kairos" + +stages: + kairos-install.pre.before: + - if: '[ -e "/dev/vdb" ]' + name: "Create partitions" + commands: + - | + parted --script --machine -- "/dev/vdb" mklabel gpt + #parted --script "/dev/vdb" mkpart primary fat32 0 1MB + #mkfs.fat32 -L COS_GRUB /dev/vdb1 + layout: + device: + path: "/dev/vdb" + add_partitions: + - fsLabel: COS_GRUB + size: 1 + pLabel: grub + - fsLabel: COS_OEM + size: 64 + pLabel: oem + - fsLabel: COS_RECOVERY + size: 8500 + pLabel: recovery + - fsLabel: COS_STATE + size: 18000 + pLabel: state + - fsLabel: COS_PERSISTENT + pLabel: persistent + size: 0 + filesystem: "ext4" + boot: + - systemd_firstboot: + keymap: us diff --git a/go.mod b/go.mod index 43d5af22..7188e2d0 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.19 // This versions require go1.20 replace ( + github.com/kairos-io/kairos-sdk => /home/dimitris/workspace/kairos/kairos-sdk github.com/onsi/ginkgo/v2 v2.15.0 => github.com/onsi/ginkgo/v2 v2.12.1 github.com/onsi/gomega v1.31.1 => github.com/onsi/gomega v1.28.0 ) diff --git a/go.sum b/go.sum index 73523da2..6938ed61 100644 --- a/go.sum +++ b/go.sum @@ -29,8 +29,6 @@ github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBa github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= -github.com/Microsoft/hcsshim v0.11.1 h1:hJ3s7GbWlGK4YVV92sO88BQSyF4ZLVy7/awqOlPxFbA= -github.com/Microsoft/hcsshim v0.11.1/go.mod h1:nFJmaO4Zr5Y7eADdFOpYswDDlNVbvcIJJNJLECr5JQg= github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7fz8= github.com/Microsoft/hcsshim v0.11.4/go.mod h1:smjE4dvqPX9Zldna+t5FG3rnoHhaB7QYxPRqGcpAD9w= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= @@ -38,7 +36,6 @@ github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 h1:kkhsdkhsCv github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= -github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= github.com/alecthomas/assert/v2 v2.3.0 h1:mAsH2wmvjsuvyBvAmCtm7zFsBlb8mIHx5ySLVdDZXL0= github.com/alecthomas/repr v0.2.0 h1:HAzS41CIzNW5syS8Mf9UwXhNH1J9aix/BvDRf1Ml2Yk= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -52,7 +49,6 @@ github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFI github.com/apex/log v1.9.0 h1:FHtw/xuaM8AgmvDDTI9fiwoAL25Sq2cxojnZICUU8l0= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= -github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/atomicgo/cursor v0.0.1/go.mod h1:cBON2QmmrysudxNBFthvMtN32r3jxVRIvzkUiF/RuIk= github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4= github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= @@ -64,7 +60,6 @@ github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiE github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bool64/dev v0.2.31 h1:OS57EqYaYe2M/2bw9uhDCIFiZZwywKFS/4qMLN6JUmQ= github.com/bool64/shared v0.1.5 h1:fp3eUhBsrSjNCQPcSdQqZxxh9bBwrYiZ+zOKFkM0/2E= github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= @@ -86,28 +81,22 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/containerd/aufs v1.0.0/go.mod h1:kL5kd6KM5TzQjR79jljyi4olc1Vrx6XBlcyj3gNv2PU= github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 h1:q2hJAaP1k2wIvVRd/hEHD7lacgqrCPS+k8g1MndzfWY= github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk= -github.com/containerd/containerd v1.7.7 h1:QOC2K4A42RQpcrZyptP6z9EJZnlHfHJUfZrAAHe15q4= -github.com/containerd/containerd v1.7.7/go.mod h1:3c4XZv6VeT9qgf9GMTxNTMFxGJrGpI2vz1yk4ye+YY8= github.com/containerd/containerd v1.7.11 h1:lfGKw3eU35sjV0aG2eYZTiwFEY1pCzxdzicHP3SZILw= github.com/containerd/containerd v1.7.11/go.mod h1:5UluHxHTX2rdvYuZ5OJTC5m/KJNs0Zs9wVoJm9zf5ZE= github.com/containerd/continuity v0.4.2 h1:v3y/4Yz5jwnvqPKJJ+7Wf93fyWoCB3F5EclWG023MDM= github.com/containerd/continuity v0.4.2/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ= -github.com/containerd/go-runc v1.0.0/go.mod h1:cNU0ZbCgCQVZK4lgG3P+9tn9/PaJNmoDXPpoJhDR+Ok= github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= github.com/containerd/stargz-snapshotter/estargz v0.14.3 h1:OqlDCK3ZVUO6C3B/5FSkDwbkEETK84kQgEeFwDC+62k= github.com/containerd/stargz-snapshotter/estargz v0.14.3/go.mod h1:KY//uOCIkSuNAHhJogcZtrNHdKrA99/FCCRjE3HD36o= -github.com/containerd/typeurl v1.0.2/go.mod h1:9trJWW2sRlGub4wZJRTW83VtbOLS6hwcDZXTn6oPz9s= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= @@ -146,8 +135,6 @@ github.com/docker/docker-credential-helpers v0.7.0 h1:xtCHsjxogADNZcdv1pKUHXryef github.com/docker/docker-credential-helpers v0.7.0/go.mod h1:rETQfLdHNT3foU5kuNkFR1R1V12OJRRO5lzt2D1b5X0= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= -github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= -github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHzueweSI3Vw= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a h1:mATvB/9r/3gvcejNsXKSkQ6lcIaNec2nyfOdlTBR2lU= @@ -208,7 +195,6 @@ github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4er github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -295,15 +281,6 @@ github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwA github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kairos-io/kairos-sdk v0.0.27-0.20240301083517-b3dfedfacbf4 h1:4DTdqVpHhiwCZ5RD67zT/OxT/wQOwDQq/aZi4rPSxvg= -github.com/kairos-io/kairos-sdk v0.0.27-0.20240301083517-b3dfedfacbf4/go.mod h1:btSB2QAds/WSyIyPxnQ3jueMbkkZ75pHUUCj+yHpthQ= -github.com/kairos-io/kairos-sdk v0.0.27 h1:p7361CNAaUYSjShh6bh0bb08S+p19rEy0Ki9seDCJMg= -github.com/kairos-io/kairos-sdk v0.0.27/go.mod h1:btSB2QAds/WSyIyPxnQ3jueMbkkZ75pHUUCj+yHpthQ= -github.com/kairos-io/kairos-sdk v0.0.28-0.20240326074106-708da847aa1e/go.mod h1:btSB2QAds/WSyIyPxnQ3jueMbkkZ75pHUUCj+yHpthQ= -github.com/kairos-io/kairos-sdk v0.0.28 h1:vjIUo3uSb6xNbr027XlyOaS0NzIIMXdCB2AzluBFV2o= -github.com/kairos-io/kairos-sdk v0.0.28/go.mod h1:btSB2QAds/WSyIyPxnQ3jueMbkkZ75pHUUCj+yHpthQ= -github.com/kairos-io/kairos-sdk v0.0.29 h1:GI1XOC1YkyBrtRemexp4z4HLJbGVkBAjF/2sXWnaIs4= -github.com/kairos-io/kairos-sdk v0.0.29/go.mod h1:QyUBFFKzea0pfI+30E+i001+YYco7DMKLQRXncKZoYI= github.com/kairos-io/kcrypt v0.9.1 h1:bMDXZ8MiPY/fgLe5CXQPfUIRchzxErlJ8nfZM/JPfEU= github.com/kairos-io/kcrypt v0.9.1/go.mod h1:odsVL3ab2GJUgDnvDGJi54jrWUe6tjfW9875knT/ltU= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= @@ -331,12 +308,10 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/labstack/echo/v4 v4.11.4 h1:vDZmA+qNeh1pd/cCkEicDMrjtrnMGQ1QFI9gWN1zGq8= github.com/labstack/echo/v4 v4.11.4/go.mod h1:noh7EvLwqDsmh/X/HWKPUl1AjzJrhyptRyEbQJfxen8= github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0= github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU= -github.com/linuxkit/virtsock v0.0.0-20201010232012-f8cee7dfc7a3/go.mod h1:3r6x7q95whyfWQpmGZTu3gk3v2YkMi05HEzl7Tf7YEo= github.com/lithammer/fuzzysearch v1.1.8 h1:/HIuJnjHuXS8bKaiTMeeDlW2/AyIWk2brx1V8LFgLN4= github.com/lithammer/fuzzysearch v1.1.8/go.mod h1:IdqeyBClc3FFqSzYq/MXESsS4S0FsZ5ajtkr5xPLts4= github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= @@ -376,18 +351,14 @@ github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= github.com/moby/moby v24.0.9+incompatible h1:Z/hFbZJqC5Fmuf6jesMLdHU71CMAgdiSJ1ZYey+bFmg= github.com/moby/moby v24.0.9+incompatible/go.mod h1:fDXVQ6+S340veQPv35CzDahGBmHsiclFwfEygB/TWMc= -github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= github.com/moby/sys/mountinfo v0.6.2 h1:BzJjoreD5BMFNmD9Rus6gdd1pLuecOFPt8wC+Vygl78= github.com/moby/sys/mountinfo v0.6.2/go.mod h1:IJb6JQeOklcdMU9F5xQ8ZALD+CUr5VlGpwtX+VE0rpI= github.com/moby/sys/sequential v0.5.0 h1:OPvI35Lzn9K04PBbCLW0g4LcFAJgHsvXsRyewg5lXtc= github.com/moby/sys/sequential v0.5.0/go.mod h1:tH2cOOs5V9MlPiXcQzRC+eEyab644PWKGRYaaV5ZZlo= github.com/moby/term v0.0.0-20221205130635-1aeaba878587 h1:HfkjXDfhgVaN5rmueG8cL8KKeFNecRCXFhaJ2qZ5SKA= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= -github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/mudler/entities v0.0.0-20220905203055-68348bae0f49 h1:P1QgHLh0hX935j6m9K6rlSxc0mkD1UuIAOQEu+1VCW4= github.com/mudler/entities v0.0.0-20220905203055-68348bae0f49/go.mod h1:qquFT9tYp+/NO7tTotto4BT9zSRYSMDxo2PGZwujpFA= github.com/mudler/go-nodepair v0.0.0-20221223092639-ba399a66fdfb h1:F6TP0DW7C0U9sgm9g4uAs0Vp2JSkhn2umlyrNlxUKXw= @@ -407,10 +378,8 @@ github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKt github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo= github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= @@ -448,7 +417,6 @@ github.com/packethost/packngo v0.29.0/go.mod h1:/UHguFdPs6Lf6FOkkSEPnRY5tgS0fsVM github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= -github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/phayes/permbits v0.0.0-20190612203442-39d7c581d2ee h1:P6U24L02WMfj9ymZTxl7CxS73JC99x3ukk+DBkgQGQs= github.com/phayes/permbits v0.0.0-20190612203442-39d7c581d2ee/go.mod h1:3uODdxMgOaPYeWU7RzZLxVtJHZ/x1f/iHkBZuKJDzuY= github.com/pierrec/lz4 v2.3.0+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= @@ -559,7 +527,6 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= -github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980/go.mod h1:AO3tvPzVZ/ayst6UlUKUv6rcPQInYe3IknH3jYhAKu8= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= @@ -583,7 +550,6 @@ github.com/swaggest/jsonschema-go v0.3.62 h1:eIE0aRklWa2eLJg2L/zqyWpKvgUPbq2oKOt github.com/swaggest/jsonschema-go v0.3.62/go.mod h1:DYuKqdpms/edvywsX6p1zHXCZkdwB28wRaBdFCe3Duw= github.com/swaggest/refl v1.3.0 h1:PEUWIku+ZznYfsoyheF97ypSduvMApYyGkYF3nabS0I= github.com/swaggest/refl v1.3.0/go.mod h1:3Ujvbmh1pfSbDYjC6JGG7nMgPvpG0ehQL4iNonnLNbg= -github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/tklauser/go-sysconf v0.3.11 h1:89WgdJhk5SNwJfu+GKyYveZ4IaJ7xAkecBo+KdJV0CM= github.com/tklauser/go-sysconf v0.3.11/go.mod h1:GqXfhXY3kiPa0nAXPDIQIWzJbMCB7AmcWpGR8lSZfqI= github.com/tklauser/numcpus v0.6.0 h1:kebhY2Qt+3U6RNK7UqpYNA+tJ23IBEGKkB7JQBfDYms= @@ -620,7 +586,6 @@ github.com/willdonnelly/passwd v0.0.0-20141013001024-7935dab3074c h1:4+NVyrLUuEm github.com/willdonnelly/passwd v0.0.0-20141013001024-7935dab3074c/go.mod h1:xcvfY9pOw6s4wyrhilFSbMthL6KzgrfCIETHHUOQ/fQ= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= -github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= @@ -638,7 +603,6 @@ github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQ github.com/zcalusic/sysinfo v1.0.1 h1:cVh8q3codjh43AGRTa54dJ2Zq+qPejv8n2VWpxKViwc= github.com/zcalusic/sysinfo v1.0.1/go.mod h1:LxwKwtQdbTIQc65drhjQzYzt0o7jfB80LrrZm7SWn8o= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.mozilla.org/pkcs7 v0.0.0-20200128120323-432b2356ecb1/go.mod h1:SNgMg+EgDFwmvSmLRTNKC5fegJjB7v23qTQ0XLGUNHk= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -841,18 +805,15 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/djherbis/times.v1 v1.2.0/go.mod h1:AQlg6unIsrsCEdQYhTzERy542dz6SFdQFZFv6mUY0P8= gopkg.in/djherbis/times.v1 v1.3.0 h1:uxMS4iMtH6Pwsxog094W0FYldiNnfY/xba00vq6C2+o= gopkg.in/djherbis/times.v1 v1.3.0/go.mod h1:AQlg6unIsrsCEdQYhTzERy542dz6SFdQFZFv6mUY0P8= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473/go.mod h1:N1eN2tsCx0Ydtgjl4cqmbRCsY4/+z4cYDeqwZTk6zog= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/square/go-jose.v2 v2.5.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= @@ -872,7 +833,6 @@ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.0.3 h1:4AuOwCGf4lLR9u3YOe2awrHygurzhO/HeQ6laiA6Sx0= -gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= howett.net/plist v1.0.0 h1:7CrbWYbPPO/PyNy38b2EB/+gYbjCe2DXBxgtOOZbSQM= diff --git a/internal/agent/install.go b/internal/agent/install.go index 5fb3ce78..5aa57dd2 100644 --- a/internal/agent/install.go +++ b/internal/agent/install.go @@ -65,6 +65,7 @@ func ManualInstall(c, sourceImgURL, device string, reboot, poweroff, strictValid cliConf := generateInstallConfForCLIArgs(sourceImgURL) cliConfManualArgs := generateInstallConfForManualCLIArgs(device, reboot, poweroff) + fmt.Printf("configSource = %+v\n", configSource) cc, err := config.Scan(collector.Directories(configSource), collector.Readers(strings.NewReader(cliConf), strings.NewReader(cliConfManualArgs)), collector.MergeBootLine, @@ -72,6 +73,7 @@ func ManualInstall(c, sourceImgURL, device string, reboot, poweroff, strictValid if err != nil { return err } + fmt.Printf("cc.Install = %+v\n", cc.Install) return RunInstall(cc) } @@ -121,7 +123,7 @@ func Install(sourceImgURL string, dir ...string) error { return err } - if cc.Install.Reboot == false && cc.Install.Poweroff == false { + if !cc.Install.Reboot && !cc.Install.Poweroff { pterm.DefaultInteractiveContinue.Show("Installation completed, press enter to go back to the shell.") svc, err := machine.Getty(1) if err == nil { @@ -194,7 +196,7 @@ func Install(sourceImgURL string, dir ...string) error { // If neither reboot and poweroff are enabled let the user insert enter to go back to a new shell // This is helpful to see the installation messages instead of just cleaning the screen with a new tty - if cc.Install.Reboot == false && cc.Install.Poweroff == false { + if !cc.Install.Reboot && !cc.Install.Poweroff { pterm.DefaultInteractiveContinue.Show("Installation completed, press enter to go back to the shell.") utils.Prompt("") //nolint:errcheck @@ -213,11 +215,6 @@ func RunInstall(c *config.Config) error { utils.SetEnv(c.Env) utils.SetEnv(c.Install.Env) - // if c.Install.Device == "" || c.Install.Device == "auto" { - // c.Install.Device = detectDevice() - // } - c.Install.Device = "/dev/vdb" - // UKI path. Check if we are on UKI AND if we are running off a cd, otherwise it makes no sense to run the install // From the installed system if internalutils.IsUkiWithFs(c.Fs) { diff --git a/internal/agent/interactive_install.go b/internal/agent/interactive_install.go index 2a352262..4221977a 100644 --- a/internal/agent/interactive_install.go +++ b/internal/agent/interactive_install.go @@ -112,23 +112,6 @@ func promptToUnstructured(p events.YAMLPrompt, unstructuredYAML map[string]inter return unstructuredYAML, nil } -func detectDevice() string { - preferedDevice := "/dev/sda" - maxSize := float64(0) - - block, err := ghw.Block() - if err == nil { - for _, disk := range block.Disks { - size := float64(disk.SizeBytes) / float64(GiB) - if size > maxSize { - maxSize = size - preferedDevice = "/dev/" + disk.Name - } - } - } - return preferedDevice -} - func InteractiveInstall(debug, spawnShell bool, sourceImgURL string) error { var sshUsers []string bus.Manager.Initialize() diff --git a/pkg/config/config.go b/pkg/config/config.go index 7c7ee5ad..1eff757e 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -35,7 +35,7 @@ const ( type Install struct { Auto bool `yaml:"auto,omitempty"` Reboot bool `yaml:"reboot,omitempty"` - NoFormat bool `yaml:"no_format,omitempty"` + NoFormat bool `yaml:"no-format,omitempty"` Device string `yaml:"device,omitempty"` Poweroff bool `yaml:"poweroff,omitempty"` GrubOptions map[string]string `yaml:"grub_options,omitempty"` @@ -353,8 +353,8 @@ func scan(result *Config, opts ...collector.Option) (c *Config, err error) { genericConfig, err := collector.Scan(o, FilterKeys) if err != nil { return result, err - } + result.Config = *genericConfig configStr, err := genericConfig.String() if err != nil { diff --git a/pkg/config/spec.go b/pkg/config/spec.go index d2a971be..ed0560f0 100644 --- a/pkg/config/spec.go +++ b/pkg/config/spec.go @@ -26,6 +26,7 @@ import ( "strings" "github.com/google/go-containerregistry/pkg/crane" + "github.com/jaypipes/ghw" "golang.org/x/sys/unix" "github.com/kairos-io/kairos-agent/v2/pkg/constants" @@ -37,6 +38,14 @@ import ( "github.com/spf13/viper" ) +const ( + _ = 1 << (10 * iota) + KiB + MiB + GiB + TiB +) + // NewInstallSpec returns an InstallSpec struct all based on defaults and basic host checks (e.g. EFI vs BIOS) func NewInstallSpec(cfg *Config) (*v1.InstallSpec, error) { var firmware string @@ -557,6 +566,21 @@ func ReadInstallSpecFromConfig(c *Config) (*v1.InstallSpec, error) { return &v1.InstallSpec{}, err } installSpec := sp.(*v1.InstallSpec) + + // TODO: Do the same for UKI + if installSpec.Target == "" || installSpec.Target == "auto" { + installSpec.Target = detectLargestDevice() + } + + fmt.Printf("installSpec before = %+v\n", installSpec) + fmt.Printf("c = %+v\n", c) + if installSpec.NoFormat { + installSpec.Target = "" + } + fmt.Printf("installSpec after = %+v\n", installSpec) + + fmt.Printf("!!!!!()()()()()!!!! installSPec.Target = %+v\n", installSpec.Target) + // Workaround! // If we set the "auto" for the device in the cloudconfig the value will be proper in the Config.Install.Device // But on the cloud-config it will still appear as "auto" as we dont modify that @@ -564,11 +588,11 @@ func ReadInstallSpecFromConfig(c *Config) (*v1.InstallSpec, error) { // What device was choosen, and re-choosing again could lead to different results // So instead we do the check here and override the installSpec.Target with the Config.Install.Device // as its the soonest we have access to both - if installSpec.Target == "auto" { - fmt.Printf("!!!!!!! installSpec.Target = %+v\n", installSpec.Target) - fmt.Printf("!!!!!!! c.Install.Device = %+v\n", c.Install.Device) - installSpec.Target = c.Install.Device - } + // if installSpec.Target == "auto" { + // fmt.Printf("!!!!!!! installSpec.Target = %+v\n", installSpec.Target) + // fmt.Printf("!!!!!!! c.Install.Device = %+v\n", c.Install.Device) + // installSpec.Target = c.Install.Device + // } return installSpec, nil } @@ -659,6 +683,7 @@ func ReadUkiInstallSpecFromConfig(c *Config) (*v1.InstallUkiSpec, error) { return &v1.InstallUkiSpec{}, err } installSpec := sp.(*v1.InstallUkiSpec) + // Workaround! // If we set the "auto" for the device in the cloudconfig the value will be proper in the Config.Install.Device // But on the cloud-config it will still appear as "auto" as we dont modify that @@ -669,6 +694,7 @@ func ReadUkiInstallSpecFromConfig(c *Config) (*v1.InstallUkiSpec, error) { if installSpec.Target == "auto" { installSpec.Target = c.Install.Device } + return installSpec, nil } @@ -972,3 +998,46 @@ func unmarshallFullSpec(r *Config, subkey string, sp v1.Spec) error { return nil } + +// detectLargestDevice returns the largest disk found +func detectLargestDevice() string { + preferedDevice := "/dev/sda" + maxSize := float64(0) + + block, err := ghw.Block() + if err == nil { + for _, disk := range block.Disks { + size := float64(disk.SizeBytes) / float64(GiB) + if size > maxSize { + maxSize = size + preferedDevice = "/dev/" + disk.Name + } + } + } + return preferedDevice +} + +// detectPreConfiguredDevice returns a disk that has partitions labeled with +// Kairos labels. It can be used to detect a pre-configured device. +func detectPreConfiguredDevice(logger v1.Logger) string { + block, err := ghw.Block() + if err != nil { + logger.Errorf("failed getting block devices: %w", err) + return "" + } + + fmt.Println("!!!!!***!!!! detecting preconfigured") + for _, disk := range block.Disks { + fmt.Printf("!!!!!!!!!!!!!!! disk = %+v\n", disk) + for _, p := range disk.Partitions { + fmt.Printf("!!!!!!!!!!!!!!!! p = %+v\n", p) + fmt.Printf("p.FilesystemLabel = %+v\n", p.FilesystemLabel) + fmt.Printf("p.Label = %+v\n", p.Label) + if p.FilesystemLabel == "COS_STATE" { + return disk.Name + } + } + } + + return "" +} From 9df8781d234fcbfbc5eb21d952da69ebe47964f4 Mon Sep 17 00:00:00 2001 From: Dimitris Karakasilis Date: Fri, 5 Apr 2024 17:10:38 +0300 Subject: [PATCH 3/9] Detect the preconfigured device when no-format is true Signed-off-by: Dimitris Karakasilis --- config.yaml | 4 +--- pkg/action/install.go | 10 ++++++++++ pkg/config/spec.go | 38 +++++++++++++++++++++++--------------- 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/config.yaml b/config.yaml index 48ac73c2..f98d72d5 100644 --- a/config.yaml +++ b/config.yaml @@ -21,15 +21,13 @@ stages: commands: - | parted --script --machine -- "/dev/vdb" mklabel gpt + sgdisk --new=1:2048:+1M --change-name=1:'bios' --typecode=1:EF02 /dev/vdb # for grub #parted --script "/dev/vdb" mkpart primary fat32 0 1MB #mkfs.fat32 -L COS_GRUB /dev/vdb1 layout: device: path: "/dev/vdb" add_partitions: - - fsLabel: COS_GRUB - size: 1 - pLabel: grub - fsLabel: COS_OEM size: 64 pLabel: oem diff --git a/pkg/action/install.go b/pkg/action/install.go index be4fe008..ea0bbe45 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -149,9 +149,19 @@ func (i InstallAction) Run() (err error) { fmt.Println("!!!!!!!!!!!! won't format") // Check force flag against current device labels := []string{i.spec.Active.Label, i.spec.Recovery.Label} + fmt.Printf("!!!! check active deployment = %+v\n", e.CheckActiveDeployment(labels)) if e.CheckActiveDeployment(labels) && !i.spec.Force { return fmt.Errorf("use `force` flag to run an installation over the current running deployment") } + + if i.spec.Target == "" { + device, err := config.DetectPreConfiguredDevice(i.cfg.Logger) + if err != nil { + return fmt.Errorf("no target device specified and no device found: %s", err) + } + fmt.Printf("!!! device = %+v\n", device) + i.spec.Target = device + } } else { // Deactivate any active volume on target err = e.DeactivateDevices() diff --git a/pkg/config/spec.go b/pkg/config/spec.go index ed0560f0..bdc3072e 100644 --- a/pkg/config/spec.go +++ b/pkg/config/spec.go @@ -18,13 +18,14 @@ package config import ( "fmt" - sdkTypes "github.com/kairos-io/kairos-sdk/types" "io/fs" "os" "path/filepath" "reflect" "strings" + sdkTypes "github.com/kairos-io/kairos-sdk/types" + "github.com/google/go-containerregistry/pkg/crane" "github.com/jaypipes/ghw" "golang.org/x/sys/unix" @@ -580,6 +581,7 @@ func ReadInstallSpecFromConfig(c *Config) (*v1.InstallSpec, error) { fmt.Printf("installSpec after = %+v\n", installSpec) fmt.Printf("!!!!!()()()()()!!!! installSPec.Target = %+v\n", installSpec.Target) + fmt.Printf("!!!!!()()()()()!!!! c.Install.Device = %+v\n", c.Install.Device) // Workaround! // If we set the "auto" for the device in the cloudconfig the value will be proper in the Config.Install.Device @@ -588,11 +590,22 @@ func ReadInstallSpecFromConfig(c *Config) (*v1.InstallSpec, error) { // What device was choosen, and re-choosing again could lead to different results // So instead we do the check here and override the installSpec.Target with the Config.Install.Device // as its the soonest we have access to both - // if installSpec.Target == "auto" { - // fmt.Printf("!!!!!!! installSpec.Target = %+v\n", installSpec.Target) - // fmt.Printf("!!!!!!! c.Install.Device = %+v\n", c.Install.Device) - // installSpec.Target = c.Install.Device + if installSpec.Target == "auto" { + // fmt.Printf("!!!!!!! installSpec.Target = %+v\n", installSpec.Target) + // fmt.Printf("!!!!!!! c.Install.Device = %+v\n", c.Install.Device) + installSpec.Target = c.Install.Device + } + + // if installSpec.Target == "" { + // device, err := DetectPreConfiguredDevice(c.Logger) + // if err != nil { + // return installSpec, err + // } + // installSpec.Target = device // } + + // fmt.Printf("!!!!!(after)()()()()!!!! installSPec.Target = %+v\n", installSpec.Target) + // fmt.Printf("!!!!!(after)()()()()!!!! c.Install.Device = %+v\n", c.Install.Device) return installSpec, nil } @@ -1017,27 +1030,22 @@ func detectLargestDevice() string { return preferedDevice } -// detectPreConfiguredDevice returns a disk that has partitions labeled with +// DetectPreConfiguredDevice returns a disk that has partitions labeled with // Kairos labels. It can be used to detect a pre-configured device. -func detectPreConfiguredDevice(logger v1.Logger) string { +func DetectPreConfiguredDevice(logger sdkTypes.KairosLogger) (string, error) { block, err := ghw.Block() if err != nil { logger.Errorf("failed getting block devices: %w", err) - return "" + return "", err } - fmt.Println("!!!!!***!!!! detecting preconfigured") for _, disk := range block.Disks { - fmt.Printf("!!!!!!!!!!!!!!! disk = %+v\n", disk) for _, p := range disk.Partitions { - fmt.Printf("!!!!!!!!!!!!!!!! p = %+v\n", p) - fmt.Printf("p.FilesystemLabel = %+v\n", p.FilesystemLabel) - fmt.Printf("p.Label = %+v\n", p.Label) if p.FilesystemLabel == "COS_STATE" { - return disk.Name + return filepath.Join("/", "dev", disk.Name), nil } } } - return "" + return "", nil } From da9065eee04cf0aa21c157e3d8d36ef1fee6328d Mon Sep 17 00:00:00 2001 From: Dimitris Karakasilis Date: Mon, 8 Apr 2024 10:51:11 +0300 Subject: [PATCH 4/9] Remove unecessary go.mod "replace" instruction Signed-off-by: Dimitris Karakasilis --- go.mod | 1 - go.sum | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 7188e2d0..43d5af22 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,6 @@ go 1.19 // This versions require go1.20 replace ( - github.com/kairos-io/kairos-sdk => /home/dimitris/workspace/kairos/kairos-sdk github.com/onsi/ginkgo/v2 v2.15.0 => github.com/onsi/ginkgo/v2 v2.12.1 github.com/onsi/gomega v1.31.1 => github.com/onsi/gomega v1.28.0 ) diff --git a/go.sum b/go.sum index 6938ed61..3bcaa816 100644 --- a/go.sum +++ b/go.sum @@ -281,6 +281,8 @@ github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwA github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kairos-io/kairos-sdk v0.0.28 h1:vjIUo3uSb6xNbr027XlyOaS0NzIIMXdCB2AzluBFV2o= +github.com/kairos-io/kairos-sdk v0.0.28/go.mod h1:btSB2QAds/WSyIyPxnQ3jueMbkkZ75pHUUCj+yHpthQ= github.com/kairos-io/kcrypt v0.9.1 h1:bMDXZ8MiPY/fgLe5CXQPfUIRchzxErlJ8nfZM/JPfEU= github.com/kairos-io/kcrypt v0.9.1/go.mod h1:odsVL3ab2GJUgDnvDGJi54jrWUe6tjfW9875knT/ltU= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= From 0a3b0c048251ee666627420460b33eb2036062af Mon Sep 17 00:00:00 2001 From: Dimitris Karakasilis Date: Mon, 8 Apr 2024 10:56:01 +0300 Subject: [PATCH 5/9] Fix linting error Signed-off-by: Dimitris Karakasilis --- pkg/config/spec.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/spec.go b/pkg/config/spec.go index bdc3072e..d9a511dc 100644 --- a/pkg/config/spec.go +++ b/pkg/config/spec.go @@ -1035,7 +1035,7 @@ func detectLargestDevice() string { func DetectPreConfiguredDevice(logger sdkTypes.KairosLogger) (string, error) { block, err := ghw.Block() if err != nil { - logger.Errorf("failed getting block devices: %w", err) + logger.Errorf("failed getting block devices: %s", err.Error()) return "", err } From d8df60c315c84bccf66b36bb1562d76a3f4be810 Mon Sep 17 00:00:00 2001 From: Dimitris Karakasilis Date: Mon, 8 Apr 2024 12:51:35 +0300 Subject: [PATCH 6/9] Remove development debug output Signed-off-by: Dimitris Karakasilis --- config.yaml | 46 --------------------------------------- internal/agent/install.go | 7 ------ pkg/action/install.go | 7 ++---- pkg/config/spec.go | 19 ---------------- 4 files changed, 2 insertions(+), 77 deletions(-) delete mode 100644 config.yaml diff --git a/config.yaml b/config.yaml deleted file mode 100644 index f98d72d5..00000000 --- a/config.yaml +++ /dev/null @@ -1,46 +0,0 @@ -#cloud-config - -strict: true -debug: true - -install: - no-format: true - auto: true - poweroff: false - reboot: false - grub_options: - extra_cmdline: "rd.immucore.debug" -users: - - name: "kairos" - passwd: "kairos" - -stages: - kairos-install.pre.before: - - if: '[ -e "/dev/vdb" ]' - name: "Create partitions" - commands: - - | - parted --script --machine -- "/dev/vdb" mklabel gpt - sgdisk --new=1:2048:+1M --change-name=1:'bios' --typecode=1:EF02 /dev/vdb # for grub - #parted --script "/dev/vdb" mkpart primary fat32 0 1MB - #mkfs.fat32 -L COS_GRUB /dev/vdb1 - layout: - device: - path: "/dev/vdb" - add_partitions: - - fsLabel: COS_OEM - size: 64 - pLabel: oem - - fsLabel: COS_RECOVERY - size: 8500 - pLabel: recovery - - fsLabel: COS_STATE - size: 18000 - pLabel: state - - fsLabel: COS_PERSISTENT - pLabel: persistent - size: 0 - filesystem: "ext4" - boot: - - systemd_firstboot: - keymap: us diff --git a/internal/agent/install.go b/internal/agent/install.go index 5aa57dd2..afa0b9c9 100644 --- a/internal/agent/install.go +++ b/internal/agent/install.go @@ -65,7 +65,6 @@ func ManualInstall(c, sourceImgURL, device string, reboot, poweroff, strictValid cliConf := generateInstallConfForCLIArgs(sourceImgURL) cliConfManualArgs := generateInstallConfForManualCLIArgs(device, reboot, poweroff) - fmt.Printf("configSource = %+v\n", configSource) cc, err := config.Scan(collector.Directories(configSource), collector.Readers(strings.NewReader(cliConf), strings.NewReader(cliConfManualArgs)), collector.MergeBootLine, @@ -73,7 +72,6 @@ func ManualInstall(c, sourceImgURL, device string, reboot, poweroff, strictValid if err != nil { return err } - fmt.Printf("cc.Install = %+v\n", cc.Install) return RunInstall(cc) } @@ -264,11 +262,6 @@ func runInstall(c *config.Config) error { return err } - // TODO: This should not be neccessary - fmt.Printf("!!!!!!!!!! installSpec.NoFormat = %+v\n", installSpec.NoFormat) - fmt.Printf("!!!!!!!!!! c.Install.NoFormat = %+v\n", c.Install.NoFormat) - //installSpec.NoFormat = c.Install.NoFormat - // Set our cloud-init to the file we just created f, err := dumpCCStringToFile(c) if err == nil { diff --git a/pkg/action/install.go b/pkg/action/install.go index ea0bbe45..84313c71 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -146,10 +146,9 @@ func (i InstallAction) Run() (err error) { // Check no-format flag if i.spec.NoFormat { - fmt.Println("!!!!!!!!!!!! won't format") + i.cfg.Logger.Infof("NoFormat is true, skipping format and partitioning") // Check force flag against current device labels := []string{i.spec.Active.Label, i.spec.Recovery.Label} - fmt.Printf("!!!! check active deployment = %+v\n", e.CheckActiveDeployment(labels)) if e.CheckActiveDeployment(labels) && !i.spec.Force { return fmt.Errorf("use `force` flag to run an installation over the current running deployment") } @@ -159,7 +158,7 @@ func (i InstallAction) Run() (err error) { if err != nil { return fmt.Errorf("no target device specified and no device found: %s", err) } - fmt.Printf("!!! device = %+v\n", device) + i.cfg.Logger.Infof("No target device specified, using pre-configured device: %s", device) i.spec.Target = device } } else { @@ -175,8 +174,6 @@ func (i InstallAction) Run() (err error) { } } - fmt.Printf("!!!!!!!!!!!! i.spec.Target = %+v\n", i.spec.Target) - err = e.MountPartitions(i.spec.Partitions.PartitionsByMountPoint(false)) if err != nil { return err diff --git a/pkg/config/spec.go b/pkg/config/spec.go index d9a511dc..978661be 100644 --- a/pkg/config/spec.go +++ b/pkg/config/spec.go @@ -107,7 +107,6 @@ func NewInstallSpec(cfg *Config) (*v1.InstallSpec, error) { FS: constants.LinuxImgFs, Size: constants.ImgSize, } - fmt.Printf("!!!!!!!!!!!!!!! cfg.Install.Device = %+v\n", cfg.Install.Device) spec := &v1.InstallSpec{ Target: cfg.Install.Device, @@ -573,15 +572,9 @@ func ReadInstallSpecFromConfig(c *Config) (*v1.InstallSpec, error) { installSpec.Target = detectLargestDevice() } - fmt.Printf("installSpec before = %+v\n", installSpec) - fmt.Printf("c = %+v\n", c) if installSpec.NoFormat { installSpec.Target = "" } - fmt.Printf("installSpec after = %+v\n", installSpec) - - fmt.Printf("!!!!!()()()()()!!!! installSPec.Target = %+v\n", installSpec.Target) - fmt.Printf("!!!!!()()()()()!!!! c.Install.Device = %+v\n", c.Install.Device) // Workaround! // If we set the "auto" for the device in the cloudconfig the value will be proper in the Config.Install.Device @@ -591,21 +584,9 @@ func ReadInstallSpecFromConfig(c *Config) (*v1.InstallSpec, error) { // So instead we do the check here and override the installSpec.Target with the Config.Install.Device // as its the soonest we have access to both if installSpec.Target == "auto" { - // fmt.Printf("!!!!!!! installSpec.Target = %+v\n", installSpec.Target) - // fmt.Printf("!!!!!!! c.Install.Device = %+v\n", c.Install.Device) installSpec.Target = c.Install.Device } - // if installSpec.Target == "" { - // device, err := DetectPreConfiguredDevice(c.Logger) - // if err != nil { - // return installSpec, err - // } - // installSpec.Target = device - // } - - // fmt.Printf("!!!!!(after)()()()()!!!! installSPec.Target = %+v\n", installSpec.Target) - // fmt.Printf("!!!!!(after)()()()()!!!! c.Install.Device = %+v\n", c.Install.Device) return installSpec, nil } From 571f10d9005b556eb3c9fcae218509399f6f0b9e Mon Sep 17 00:00:00 2001 From: Dimitris Karakasilis Date: Mon, 8 Apr 2024 15:58:36 +0300 Subject: [PATCH 7/9] Remove unecessary assignments and add NoFormat to UKI Signed-off-by: Dimitris Karakasilis --- pkg/action/install.go | 5 +++-- pkg/config/spec.go | 29 +++-------------------------- pkg/types/v1/config.go | 1 + pkg/uki/install.go | 37 ++++++++++++++++++++++++++----------- 4 files changed, 33 insertions(+), 39 deletions(-) diff --git a/pkg/action/install.go b/pkg/action/install.go index 84313c71..f0f960ac 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -144,7 +144,6 @@ func (i InstallAction) Run() (err error) { } } - // Check no-format flag if i.spec.NoFormat { i.cfg.Logger.Infof("NoFormat is true, skipping format and partitioning") // Check force flag against current device @@ -153,7 +152,9 @@ func (i InstallAction) Run() (err error) { return fmt.Errorf("use `force` flag to run an installation over the current running deployment") } - if i.spec.Target == "" { + if i.spec.Target == "" || i.spec.Target == "auto" { + // This needs to run after the pre-install stage to give the user the + // opportunity to prepare the target disk in the pre-install stage. device, err := config.DetectPreConfiguredDevice(i.cfg.Logger) if err != nil { return fmt.Errorf("no target device specified and no device found: %s", err) diff --git a/pkg/config/spec.go b/pkg/config/spec.go index 978661be..6f49dda9 100644 --- a/pkg/config/spec.go +++ b/pkg/config/spec.go @@ -567,26 +567,10 @@ func ReadInstallSpecFromConfig(c *Config) (*v1.InstallSpec, error) { } installSpec := sp.(*v1.InstallSpec) - // TODO: Do the same for UKI - if installSpec.Target == "" || installSpec.Target == "auto" { + if (installSpec.Target == "" || installSpec.Target == "auto") && !installSpec.NoFormat { installSpec.Target = detectLargestDevice() } - if installSpec.NoFormat { - installSpec.Target = "" - } - - // Workaround! - // If we set the "auto" for the device in the cloudconfig the value will be proper in the Config.Install.Device - // But on the cloud-config it will still appear as "auto" as we dont modify that - // Unfortunately as we load the full cloud-config and unmarshall it into our spec, we cannot infer from there - // What device was choosen, and re-choosing again could lead to different results - // So instead we do the check here and override the installSpec.Target with the Config.Install.Device - // as its the soonest we have access to both - if installSpec.Target == "auto" { - installSpec.Target = c.Install.Device - } - return installSpec, nil } @@ -678,15 +662,8 @@ func ReadUkiInstallSpecFromConfig(c *Config) (*v1.InstallUkiSpec, error) { } installSpec := sp.(*v1.InstallUkiSpec) - // Workaround! - // If we set the "auto" for the device in the cloudconfig the value will be proper in the Config.Install.Device - // But on the cloud-config it will still appear as "auto" as we dont modify that - // Unfortunately as we load the full cloud-config and unmarshall it into our spec, we cannot infer from there - // What device was choosen, and re-choosing again could lead to different results - // So instead we do the check here and override the installSpec.Target with the Config.Install.Device - // as its the soonest we have access to both - if installSpec.Target == "auto" { - installSpec.Target = c.Install.Device + if (installSpec.Target == "" || installSpec.Target == "auto") && !installSpec.NoFormat { + installSpec.Target = detectLargestDevice() } return installSpec, nil diff --git a/pkg/types/v1/config.go b/pkg/types/v1/config.go index 9553a780..e1c6eb5a 100644 --- a/pkg/types/v1/config.go +++ b/pkg/types/v1/config.go @@ -510,6 +510,7 @@ type InstallUkiSpec struct { PowerOff bool `yaml:"poweroff,omitempty" mapstructure:"poweroff"` Partitions ElementalPartitions `yaml:"partitions,omitempty" mapstructure:"partitions"` ExtraPartitions PartitionList `yaml:"extra-partitions,omitempty" mapstructure:"extra-partitions"` + NoFormat bool `yaml:"no-format,omitempty" mapstructure:"no-format"` CloudInit []string `yaml:"cloud-init,omitempty" mapstructure:"cloud-init"` SkipEntries []string `yaml:"skip-entries,omitempty" mapstructure:"skip-entries"` } diff --git a/pkg/uki/install.go b/pkg/uki/install.go index ec957c7e..c245da0f 100644 --- a/pkg/uki/install.go +++ b/pkg/uki/install.go @@ -40,17 +40,32 @@ func (i *InstallAction) Run() (err error) { i.cfg.Logger.Errorf("running kairos-uki-install.pre hook script: %s", err.Error()) } - // Deactivate any active volume on target - err = e.DeactivateDevices() - if err != nil { - i.cfg.Logger.Errorf("deactivating devices: %s", err.Error()) - return err - } - // Partition device - err = e.PartitionAndFormatDevice(i.spec) - if err != nil { - i.cfg.Logger.Errorf("partitioning and formating devices: %s", err.Error()) - return err + if i.spec.NoFormat { + i.cfg.Logger.Infof("NoFormat is true, skipping format and partitioning") + if i.spec.Target == "" || i.spec.Target == "auto" { + // This needs to run after the pre-install stage to give the user the + // opportunity to prepare the target disk in the pre-install stage. + device, err := config.DetectPreConfiguredDevice(i.cfg.Logger) + if err != nil { + return fmt.Errorf("no target device specified and no device found: %s", err) + } + i.cfg.Logger.Infof("No target device specified, using pre-configured device: %s", device) + i.spec.Target = device + } + } else { + // Deactivate any active volume on target + err = e.DeactivateDevices() + if err != nil { + i.cfg.Logger.Errorf("deactivating devices: %s", err.Error()) + return err + } + + // Partition device + err = e.PartitionAndFormatDevice(i.spec) + if err != nil { + i.cfg.Logger.Errorf("partitioning and formating devices: %s", err.Error()) + return err + } } err = e.MountPartitions(i.spec.GetPartitions().PartitionsByMountPoint(false)) From b80dcdbc756a0455551dd0144b7e92daef3c75b4 Mon Sep 17 00:00:00 2001 From: Dimitris Karakasilis Date: Tue, 9 Apr 2024 12:53:19 +0300 Subject: [PATCH 8/9] Fix go.sum after rebase Signed-off-by: Dimitris Karakasilis --- go.sum | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/go.sum b/go.sum index 3bcaa816..044d98b6 100644 --- a/go.sum +++ b/go.sum @@ -281,8 +281,8 @@ github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwA github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kairos-io/kairos-sdk v0.0.28 h1:vjIUo3uSb6xNbr027XlyOaS0NzIIMXdCB2AzluBFV2o= -github.com/kairos-io/kairos-sdk v0.0.28/go.mod h1:btSB2QAds/WSyIyPxnQ3jueMbkkZ75pHUUCj+yHpthQ= +github.com/kairos-io/kairos-sdk v0.0.29 h1:GI1XOC1YkyBrtRemexp4z4HLJbGVkBAjF/2sXWnaIs4= +github.com/kairos-io/kairos-sdk v0.0.29/go.mod h1:QyUBFFKzea0pfI+30E+i001+YYco7DMKLQRXncKZoYI= github.com/kairos-io/kcrypt v0.9.1 h1:bMDXZ8MiPY/fgLe5CXQPfUIRchzxErlJ8nfZM/JPfEU= github.com/kairos-io/kcrypt v0.9.1/go.mod h1:odsVL3ab2GJUgDnvDGJi54jrWUe6tjfW9875knT/ltU= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= From d3bf4ebedbdca5783c0e26d36bffa905fd026ec1 Mon Sep 17 00:00:00 2001 From: Dimitris Karakasilis Date: Wed, 10 Apr 2024 12:44:44 +0300 Subject: [PATCH 9/9] Bump yip and propagate NoFormat to the install spec We need this from yip: https://github.com/mudler/yip/commit/4ebbc7582ee9c55798446a9bdc8f9659f080b93a Signed-off-by: Dimitris Karakasilis --- go.mod | 14 +++++++------- go.sum | 28 ++++++++++++++-------------- pkg/config/spec.go | 1 + 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/go.mod b/go.mod index 43d5af22..078638a6 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( github.com/mudler/go-nodepair v0.0.0-20221223092639-ba399a66fdfb github.com/mudler/go-pluggable v0.0.0-20230126220627-7710299a0ae5 github.com/mudler/go-processmanager v0.0.0-20230818213616-f204007f963c - github.com/mudler/yip v1.5.0 + github.com/mudler/yip v1.5.1-0.20240410092330-4ebbc7582ee9 github.com/nxadm/tail v1.4.11 github.com/onsi/ginkgo/v2 v2.15.0 github.com/onsi/gomega v1.31.1 @@ -37,9 +37,9 @@ require ( github.com/spf13/viper v1.18.2 github.com/twpayne/go-vfs/v4 v4.3.0 // v5 requires go1.20 github.com/urfave/cli/v2 v2.27.1 - golang.org/x/net v0.19.0 + golang.org/x/net v0.21.0 golang.org/x/oauth2 v0.15.0 - golang.org/x/sys v0.17.0 + golang.org/x/sys v0.18.0 gopkg.in/yaml.v3 v3.0.1 k8s.io/mount-utils v0.27.4 ) @@ -110,7 +110,7 @@ require ( github.com/hashicorp/hcl v1.0.0 // indirect github.com/huandu/xstrings v1.3.3 // indirect github.com/imdario/mergo v0.3.15 // indirect - github.com/itchyny/gojq v0.12.13 // indirect + github.com/itchyny/gojq v0.12.15 // indirect github.com/itchyny/timefmt-go v0.1.5 // indirect github.com/jaypipes/pcidb v1.0.0 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect @@ -155,7 +155,7 @@ require ( github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect github.com/qeesung/image2ascii v1.0.1 // indirect github.com/rancher-sandbox/linuxkit v1.0.2 // indirect - github.com/rivo/uniseg v0.4.4 // indirect + github.com/rivo/uniseg v0.4.7 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect @@ -196,12 +196,12 @@ require ( go.opencensus.io v0.24.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.9.0 // indirect - golang.org/x/crypto v0.17.0 // indirect + golang.org/x/crypto v0.21.0 // indirect golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect golang.org/x/image v0.0.0-20191206065243-da761ea9ff43 // indirect golang.org/x/mod v0.14.0 // indirect golang.org/x/sync v0.5.0 // indirect - golang.org/x/term v0.15.0 // indirect + golang.org/x/term v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/tools v0.16.1 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect diff --git a/go.sum b/go.sum index 044d98b6..5a918555 100644 --- a/go.sum +++ b/go.sum @@ -263,8 +263,8 @@ github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM= github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/itchyny/gojq v0.12.13 h1:IxyYlHYIlspQHHTE0f3cJF0NKDMfajxViuhBLnHd/QU= -github.com/itchyny/gojq v0.12.13/go.mod h1:JzwzAqenfhrPUuwbmEz3nu3JQmFLlQTQMUcOdnu/Sf4= +github.com/itchyny/gojq v0.12.15 h1:WC1Nxbx4Ifw5U2oQWACYz32JK8G9qxNtHzrvW4KEcqI= +github.com/itchyny/gojq v0.12.15/go.mod h1:uWAHCbCIla1jiNxmeT5/B5mOjSdfkCq6p8vxWg+BM10= github.com/itchyny/timefmt-go v0.1.5 h1:G0INE2la8S6ru/ZI5JecgyzbbJNs5lG1RcBqa7Jm6GE= github.com/itchyny/timefmt-go v0.1.5/go.mod h1:nEP7L+2YmAbT2kZ2HfSs1d8Xtw9LY8D2stDBckWakZ8= github.com/jaypipes/ghw v0.12.0 h1:xU2/MDJfWmBhJnujHY9qwXQLs3DBsf0/Xa9vECY0Tho= @@ -369,8 +369,8 @@ github.com/mudler/go-pluggable v0.0.0-20230126220627-7710299a0ae5 h1:FaZD86+A9mV github.com/mudler/go-pluggable v0.0.0-20230126220627-7710299a0ae5/go.mod h1:WmKcT8ONmhDQIqQ+HxU+tkGWjzBEyY/KFO8LTGCu4AI= github.com/mudler/go-processmanager v0.0.0-20230818213616-f204007f963c h1:CI5uGwqBpN8N7BrSKC+nmdfw+9nPQIDyjHHlaIiitZI= github.com/mudler/go-processmanager v0.0.0-20230818213616-f204007f963c/go.mod h1:gY3wyrhkRySJtmtI/JPt4a2mKv48h/M9pEZIW+SjeC0= -github.com/mudler/yip v1.5.0 h1:DYVPUVTVREagw7vsYmKmQQNtraEOn7vVzhYXRpI/+UE= -github.com/mudler/yip v1.5.0/go.mod h1:ncgrjuJ2fIXt0LEvHiS6TghRyjgzMd/lbYMZ3MfGMAc= +github.com/mudler/yip v1.5.1-0.20240410092330-4ebbc7582ee9 h1:mqOZgOZtwn4T22fiDfEmi9NcizjT/sv8wk6NJ6sHf8U= +github.com/mudler/yip v1.5.1-0.20240410092330-4ebbc7582ee9/go.mod h1:xFxM0w7EVNxIC/Z/RsdPf3JVvii6L4UwOFd41beMi3I= github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI= github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo= github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA= @@ -462,8 +462,8 @@ github.com/rancher-sandbox/linuxkit v1.0.2 h1:mUFPL2Mgl1XZ5H82ABR57t5H2G2Qd+lu3g github.com/rancher-sandbox/linuxkit v1.0.2/go.mod h1:n6Fkjc5qoMeWrnLSA5oqUF8ZzFKMrM960CtBwfvH1ZM= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= -github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= +github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= +github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= @@ -626,8 +626,8 @@ golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= @@ -667,8 +667,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= -golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.15.0 h1:s8pnnxNVzjWyrvYdFUQq5llS1PX2zhPXmccZv99h7uQ= golang.org/x/oauth2 v0.15.0/go.mod h1:q48ptWNTY5XWf+JNten23lcvHpLJ0ZSxF5ttTHKVCAM= @@ -727,8 +727,8 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -736,8 +736,8 @@ golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuX golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= -golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= +golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= +golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= diff --git a/pkg/config/spec.go b/pkg/config/spec.go index 6f49dda9..8b1196c3 100644 --- a/pkg/config/spec.go +++ b/pkg/config/spec.go @@ -117,6 +117,7 @@ func NewInstallSpec(cfg *Config) (*v1.InstallSpec, error) { Active: activeImg, Recovery: recoveryImg, Passive: passiveImg, + NoFormat: cfg.Install.NoFormat, } // Get the actual source size to calculate the image size and partitions size