mirror of
https://github.com/kairos-io/kairos-sdk.git
synced 2025-08-26 18:49:40 +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"
|
||||
)
|
||||
|
||||
const (
|
||||
filePrefix = "file://"
|
||||
)
|
||||
|
||||
type BundleConfig struct {
|
||||
Target string
|
||||
Repository string
|
||||
DBPath string
|
||||
RootPath string
|
||||
LocalFile bool
|
||||
}
|
||||
|
||||
// BundleOption defines a configuration option for a bundle.
|
||||
@ -148,10 +153,15 @@ func (l *ContainerRunner) Install(config *BundleConfig) error {
|
||||
}
|
||||
defer os.RemoveAll(tempDir)
|
||||
|
||||
target := config.Target
|
||||
if config.LocalFile {
|
||||
target = strings.Join([]string{filePrefix, target}, "")
|
||||
}
|
||||
|
||||
out, err := utils.SH(
|
||||
fmt.Sprintf(
|
||||
`luet util unpack %s %s`,
|
||||
config.Target,
|
||||
target,
|
||||
tempDir,
|
||||
),
|
||||
)
|
||||
@ -171,11 +181,16 @@ type ContainerInstaller struct{}
|
||||
|
||||
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
|
||||
out, err := utils.SH(
|
||||
fmt.Sprintf(
|
||||
`luet util unpack %s %s`,
|
||||
config.Target,
|
||||
target,
|
||||
config.RootPath,
|
||||
),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user