From 1e16ddf2510aa70a6b9ec53d626a5603fb599f9e Mon Sep 17 00:00:00 2001 From: Itxaka Date: Mon, 29 Jul 2024 12:56:04 +0200 Subject: [PATCH 1/3] Use diskfs for uki iso build Signed-off-by: Itxaka --- go.mod | 6 +-- go.sum | 86 ---------------------------------- pkg/action/build-uki.go | 100 +++++++++++++++++++++++++++++++++++++--- 3 files changed, 94 insertions(+), 98 deletions(-) diff --git a/go.mod b/go.mod index 882cf64..4c6cb50 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.23.1 require ( github.com/containerd/containerd v1.7.22 + github.com/diskfs/go-diskfs v1.4.1 github.com/foxboron/go-uefi v0.0.0-20240805124652-e2076f0e58ca github.com/foxboron/sbctl v0.0.0-20240526163235-64e649b31c8e github.com/gofrs/uuid v4.4.0+incompatible @@ -56,7 +57,6 @@ require ( github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/cyphar/filepath-securejoin v0.2.4 // indirect github.com/denisbrodbeck/machineid v1.0.1 // indirect - github.com/diskfs/go-diskfs v1.4.1 // indirect github.com/distribution/reference v0.6.0 // indirect github.com/djherbis/times v1.6.0 // indirect github.com/docker/cli v27.1.1+incompatible // indirect @@ -72,7 +72,6 @@ require ( github.com/fatih/color v1.14.1 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect - github.com/ghodss/yaml v1.0.0 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect github.com/go-git/go-billy/v5 v5.5.0 // indirect github.com/go-git/go-git/v5 v5.12.0 // indirect @@ -97,7 +96,6 @@ require ( github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/huandu/xstrings v1.5.0 // indirect - github.com/imdario/mergo v0.3.15 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/ipfs/go-log v1.0.5 // indirect github.com/ipfs/go-log/v2 v2.1.3 // indirect @@ -135,7 +133,6 @@ require ( github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5 // indirect github.com/phayes/permbits v0.0.0-20190612203442-39d7c581d2ee // indirect - github.com/pierrec/lz4 v2.6.1+incompatible // indirect github.com/pierrec/lz4/v4 v4.1.17 // indirect github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/pkg/errors v0.9.1 // indirect @@ -198,7 +195,6 @@ require ( google.golang.org/genproto/googleapis/rpc v0.0.0-20240314234333-6e1732d8331c // indirect google.golang.org/grpc v1.62.1 // indirect google.golang.org/protobuf v1.34.1 // indirect - gopkg.in/djherbis/times.v1 v1.3.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0 // indirect diff --git a/go.sum b/go.sum index e8d2d02..7fdaca0 100644 --- a/go.sum +++ b/go.sum @@ -69,8 +69,6 @@ contrib.go.opencensus.io/exporter/stackdriver v0.13.5/go.mod h1:aXENhDJ1Y4lIg4EU contrib.go.opencensus.io/exporter/stackdriver v0.13.8/go.mod h1:huNtlWx75MwO7qMs0KrMxPZXzNNWebav1Sq/pm02JdQ= contrib.go.opencensus.io/integrations/ocsql v0.1.4/go.mod h1:8DsSdjz3F+APR+0z0WkU1aRorQCFfRxvqjUUPMbF3fE= contrib.go.opencensus.io/resource v0.1.1/go.mod h1:F361eGI91LCmW1I/Saf+rX0+OFcigGlFvXwEGEnkRLA= -dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= -dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s= dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= @@ -104,15 +102,10 @@ github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF0 github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Masterminds/semver/v3 v3.0.3/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= github.com/Masterminds/semver/v3 v3.1.0/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= -github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= -github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= -github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= github.com/Masterminds/semver/v3 v3.3.0 h1:B8LGeaivUe71a5qox1ICM/JLl0NqZSW5CHyL+hmvYS0= github.com/Masterminds/semver/v3 v3.3.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= github.com/Masterminds/sprig v2.15.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= -github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA= -github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM= github.com/Masterminds/sprig/v3 v3.3.0 h1:mQh0Yrg1XPo6vjYXgtf5OtijNAKJRNcTdOOGZe3tPhs= github.com/Masterminds/sprig/v3 v3.3.0/go.mod h1:Zy1iXRYNqNLUolqCpL4uhk6SHUMAOSCzdgBfDb35Lz0= github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= @@ -236,8 +229,6 @@ github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHq github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= github.com/containerd/console v1.0.4-0.20230706203907-8f6c4e4faef5 h1:Ig+OPkE3XQrrl+SKsOqAjlkrBN/zrr+Qpw7rCuDjRCE= github.com/containerd/console v1.0.4-0.20230706203907-8f6c4e4faef5/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk= -github.com/containerd/containerd v1.7.21 h1:USGXRK1eOC/SX0L195YgxTHb0a00anxajOzgfN0qrCA= -github.com/containerd/containerd v1.7.21/go.mod h1:e3Jz1rYRUZ2Lt51YrH9Rz0zPyJBOlSvB3ghr2jbVD8g= github.com/containerd/containerd v1.7.22 h1:nZuNnNRA6T6jB975rx2RRNqqH2k6ELYKDZfqTHqwyy0= github.com/containerd/containerd v1.7.22/go.mod h1:e3Jz1rYRUZ2Lt51YrH9Rz0zPyJBOlSvB3ghr2jbVD8g= github.com/containerd/continuity v0.4.2 h1:v3y/4Yz5jwnvqPKJJ+7Wf93fyWoCB3F5EclWG023MDM= @@ -283,8 +274,6 @@ github.com/devigned/tab v0.1.1/go.mod h1:XG9mPq0dFghrYvoBF3xdRrJzSTX1b7IQrvaL9mz github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= -github.com/diskfs/go-diskfs v1.3.0 h1:D3IVe1y7ybB5SjCO0pOmkWThL9lZEWeanp8rRa0q0sk= -github.com/diskfs/go-diskfs v1.3.0/go.mod h1:3pUpCAz75Q11om5RsGpVKUgXp2Z+ATw1xV500glmCP0= github.com/diskfs/go-diskfs v1.4.1 h1:iODgkzHLmvXS+1VDztpW53T+dQm8GQzi20y9yUd5UCA= github.com/diskfs/go-diskfs v1.4.1/go.mod h1:+tOkQs8CMMog6Nvljg8DGIxEXrgL48iyT3OM3IlSz74= github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= @@ -296,10 +285,6 @@ github.com/docker/cli v27.1.1+incompatible h1:goaZxOqs4QKxznZjjBWKONQci/MywhtRv2 github.com/docker/cli v27.1.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v27.1.2+incompatible h1:AhGzR1xaQIy53qCkxARaFluI00WPGtXn0AJuoQsVYTY= -github.com/docker/docker v27.1.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v27.2.0+incompatible h1:Rk9nIVdfH3+Vz4cyI/uhbINhEZ/oLmc+CBXmH6fbNk4= -github.com/docker/docker v27.2.0+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v27.2.1+incompatible h1:fQdiLfW7VLscyoeYEBz7/J8soYFDZV1u6VW6gJEjNMI= github.com/docker/docker v27.2.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.7.0 h1:xtCHsjxogADNZcdv1pKUHXryefjlVRqWqIhk/uXJp0A= @@ -353,7 +338,6 @@ github.com/foxboron/sbctl v0.0.0-20240526163235-64e649b31c8e h1:X92hfbSXen3W6t7Y github.com/foxboron/sbctl v0.0.0-20240526163235-64e649b31c8e/go.mod h1:/2VaDO9cJIVwJR5XDQogLQEWbTMnVaFq31OEjt66Ju4= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= -github.com/frankban/quicktest v1.13.0/go.mod h1:qLE0fzW0VuyUAJgPU19zByoIr0HtCHN/r/VLSOOIySU= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -363,7 +347,6 @@ github.com/fullstorydev/grpcurl v1.8.0/go.mod h1:Mn2jWbdMrQGJQ8UD62uNyMumT2acsZU github.com/fullstorydev/grpcurl v1.8.1/go.mod h1:3BWhvHZwNO7iLXaQlojdg5NA6SxUDePli4ecpK1N7gw= github.com/fullstorydev/grpcurl v1.8.2/go.mod h1:YvWNT3xRp2KIRuvCphFodG0fKkMXwaxA9CJgKCcyzUQ= github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ= -github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do= @@ -484,7 +467,6 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-containerregistry v0.20.2 h1:B1wPJ1SN/S7pB+ZAimcciVD+r+yV/l/DSArMxlbwseo= @@ -605,9 +587,6 @@ github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSo github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo= github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4= -github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= -github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU= -github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI= github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= @@ -618,9 +597,6 @@ github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1: github.com/imdario/mergo v0.3.4/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -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/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= @@ -634,12 +610,8 @@ github.com/itchyny/gojq v0.12.16/go.mod h1:6abHbdC2uB9ogMS38XsErnfqJ94UlngIJGlRA github.com/itchyny/timefmt-go v0.1.6 h1:ia3s54iciXDdzWzwaVKXZPbiXzxxnv1SPGFfM/myJ5Q= github.com/itchyny/timefmt-go v0.1.6/go.mod h1:RRDZYC5s9ErkjQvTvvU7keJjxUYzIISJGxm9/mAERQg= github.com/jarcoal/httpmock v1.0.5/go.mod h1:ATjnClrvW/3tijVmpL/va5Z3aAyGvqU3gCT8nX0Txik= -github.com/jaypipes/ghw v0.12.0 h1:xU2/MDJfWmBhJnujHY9qwXQLs3DBsf0/Xa9vECY0Tho= -github.com/jaypipes/ghw v0.12.0/go.mod h1:jeJGbkRB2lL3/gxYzNYzEDETV1ZJ56OKr+CSeSEym+g= github.com/jaypipes/ghw v0.13.0 h1:log8MXuB8hzTNnSktqpXMHc0c/2k/WgjOMSUtnI1RV4= github.com/jaypipes/ghw v0.13.0/go.mod h1:In8SsaDqlb1oTyrbmTC14uy+fbBMvp+xdqX51MidlD8= -github.com/jaypipes/pcidb v1.0.0 h1:vtZIfkiCUE42oYbJS0TAq9XSfSmcsgo9IdxSm9qzYU8= -github.com/jaypipes/pcidb v1.0.0/go.mod h1:TnYUvqhPBzCKnH34KrIX22kAeEbDCSRJ9cqLRCuNDfk= github.com/jaypipes/pcidb v1.0.1 h1:WB2zh27T3nwg8AE8ei81sNRb9yWBii3JGNJtT7K9Oic= github.com/jaypipes/pcidb v1.0.1/go.mod h1:6xYUz/yYEyOkIkUt2t2J2folIuZ4Yg6uByCGFXMCeE4= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= @@ -673,28 +645,8 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/kairos-io/go-ukify v0.2.2 h1:gY3iFcula7BnZHH23fvJv91SFhdqvrTb+xhbxSjF9Fo= github.com/kairos-io/go-ukify v0.2.2/go.mod h1:AgMOguzoI9hYZFYA6XA24fEhxY8Tq+7mHKovA3jsTys= -github.com/kairos-io/kairos-agent/v2 v2.13.4 h1:nM7FprcvjfYKFE+pTrk7o729eyvZRknPpRjz1L9Ofy0= -github.com/kairos-io/kairos-agent/v2 v2.13.4/go.mod h1:jL2olRMpUgWHVtSsCZIhShWYuCK2eCwr6f1xOAjJs/A= -github.com/kairos-io/kairos-agent/v2 v2.13.5 h1:WEEU6efzWlsbT6KQNir6h3WmrdVgwGq7kab/xtVNvOs= -github.com/kairos-io/kairos-agent/v2 v2.13.5/go.mod h1:yE4N0jbBUV6maQScBl8KLnmFbbkD+xEUNAzfWF7uGZw= -github.com/kairos-io/kairos-agent/v2 v2.14.0 h1:Xer3EsW5y5HIs8qol582E8BPa8008dttUwcDw12uuRA= -github.com/kairos-io/kairos-agent/v2 v2.14.0/go.mod h1:dPjMFSIKQayYn/0SrowznYZwB5LEGh3TvOwV/Yv+CcU= github.com/kairos-io/kairos-agent/v2 v2.14.1 h1:FhXv7TJ0iIqPrzK+OpMnyU75OmqEW28NXnynR/oIsiY= github.com/kairos-io/kairos-agent/v2 v2.14.1/go.mod h1:OCBg6EXasH6AawXRgehWohZravEFmJXaCWmx7vl774w= -github.com/kairos-io/kairos-sdk v0.4.1 h1:WF+X30URojMxV7AlzVj0uejvPWG4zq1WNga0swAX4dY= -github.com/kairos-io/kairos-sdk v0.4.1/go.mod h1:lgQAYkh0aWIZg4/CQcC+OPQp95ONs2PzkMIcAq8w6OY= -github.com/kairos-io/kairos-sdk v0.4.2-0.20240903105642-a509f9388eb6 h1:auCG/aP/esvKCq1aeeoyqieTMbRO7WHKs4fY05WWXc0= -github.com/kairos-io/kairos-sdk v0.4.2-0.20240903105642-a509f9388eb6/go.mod h1:0ltpn7BODc+ztbee+2y/GfJMW125H1OFqHxSNqgWObE= -github.com/kairos-io/kairos-sdk v0.4.3-0.20240905081210-705fa3ebfa2a h1:zBGCh/ZPeOHdcbZdATg+LPCypdwx+3WzfD4a1TVwCYs= -github.com/kairos-io/kairos-sdk v0.4.3-0.20240905081210-705fa3ebfa2a/go.mod h1:0ltpn7BODc+ztbee+2y/GfJMW125H1OFqHxSNqgWObE= -github.com/kairos-io/kairos-sdk v0.4.3-0.20240905082603-42cf473c006c h1:jJ1KRqVEHN8QodFaA4maYlbygDwCdvSGbROFDDMk4lo= -github.com/kairos-io/kairos-sdk v0.4.3-0.20240905082603-42cf473c006c/go.mod h1:0ltpn7BODc+ztbee+2y/GfJMW125H1OFqHxSNqgWObE= -github.com/kairos-io/kairos-sdk v0.4.3-0.20240905131825-2d092e9edd4d h1:l2YccCeCefd9AnhO8JxgoqWiI/9aqo/knIV+zsBF/ms= -github.com/kairos-io/kairos-sdk v0.4.3-0.20240905131825-2d092e9edd4d/go.mod h1:0ltpn7BODc+ztbee+2y/GfJMW125H1OFqHxSNqgWObE= -github.com/kairos-io/kairos-sdk v0.4.3 h1:gIC/PsWjv9/Z+6RIHRG9IS5MB9gACw1ZjPAi7VydSSo= -github.com/kairos-io/kairos-sdk v0.4.3/go.mod h1:bxUPzirl8vNtqB48FJ2835QKio3d3PrHbkAejkibV8I= -github.com/kairos-io/kairos-sdk v0.4.4 h1:FolUGqpdTnYYdLwFEOND97QEp2H/htVjW7pHUOmtxNI= -github.com/kairos-io/kairos-sdk v0.4.4/go.mod h1:OIJYihhuiUOeBXHYj9V3R381SAgc/EaKrFepcBxGroM= github.com/kairos-io/kairos-sdk v0.4.5 h1:ja3GBPODLPx4X/9dEALncpDIHvFH8TdEBMda0H6O49o= github.com/kairos-io/kairos-sdk v0.4.5/go.mod h1:OIJYihhuiUOeBXHYj9V3R381SAgc/EaKrFepcBxGroM= github.com/kendru/darwin/go/depgraph v0.0.0-20221105232959-877d6a81060c h1:eKb4PqwAMhlqwXw0W3atpKaYaPGlXE/Fwh+xpCEYaPk= @@ -887,11 +839,6 @@ github.com/phayes/permbits v0.0.0-20190612203442-39d7c581d2ee h1:P6U24L02WMfj9ym github.com/phayes/permbits v0.0.0-20190612203442-39d7c581d2ee/go.mod h1:3uODdxMgOaPYeWU7RzZLxVtJHZ/x1f/iHkBZuKJDzuY= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pierrec/lz4 v2.3.0+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pierrec/lz4 v2.6.1+incompatible h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM= -github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pierrec/lz4/v4 v4.1.14 h1:+fL8AQEZtz/ijeNnpduH0bROTu0O3NZAlPjQxGn8LwE= -github.com/pierrec/lz4/v4 v4.1.14/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pierrec/lz4/v4 v4.1.17 h1:kV4Ip+/hUBC+8T6+2EgburRtkE9ef4nbY3f4dFhGjMc= github.com/pierrec/lz4/v4 v4.1.17/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= @@ -901,7 +848,6 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= -github.com/pkg/xattr v0.4.1/go.mod h1:W2cGD0TBEus7MkUgv0tNZ9JutLtVO3cXu+IBRuHqnFs= github.com/pkg/xattr v0.4.9 h1:5883YPCtkSd8LFbs13nXplj9g9tlrwoJRjgpgMu1/fE= github.com/pkg/xattr v0.4.9/go.mod h1:di8WF84zAKk8jzR1UBTEWh9AUlIZZ7M/JNt8e9B6ktU= github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -1009,9 +955,6 @@ github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFt github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU= github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k= -github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= -github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= -github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= @@ -1020,8 +963,6 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= -github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sirupsen/logrus v1.9.4-0.20230606125235-dd1b4c2e81af h1:Sp5TG9f7K39yfB+If0vjp97vuT74F72r8hfRpP8jLU0= github.com/sirupsen/logrus v1.9.4-0.20230606125235-dd1b4c2e81af/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/skeema/knownhosts v1.2.2 h1:Iug2P4fLmDw9f41PB6thxUkNUkJzB5i+1/exaj40L3A= @@ -1046,9 +987,6 @@ github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= -github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w= github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= @@ -1131,7 +1069,6 @@ github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljT github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= github.com/ulikunitz/xz v0.5.7/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= -github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= @@ -1285,11 +1222,8 @@ golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -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.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= -golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1303,10 +1237,6 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8= -golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= -golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 h1:kx6Ds3MlpiUHKj7syVnbp57++8WpuKPcR5yjLBjvLEA= -golang.org/x/exp v0.0.0-20240823005443-9b4947da3948/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= @@ -1393,8 +1323,6 @@ 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.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= -golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1436,7 +1364,6 @@ golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181021155630-eda9bb28ed51/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1529,8 +1456,6 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= -golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -1540,8 +1465,6 @@ 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.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= -golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1557,8 +1480,6 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= -golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1642,8 +1563,6 @@ golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= -golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1820,9 +1739,6 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= -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/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= @@ -1870,8 +1786,6 @@ howett.net/plist v1.0.0 h1:7CrbWYbPPO/PyNy38b2EB/+gYbjCe2DXBxgtOOZbSQM= howett.net/plist v1.0.0/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -k8s.io/mount-utils v0.31.0 h1:o+a+n6gyZ7MGc6bIERU3LeFTHbLDBiVReaDpWlJotUE= -k8s.io/mount-utils v0.31.0/go.mod h1:HV/VYBUGqYUj4vt82YltzpWvgv8FPg0G9ItyInT3NPU= k8s.io/mount-utils v0.31.1 h1:f8UrH9kRynljmdNGM6BaCvFUON5ZPKDgE+ltmYqI4wA= k8s.io/mount-utils v0.31.1/go.mod h1:HV/VYBUGqYUj4vt82YltzpWvgv8FPg0G9ItyInT3NPU= k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A= diff --git a/pkg/action/build-uki.go b/pkg/action/build-uki.go index d02acc5..a52e96b 100644 --- a/pkg/action/build-uki.go +++ b/pkg/action/build-uki.go @@ -2,6 +2,9 @@ package action import ( "fmt" + "github.com/diskfs/go-diskfs/disk" + "github.com/diskfs/go-diskfs/filesystem" + "github.com/diskfs/go-diskfs/filesystem/iso9660" "io" "log/slog" "math" @@ -19,6 +22,7 @@ import ( "github.com/u-root/u-root/pkg/cpio" "golang.org/x/exp/maps" + diskfs "github.com/diskfs/go-diskfs" "github.com/kairos-io/enki/pkg/types" "github.com/kairos-io/enki/pkg/utils" "github.com/kairos-io/go-ukify/pkg/uki" @@ -521,16 +525,98 @@ func (b *BuildUKIAction) createISO(sourceDir string) error { if b.name != "" { isoName = fmt.Sprintf("%s.iso", b.name) } + var LogicalBlocksize diskfs.SectorSize = 2048 + diskSize, err := FolderSize(isoDir) - b.logger.Info("Creating the iso files with xorriso") - cmd := exec.Command("xorriso", "-as", "mkisofs", "-V", "UKI_ISO_INSTALL", "-isohybrid-gpt-basdat", - "-e", filepath.Base(imgFile), "-no-emul-boot", "-o", filepath.Join(b.outputDir, isoName), isoDir) - out, err := cmd.CombinedOutput() + mydisk, err := diskfs.Create(isoName, diskSize, diskfs.Raw, LogicalBlocksize) + + fspec := disk.FilesystemSpec{Partition: 0, FSType: filesystem.TypeISO9660, VolumeLabel: "EFI"} + fs, err := mydisk.CreateFilesystem(fspec) + + b.logger.Info("Creating the iso files with") + // Walk the source folder to copy all files and folders to the ISO filesystem + err = filepath.Walk(isoDir, func(path string, info os.FileInfo, err error) error { + if err != nil { + return fmt.Errorf("error creating iso file: %w", err) + } + + relPath, err := filepath.Rel(isoDir, path) + if err != nil { + return fmt.Errorf("error creating iso file: %w", err) + } + + // If the current path is a folder, create the folder in the ISO filesystem + if info.IsDir() { + // Create the directory in the ISO file + err = fs.Mkdir(relPath) + if err != nil { + return fmt.Errorf("error creating iso file: %w", err) + } + return nil + } + + // If the current path is a file, copy the file to the ISO filesystem + if !info.IsDir() { + // Open the file in the ISO file for writing + rw, err := fs.OpenFile(relPath, os.O_CREATE|os.O_RDWR) + if err != nil { + return fmt.Errorf("error creating iso file: %w", err) + } + + // Open the source file for reading + in, errorOpeningFile := os.Open(path) + if errorOpeningFile != nil { + return errorOpeningFile + } + defer in.Close() + + // Copy the contents of the source file to the ISO file + _, err = io.Copy(rw, in) + if err != nil { + return fmt.Errorf("error creating iso file: %w", err) + } + } + + return nil + }) if err != nil { - return fmt.Errorf("error creating iso file: %w\n%s", err, string(out)) - } + return fmt.Errorf("error creating iso file: %w", err) + } + iso, ok := fs.(*iso9660.FileSystem) + if !ok { + return fmt.Errorf("not an iso9660 filesystem") + } + + err = iso.Finalize(iso9660.FinalizeOptions{ + VolumeIdentifier: "UKI_ISO_INSTALL", + RockRidge: true, + ElTorito: &iso9660.ElTorito{ + HideBootCatalog: true, + Entries: []*iso9660.ElToritoEntry{ + { + Platform: iso9660.EFI, + Emulation: iso9660.NoEmulation, + BootFile: "efiboot.img", + }, + }, + }, + }) - return nil + return err +} + +func FolderSize(path string) (int64, error) { + var size int64 + err := filepath.Walk(path, func(_ string, info os.FileInfo, err error) error { + if err != nil { + return err + } + if !info.IsDir() { + size += info.Size() + } + return err + }) + return size, err } func (b *BuildUKIAction) createContainer(sourceDir, version string) error { From 0cb5c1c20d1d9a87a51f77b61dc6aea67628ddf7 Mon Sep 17 00:00:00 2001 From: Itxaka Date: Tue, 30 Jul 2024 17:15:58 +0200 Subject: [PATCH 2/3] test Signed-off-by: Itxaka --- Dockerfile | 2 +- pkg/action/build-uki.go | 199 ++++++++++++++++++++-------------------- 2 files changed, 98 insertions(+), 103 deletions(-) diff --git a/Dockerfile b/Dockerfile index 01f034d..31c53db 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,7 +35,7 @@ RUN cp /tmp/luet-${TARGETARCH}.yaml /etc/luet/luet.yaml ## Uki artifacts, will be set under the /usr/kairos directory RUN luet install -y system/systemd-boot -RUN dnf install -y binutils mtools efitools shim openssl dosfstools xorriso rsync +RUN dnf install -y binutils mtools efitools shim openssl dosfstools rsync # for sysext creation RUN dnf install -y erofs-utils diff --git a/pkg/action/build-uki.go b/pkg/action/build-uki.go index a52e96b..c4af969 100644 --- a/pkg/action/build-uki.go +++ b/pkg/action/build-uki.go @@ -5,11 +5,11 @@ import ( "github.com/diskfs/go-diskfs/disk" "github.com/diskfs/go-diskfs/filesystem" "github.com/diskfs/go-diskfs/filesystem/iso9660" + "github.com/diskfs/go-diskfs/partition/gpt" "io" "log/slog" "math" "os" - "os/exec" "path/filepath" "regexp" "sort" @@ -261,21 +261,6 @@ func (b *BuildUKIAction) extractImage() (string, error) { } func (b *BuildUKIAction) checkDeps() error { - neededBinaries := []string{ - "dd", - "mkfs.msdos", - "mmd", - "mcopy", - "xorriso", - } - - for _, b := range neededBinaries { - _, err := exec.LookPath(b) - if err != nil { - return err - } - } - neededFiles, err := b.getEfiNeededFiles() if err != nil { return err @@ -466,7 +451,7 @@ func (b *BuildUKIAction) createConfFiles(sourceDir, cmdline, title, finalEfiName } func (b *BuildUKIAction) createISO(sourceDir string) error { - // isoDir is where we generate the img file. We pass this dir to xorriso. + isoDir, err := os.MkdirTemp("", "enki-iso-dir-") if err != nil { return err @@ -484,25 +469,76 @@ func (b *BuildUKIAction) createISO(sourceDir string) error { return err } - // Create just the size we need + 50MB just in case - imgSize := artifactSize + 50 imgFile := filepath.Join(isoDir, "efiboot.img") - b.logger.Info(fmt.Sprintf("Creating the img file with size: %dMb", imgSize)) - if err = createImgWithSize(imgFile, imgSize); err != nil { + + var ( + espSize int64 = (artifactSize + 50) * 1024 * 1024 // 100 MB + diskSize int64 = espSize + 4*1024*1024 // 104 MB + partitionStart int64 = 2048 + partitionSectors int64 = espSize / 512 + partitionEnd int64 = partitionSectors - partitionStart + 1 + ) + + efidisk, err := diskfs.Create(imgFile, diskSize, diskfs.Raw, diskfs.SectorSizeDefault) + if err != nil { + b.logger.Warnf("Error creating image file %s: %s", imgFile, err) + return err + } + table := &gpt.Table{ + Partitions: []*gpt.Partition{ + {Start: uint64(partitionStart), End: uint64(partitionEnd), Type: gpt.EFISystemPartition, Name: "EFI System"}, + }, + } + err = efidisk.Partition(table) + if err != nil { + b.logger.Warnf("Error creating partition: %s", err) + return err + } + fs, err := efidisk.CreateFilesystem(disk.FilesystemSpec{Partition: 1, FSType: filesystem.TypeFat32}) + if err != nil { + b.logger.Warnf("Error creating fs: %s", err) return err } - defer os.Remove(imgFile) b.logger.Info(fmt.Sprintf("Created image: %s", imgFile)) b.logger.Info("Creating directories in the img file") - if err := createImgDirs(imgFile, filesMap); err != nil { - return err + dirs := maps.Keys(filesMap) + sort.Strings(dirs) // Make sure we create outer dirs first + for _, dir := range dirs { + err = fs.Mkdir(dir) + if err != nil { + b.logger.Warnf("Error crating dir %s: %s", dir, err) + return err + } } b.logger.Info("Copying files in the img file") - if err := copyFilesToImg(imgFile, filesMap); err != nil { - return err + for dir, files := range filesMap { + for _, f := range files { + b.logger.Debugf("Copying file: %s", f) + _, err := os.Stat(f) + if err != nil { + b.logger.Warnf("Couldn't find file: %s", f) + continue + } + fileRead, err := os.ReadFile(f) + if err != nil { + return err + } + rw, err := fs.OpenFile(filepath.Join(dir, filepath.Base(f)), os.O_CREATE|os.O_RDWR) + if err != nil { + b.logger.Errorf("Error creating file %s: %s", filepath.Join(dir, filepath.Base(f)), err) + return err + } + _, err = rw.Write(fileRead) + if err != nil { + b.logger.Errorf("Error writing file %s: %s", filepath.Join(dir, filepath.Base(f)), err) + return err + } + b.logger.Debugf("Copied file: %s", f) + + } } if viper.GetString("overlay-iso") != "" { @@ -521,36 +557,45 @@ func (b *BuildUKIAction) createISO(sourceDir string) error { } + // ISO building isoName := fmt.Sprintf("kairos_%s.iso", b.version) if b.name != "" { isoName = fmt.Sprintf("%s.iso", b.name) } - var LogicalBlocksize diskfs.SectorSize = 2048 - diskSize, err := FolderSize(isoDir) - - mydisk, err := diskfs.Create(isoName, diskSize, diskfs.Raw, LogicalBlocksize) - fspec := disk.FilesystemSpec{Partition: 0, FSType: filesystem.TypeISO9660, VolumeLabel: "EFI"} - fs, err := mydisk.CreateFilesystem(fspec) + isoSize, err := FolderSize(isoDir) + if err != nil { + return fmt.Errorf("error checking size: %w", err) + } + _ = os.RemoveAll(filepath.Join(b.outputDir, isoName)) + mydisk, err := diskfs.Create(filepath.Join(b.outputDir, isoName), isoSize, diskfs.Raw, 2048) + if err != nil { + return fmt.Errorf("error creating output iso file %s: %w", filepath.Join(b.outputDir, isoName), err) + } + isoFs, err := mydisk.CreateFilesystem(disk.FilesystemSpec{Partition: 0, FSType: filesystem.TypeISO9660, VolumeLabel: "UKI_ISO_INSTALL"}) + if err != nil { + return fmt.Errorf("error creating filesystem: %w", err) + } - b.logger.Info("Creating the iso files with") + b.logger.Info("Copying file to final iso") // Walk the source folder to copy all files and folders to the ISO filesystem - err = filepath.Walk(isoDir, func(path string, info os.FileInfo, err error) error { + err = filepath.WalkDir(isoDir, func(path string, info os.DirEntry, err error) error { if err != nil { return fmt.Errorf("error creating iso file: %w", err) } + b.logger.Infof("Doing path %s", path) relPath, err := filepath.Rel(isoDir, path) if err != nil { - return fmt.Errorf("error creating iso file: %w", err) + return fmt.Errorf("error getting relpath of %s: %w", path, err) } // If the current path is a folder, create the folder in the ISO filesystem if info.IsDir() { // Create the directory in the ISO file - err = fs.Mkdir(relPath) + err = isoFs.Mkdir(relPath) if err != nil { - return fmt.Errorf("error creating iso file: %w", err) + return fmt.Errorf("error creating dir %s: %w", relPath, err) } return nil } @@ -558,9 +603,9 @@ func (b *BuildUKIAction) createISO(sourceDir string) error { // If the current path is a file, copy the file to the ISO filesystem if !info.IsDir() { // Open the file in the ISO file for writing - rw, err := fs.OpenFile(relPath, os.O_CREATE|os.O_RDWR) + rw, err := isoFs.OpenFile(relPath, os.O_CREATE|os.O_RDWR) if err != nil { - return fmt.Errorf("error creating iso file: %w", err) + return fmt.Errorf("error opening file %s: %w", relPath, err) } // Open the source file for reading @@ -573,7 +618,7 @@ func (b *BuildUKIAction) createISO(sourceDir string) error { // Copy the contents of the source file to the ISO file _, err = io.Copy(rw, in) if err != nil { - return fmt.Errorf("error creating iso file: %w", err) + return fmt.Errorf("error copying file: %w", err) } } @@ -582,7 +627,7 @@ func (b *BuildUKIAction) createISO(sourceDir string) error { if err != nil { return fmt.Errorf("error creating iso file: %w", err) } - iso, ok := fs.(*iso9660.FileSystem) + iso, ok := isoFs.(*iso9660.FileSystem) if !ok { return fmt.Errorf("not an iso9660 filesystem") } @@ -591,12 +636,11 @@ func (b *BuildUKIAction) createISO(sourceDir string) error { VolumeIdentifier: "UKI_ISO_INSTALL", RockRidge: true, ElTorito: &iso9660.ElTorito{ - HideBootCatalog: true, Entries: []*iso9660.ElToritoEntry{ { Platform: iso9660.EFI, Emulation: iso9660.NoEmulation, - BootFile: "efiboot.img", + BootFile: "/efiboot.img", }, }, }, @@ -702,14 +746,14 @@ func (b *BuildUKIAction) imageFiles(sourceDir string) (map[string][]string, erro // the keys are the target dirs // the values are the source files that should be copied into the target dir data := map[string][]string{ - "EFI": {}, - "EFI/BOOT": {filepath.Join(sourceDir, "BOOTX64.EFI")}, - "EFI/kairos": {}, - "EFI/tools": {}, - "loader": {filepath.Join(sourceDir, "loader.conf")}, - "loader/entries": {}, - "loader/keys": {}, - "loader/keys/auto": { + "/EFI": {}, + "/EFI/BOOT": {filepath.Join(sourceDir, "BOOTX64.EFI")}, + "/EFI/kairos": {}, + "/EFI/tools": {}, + "/loader": {filepath.Join(sourceDir, "loader.conf")}, + "/loader/entries": {}, + "/loader/keys": {}, + "/loader/keys/auto": { filepath.Join(b.keysDirectory, "PK.der"), filepath.Join(b.keysDirectory, "KEK.der"), filepath.Join(b.keysDirectory, "db.der"), @@ -720,8 +764,8 @@ func (b *BuildUKIAction) imageFiles(sourceDir string) (map[string][]string, erro // Add the kairos efi files and the loader conf files for each cmdline entries := append(utils.GetUkiCmdline(), utils.GetUkiSingleCmdlines(b.logger)...) for _, entry := range entries { - data["EFI/kairos"] = append(data["EFI/kairos"], filepath.Join(sourceDir, entry.FileName+".efi")) - data["loader/entries"] = append(data["loader/entries"], filepath.Join(sourceDir, entry.FileName+".conf")) + data["/EFI/kairos"] = append(data["/EFI/kairos"], filepath.Join(sourceDir, entry.FileName+".efi")) + data["/loader/entries"] = append(data["/loader/entries"], filepath.Join(sourceDir, entry.FileName+".conf")) } return data, nil } @@ -783,20 +827,6 @@ func (b *BuildUKIAction) cleanSource(dir string) { // TODO: there should be a copy of the kernel at /usrt/lib/modules/VERSION/kernel/vmlinuz that we may also want to remove } -func copyFilesToImg(imgFile string, filesMap map[string][]string) error { - for dir, files := range filesMap { - for _, f := range files { - cmd := exec.Command("mcopy", "-i", imgFile, f, filepath.Join(fmt.Sprintf("::%s", dir), filepath.Base(f))) - out, err := cmd.CombinedOutput() - if err != nil { - return fmt.Errorf("copying %s in img file: %w\n%s", f, err, string(out)) - } - } - } - - return nil -} - func ZstdFile(sourcePath, targetPath string) error { inputFile, err := os.Open(sourcePath) if err != nil { @@ -839,20 +869,6 @@ func findKairosVersion(sourceDir string) (string, error) { return match[1], nil } -func createImgWithSize(imgFile string, size int64) error { - cmd := exec.Command("dd", - "if=/dev/zero", fmt.Sprintf("of=%s", imgFile), - "bs=1M", fmt.Sprintf("count=%d", size), - ) - - out, err := cmd.CombinedOutput() - if err != nil { - return fmt.Errorf("creating the img file: %w\n%s", err, out) - } - - return nil -} - func sumFileSizes(filesMap map[string][]string) (int64, error) { total := int64(0) for _, files := range maps.Values(filesMap) { @@ -869,24 +885,3 @@ func sumFileSizes(filesMap map[string][]string) (int64, error) { return totalInMB, nil } - -func createImgDirs(imgFile string, filesMap map[string][]string) error { - cmd := exec.Command("mkfs.msdos", "-F", "32", imgFile) - out, err := cmd.CombinedOutput() - if err != nil { - return fmt.Errorf("formating the img file to fat: %w\n%s", err, string(out)) - } - - dirs := maps.Keys(filesMap) - sort.Strings(dirs) // Make sure we create outer dirs first - for _, dir := range dirs { - // Dirs in MSDOS are marked with ::DIR - cmd := exec.Command("mmd", "-i", imgFile, fmt.Sprintf("::%s", dir)) - out, err := cmd.CombinedOutput() - if err != nil { - return fmt.Errorf("creating directory %s on the img file: %w\n%s\nThe failed command was: %s", dir, err, string(out), cmd.String()) - } - } - - return nil -} From f8bef6bea4d86bdffd4b446a0fe5ad5786ef5cc3 Mon Sep 17 00:00:00 2001 From: Itxaka Date: Thu, 19 Sep 2024 22:14:55 +0200 Subject: [PATCH 3/3] sdf Signed-off-by: Itxaka --- Dockerfile | 4 +- cmd/build-iso.go | 4 + pkg/action/build-iso.go | 292 +++++++++++++++++++++++++++++----------- pkg/action/build-uki.go | 7 +- 4 files changed, 227 insertions(+), 80 deletions(-) diff --git a/Dockerfile b/Dockerfile index 31c53db..f2b0712 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,8 +34,10 @@ RUN mkdir -p /etc/luet/ RUN cp /tmp/luet-${TARGETARCH}.yaml /etc/luet/luet.yaml ## Uki artifacts, will be set under the /usr/kairos directory RUN luet install -y system/systemd-boot +RUN luet install -y livecd/grub2 --system-target /grub2 +RUN luet install -y livecd/grub2-efi-image --system-target /efi -RUN dnf install -y binutils mtools efitools shim openssl dosfstools rsync +RUN dnf install -y binutils efitools shim openssl rsync # for sysext creation RUN dnf install -y erofs-utils diff --git a/cmd/build-iso.go b/cmd/build-iso.go index d4259a2..9578de6 100644 --- a/cmd/build-iso.go +++ b/cmd/build-iso.go @@ -32,6 +32,10 @@ func NewBuildISOCmd() *cobra.Command { flags := cmd.Flags() + if cfg.Name == "" { + cfg.Name = "enki" + } + // Set this after parsing of the flags, so it fails on parsing and prints usage properly cmd.SilenceUsage = true cmd.SilenceErrors = true // Do not propagate errors down the line, we control them diff --git a/pkg/action/build-iso.go b/pkg/action/build-iso.go index 0ebf9de..5ef7a99 100644 --- a/pkg/action/build-iso.go +++ b/pkg/action/build-iso.go @@ -2,6 +2,14 @@ package action import ( "fmt" + "github.com/diskfs/go-diskfs" + "github.com/diskfs/go-diskfs/disk" + "github.com/diskfs/go-diskfs/filesystem" + "github.com/diskfs/go-diskfs/filesystem/iso9660" + "github.com/kairos-io/kairos-agent/v2/pkg/elemental" + v1 "github.com/kairos-io/kairos-agent/v2/pkg/types/v1" + "io" + "os" "path/filepath" "strings" "time" @@ -9,9 +17,8 @@ import ( "github.com/kairos-io/enki/pkg/constants" "github.com/kairos-io/enki/pkg/types" "github.com/kairos-io/enki/pkg/utils" - "github.com/kairos-io/kairos-agent/v2/pkg/elemental" - v1 "github.com/kairos-io/kairos-agent/v2/pkg/types/v1" sdk "github.com/kairos-io/kairos-sdk/utils" + "github.com/twpayne/go-vfs/v5" ) type BuildISOAction struct { @@ -35,6 +42,8 @@ func NewBuildISOAction(cfg *types.BuildConfig, spec *types.LiveISO, opts ...Buil } // ISORun will install the system from a given configuration +// Rootdir is where the files are in that end up in the iso +// isoDir is where the final image will be? func (b *BuildISOAction) ISORun() (err error) { cleanup := sdk.NewCleanStack() defer func() { err = cleanup.Cleanup(err) }() @@ -51,12 +60,6 @@ func (b *BuildISOAction) ISORun() (err error) { return err } - uefiDir := filepath.Join(isoTmpDir, "uefi") - err = utils.MkdirAll(b.cfg.Fs, uefiDir, constants.DirPerm) - if err != nil { - return err - } - isoDir := filepath.Join(isoTmpDir, "iso") err = utils.MkdirAll(b.cfg.Fs, isoDir, constants.DirPerm) if err != nil { @@ -90,12 +93,18 @@ func (b *BuildISOAction) ISORun() (err error) { return err } - err = b.prepareISORoot(isoDir, rootDir, uefiDir) + err = b.prepareISORoot(isoDir, rootDir) if err != nil { b.cfg.Logger.Errorf("Failed preparing ISO's root tree: %v", err) return err } + err = b.CreateEfiImage(rootDir, isoDir) + if err != nil { + b.cfg.Logger.Errorf("Failed filling EFI directory: %v", err) + return err + } + b.cfg.Logger.Infof("Creating ISO image...") err = b.burnISO(isoDir) if err != nil { @@ -106,8 +115,66 @@ func (b *BuildISOAction) ISORun() (err error) { return err } -func (b BuildISOAction) prepareISORoot(isoDir string, rootDir string, uefiDir string) error { - kernel, initrd, err := b.e.FindKernelInitrd(rootDir) +func FindKernelInitrd(rootDir string) (kernel string, initrd string, err error) { + kernelNames := []string{"uImage", "Image", "zImage", "vmlinuz", "image"} + initrdNames := []string{"initrd", "initramfs"} + kernel, err = FindFileWithPrefix(vfs.OSFS, filepath.Join(rootDir, "boot"), kernelNames...) + if err != nil { + fmt.Println("No Kernel file found") + return "", "", err + } + initrd, err = FindFileWithPrefix(vfs.OSFS, filepath.Join(rootDir, "boot"), initrdNames...) + if err != nil { + fmt.Println("No initrd file found") + return "", "", err + } + return kernel, initrd, nil +} + +func FindFileWithPrefix(fs vfs.FS, path string, prefixes ...string) (string, error) { + files, err := fs.ReadDir(path) + if err != nil { + return "", err + } + for _, f := range files { + if f.IsDir() { + continue + } + for _, p := range prefixes { + if strings.HasPrefix(f.Name(), p) { + info, _ := f.Info() + if info.Mode()&os.ModeSymlink == os.ModeSymlink { + found, err := fs.Readlink(filepath.Join(path, f.Name())) + if err == nil { + if !filepath.IsAbs(found) { + found = filepath.Join(path, found) + } + if exists, _ := Exists(fs, found); exists { + return found, nil + } + } + } else { + return filepath.Join(path, f.Name()), nil + } + } + } + } + return "", fmt.Errorf("No file found with prefixes: %v", prefixes) +} + +func Exists(fs vfs.FS, path string) (bool, error) { + _, err := fs.Stat(path) + if err == nil { + return true, nil + } + if os.IsNotExist(err) { + return false, nil + } + return false, err +} + +func (b BuildISOAction) prepareISORoot(isoDir string, rootDir string) error { + kernel, initrd, err := FindKernelInitrd(rootDir) if err != nil { b.cfg.Logger.Error("Could not find kernel and/or initrd") return err @@ -129,12 +196,6 @@ func (b BuildISOAction) prepareISORoot(isoDir string, rootDir string, uefiDir st return err } - b.cfg.Logger.Info("Creating EFI image...") - err = b.createEFI(rootDir, isoDir) - if err != nil { - return err - } - b.cfg.Logger.Info("Creating squashfs...") err = utils.CreateSquashFS(b.cfg.Runner, b.cfg.Logger, rootDir, filepath.Join(isoDir, constants.IsoRootFile), constants.GetDefaultSquashfsOptions()) if err != nil { @@ -144,26 +205,19 @@ func (b BuildISOAction) prepareISORoot(isoDir string, rootDir string, uefiDir st return nil } -// createEFI creates the EFI image that is used for booting +// CreateEfiImage copies the needed EFI files from rootdir and creeate an image in the isodir // it searches the rootfs for the shim/grub.efi file and copies it into a directory with the proper EFI structure // then it generates a grub.cfg that chainloads into the grub.cfg of the livecd (which is the normal livecd grub config from luet packages) -// then it calculates the size of the EFI image based on the files copied and creates the image -func (b BuildISOAction) createEFI(rootdir string, isoDir string) error { +func (b BuildISOAction) CreateEfiImage(rootdir string, isoDir string) error { var err error - // rootfs /efi dir - img := filepath.Join(isoDir, constants.IsoEFIPath) temp, _ := utils.TempDir(b.cfg.Fs, "", "enki-iso") + err = utils.MkdirAll(b.cfg.Fs, filepath.Join(temp, constants.EfiBootPath), constants.DirPerm) if err != nil { b.cfg.Logger.Errorf("Failed creating temp efi dir: %v", err) return err } - err = utils.MkdirAll(b.cfg.Fs, filepath.Join(isoDir, constants.EfiBootPath), constants.DirPerm) - if err != nil { - b.cfg.Logger.Errorf("Failed creating iso efi dir: %v", err) - return err - } err = b.copyShim(temp, rootdir) if err != nil { @@ -179,7 +233,8 @@ func (b BuildISOAction) createEFI(rootdir string, isoDir string) error { // Its read from the root of the livecd, so we need to copy it into /EFI/BOOT/grub.cfg // This is due to the hybrid bios/efi boot mode of the livecd // the uefi.img is loaded into memory and run, but grub only sees the livecd root - err = b.cfg.Fs.WriteFile(filepath.Join(isoDir, constants.EfiBootPath, constants.GrubCfg), []byte(constants.GrubEfiCfg), constants.FilePerm) + os.MkdirAll(filepath.Join(filepath.Join(temp, constants.EfiBootPath)), constants.DirPerm) + err = b.cfg.Fs.WriteFile(filepath.Join(temp, constants.EfiBootPath, constants.GrubCfg), []byte(constants.GrubEfiCfg), constants.FilePerm) if err != nil { b.cfg.Logger.Errorf("Failed writing grub.cfg: %v", err) return err @@ -194,54 +249,47 @@ func (b BuildISOAction) createEFI(rootdir string, isoDir string) error { b.cfg.Logger.Infof("Detected Flavor: %s", flavor) if err == nil && strings.Contains(strings.ToLower(flavor), "ubuntu") { b.cfg.Logger.Infof("Ubuntu based ISO detected, copying grub.cfg to /EFI/ubuntu/grub.cfg") - err = utils.MkdirAll(b.cfg.Fs, filepath.Join(isoDir, "EFI/ubuntu/"), constants.DirPerm) + err = utils.MkdirAll(b.cfg.Fs, filepath.Join(temp, "EFI/ubuntu/"), constants.DirPerm) if err != nil { b.cfg.Logger.Errorf("Failed writing grub.cfg: %v", err) return err } - err = b.cfg.Fs.WriteFile(filepath.Join(isoDir, "EFI/ubuntu/", constants.GrubCfg), []byte(constants.GrubEfiCfg), constants.FilePerm) + err = b.cfg.Fs.WriteFile(filepath.Join(temp, "EFI/ubuntu/", constants.GrubCfg), []byte(constants.GrubEfiCfg), constants.FilePerm) if err != nil { b.cfg.Logger.Errorf("Failed writing grub.cfg: %v", err) return err } } - // Calculate EFI image size based on artifacts - efiSize, err := utils.DirSize(b.cfg.Fs, temp) - if err != nil { - return err - } - // align efiSize to the next 4MB slot - align := int64(4 * 1024 * 1024) - efiSizeMB := (efiSize/align*align + align) / (1024 * 1024) - // Create the actual efi image - err = b.e.CreateFileSystemImage(&v1.Image{ - File: img, - Size: uint(efiSizeMB), - FS: constants.EfiFs, - Label: constants.EfiLabel, - }) - if err != nil { - return err - } - b.cfg.Logger.Debugf("EFI image created at %s", img) - // copy the files from the temporal efi dir into the EFI image - files, err := b.cfg.Fs.ReadDir(temp) - if err != nil { - return err - } - - for _, f := range files { - // This copies the efi files into the efi img used for the boot - b.cfg.Logger.Debugf("Copying %s to %s", filepath.Join(temp, f.Name()), img) - _, err = b.cfg.Runner.Run("mcopy", "-s", "-i", img, filepath.Join(temp, f.Name()), "::") - if err != nil { - b.cfg.Logger.Errorf("Failed copying %s to %s: %v", filepath.Join(temp, f.Name()), img, err) - return err - } - } + // Now create an efi image at the constants.IsoEFIPath in the final isoDir return nil + + // Calculate EFI image size based on artifacts + //efiSize, err := utils.DirSize(b.cfg.Fs, temp) + //if err != nil { + // return err + //} + // align efiSize to the next 4MB slot + //align := int64(4 * 1024 * 1024) + //efiSizeMB := (efiSize/align*align + align) / (1024 * 1024) + + //files, err := b.cfg.Fs.ReadDir(temp) + //if err != nil { + // return err + //} + + //for _, f := range files { + // This copies the efi files into the efi img used for the boot + // b.cfg.Logger.Debugf("Copying %s", filepath.Join(temp, f.Name())) + //_, err = b.cfg.Runner.Run("mcopy", "-s", "-i", img, filepath.Join(temp, f.Name()), "::") + //if err != nil { + // b.cfg.Logger.Errorf("Failed copying %s to %s: %v", filepath.Join(temp, f.Name()), img, err) + // return err + //} + //} + + //return nil } // copyShim copies the shim files into the EFI partition @@ -375,18 +423,17 @@ func (b BuildISOAction) copyGrub(tempdir, rootdir string) error { } func (b BuildISOAction) burnISO(root string) error { - cmd := "xorriso" var outputFile string - var isoFileName string + var isoName string if b.cfg.Date { currTime := time.Now() - isoFileName = fmt.Sprintf("%s.%s.iso", b.cfg.Name, currTime.Format("20060102")) + isoName = fmt.Sprintf("%s.%s.iso", b.cfg.Name, currTime.Format("20060102")) } else { - isoFileName = fmt.Sprintf("%s.iso", b.cfg.Name) + isoName = fmt.Sprintf("%s.iso", b.cfg.Name) } - outputFile = isoFileName + outputFile = isoName if b.cfg.OutDir != "" { outputFile = filepath.Join(b.cfg.OutDir, outputFile) } @@ -399,23 +446,114 @@ func (b BuildISOAction) burnISO(root string) error { } } - args := []string{ - "-volid", b.spec.Label, "-joliet", "on", "-padding", "0", - "-outdev", outputFile, "-map", root, "/", "-chmod", "0755", "--", + // Get size of first partition + isoSize, err := FolderSize(root) + if err != nil { + return fmt.Errorf("error checking size: %w", err) } - args = append(args, constants.GetXorrisoBooloaderArgs(root)...) - out, err := b.cfg.Runner.Run(cmd, args...) - b.cfg.Logger.Debugf("Xorriso: %s", string(out)) + mydisk, err := diskfs.Create(outputFile, isoSize, diskfs.Raw, diskfs.SectorSizeDefault) if err != nil { - return err + return fmt.Errorf("error creating output iso file %s: %w", filepath.Join(outputFile, isoName), err) + } + + // For isos + mydisk.LogicalBlocksize = 2048 + + isoFs, err := mydisk.CreateFilesystem( + disk.FilesystemSpec{ + Partition: 0, FSType: filesystem.TypeISO9660, VolumeLabel: b.spec.Label, + }, + ) + + if err != nil { + return fmt.Errorf("error creating filesystem: %w", err) + } + + // Copy boot image + bios stuff + err = filepath.WalkDir(root, func(path string, info os.DirEntry, err error) error { + if err != nil { + return fmt.Errorf("error creating iso file: %w", err) + } + b.cfg.Logger.Infof("Doing path %s", path) + + relPath, err := filepath.Rel(root, path) + if err != nil { + return fmt.Errorf("error getting relpath of %s: %w", path, err) + } + + // If the current path is a folder, create the folder in the ISO filesystem + if info.IsDir() { + // Create the directory in the ISO file + err = isoFs.Mkdir(relPath) + if err != nil { + return fmt.Errorf("error creating dir %s: %w", relPath, err) + } + return nil + } + + // If the current path is a file, copy the file to the ISO filesystem + if !info.IsDir() { + // Open the file in the ISO file for writing + rw, err := isoFs.OpenFile(relPath, os.O_CREATE|os.O_RDWR) + if err != nil { + return fmt.Errorf("error opening file %s: %w", relPath, err) + } + defer rw.Close() + + // Open the source file for reading + in, errorOpeningFile := os.Open(path) + if errorOpeningFile != nil { + return errorOpeningFile + } + defer in.Close() + + // Copy the contents of the source file to the ISO file + _, err = io.Copy(rw, in) + if err != nil { + return fmt.Errorf("error copying file: %w", err) + } + } + + return nil + }) + + iso, ok := isoFs.(*iso9660.FileSystem) + if !ok { + return fmt.Errorf("not an iso9660 filesystem") + } + + err = iso.Finalize(iso9660.FinalizeOptions{ + VolumeIdentifier: b.spec.Label, + RockRidge: true, + ElTorito: &iso9660.ElTorito{ + //BootCatalog: constants.IsoBootCatalog, + HideBootCatalog: true, + Entries: []*iso9660.ElToritoEntry{ + { + Platform: iso9660.BIOS, + Emulation: iso9660.NoEmulation, + BootFile: constants.IsoEFIPath, + BootTable: true, + LoadSize: 4, + }, + { + Platform: iso9660.EFI, + Emulation: iso9660.NoEmulation, + BootFile: constants.IsoEFIPath, + }, + }, + }, + }) + if err != nil { + return fmt.Errorf("error creating iso file: %w", err) } checksum, err := utils.CalcFileChecksum(b.cfg.Fs, outputFile) if err != nil { return fmt.Errorf("checksum computation failed: %w", err) } - err = b.cfg.Fs.WriteFile(fmt.Sprintf("%s.sha256", outputFile), []byte(fmt.Sprintf("%s %s\n", checksum, isoFileName)), 0644) + err = b.cfg.Fs.WriteFile(fmt.Sprintf("%s.sha256", outputFile), []byte(fmt.Sprintf("%s %s\n", checksum, isoName)), 0644) if err != nil { return fmt.Errorf("cannot write checksum file: %w", err) } diff --git a/pkg/action/build-uki.go b/pkg/action/build-uki.go index c4af969..cee4318 100644 --- a/pkg/action/build-uki.go +++ b/pkg/action/build-uki.go @@ -469,11 +469,14 @@ func (b *BuildUKIAction) createISO(sourceDir string) error { return err } + align := int64(4 * 1024 * 1024) + efiSizeMB := (artifactSize/align*align + align) / (1024 * 1024) + imgFile := filepath.Join(isoDir, "efiboot.img") var ( - espSize int64 = (artifactSize + 50) * 1024 * 1024 // 100 MB - diskSize int64 = espSize + 4*1024*1024 // 104 MB + espSize int64 = (efiSizeMB + 50) * 1024 * 1024 // 100 MB + diskSize int64 = espSize + 4*1024*1024 // 104 MB partitionStart int64 = 2048 partitionSectors int64 = espSize / 512 partitionEnd int64 = partitionSectors - partitionStart + 1