mirror of
https://github.com/kairos-io/kairos-sdk.git
synced 2025-08-27 02:59:54 +00:00
✨ unpack local image file (#803)
LocalFile in BundleConfig, to prefix file:// to Target image file Unpack local image file Signed-off-by: Santhosh <santhosh@spectrocloud.com>
This commit is contained in:
parent
7d66776a34
commit
31eb6ec19d
@ -10,11 +10,16 @@ import (
|
|||||||
"github.com/kairos-io/kairos/pkg/utils"
|
"github.com/kairos-io/kairos/pkg/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
filePrefix = "file://"
|
||||||
|
)
|
||||||
|
|
||||||
type BundleConfig struct {
|
type BundleConfig struct {
|
||||||
Target string
|
Target string
|
||||||
Repository string
|
Repository string
|
||||||
DBPath string
|
DBPath string
|
||||||
RootPath string
|
RootPath string
|
||||||
|
LocalFile bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// BundleOption defines a configuration option for a bundle.
|
// BundleOption defines a configuration option for a bundle.
|
||||||
@ -148,10 +153,15 @@ func (l *ContainerRunner) Install(config *BundleConfig) error {
|
|||||||
}
|
}
|
||||||
defer os.RemoveAll(tempDir)
|
defer os.RemoveAll(tempDir)
|
||||||
|
|
||||||
|
target := config.Target
|
||||||
|
if config.LocalFile {
|
||||||
|
target = strings.Join([]string{filePrefix, target}, "")
|
||||||
|
}
|
||||||
|
|
||||||
out, err := utils.SH(
|
out, err := utils.SH(
|
||||||
fmt.Sprintf(
|
fmt.Sprintf(
|
||||||
`luet util unpack %s %s`,
|
`luet util unpack %s %s`,
|
||||||
config.Target,
|
target,
|
||||||
tempDir,
|
tempDir,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -171,11 +181,16 @@ type ContainerInstaller struct{}
|
|||||||
|
|
||||||
func (l *ContainerInstaller) Install(config *BundleConfig) error {
|
func (l *ContainerInstaller) Install(config *BundleConfig) error {
|
||||||
|
|
||||||
|
target := config.Target
|
||||||
|
if config.LocalFile {
|
||||||
|
target = strings.Join([]string{filePrefix, target}, "")
|
||||||
|
}
|
||||||
|
|
||||||
//mkdir -p test/etc/luet/repos.conf.d
|
//mkdir -p test/etc/luet/repos.conf.d
|
||||||
out, err := utils.SH(
|
out, err := utils.SH(
|
||||||
fmt.Sprintf(
|
fmt.Sprintf(
|
||||||
`luet util unpack %s %s`,
|
`luet util unpack %s %s`,
|
||||||
config.Target,
|
target,
|
||||||
config.RootPath,
|
config.RootPath,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user