Skip to content

Commit

Permalink
debug extension
Browse files Browse the repository at this point in the history
Signed-off-by: Itxaka <[email protected]>
  • Loading branch information
Itxaka committed Sep 15, 2023
1 parent b1db2f4 commit 98ccb57
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion internal/agent/hooks/bundles.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package hook

import (
"fmt"
config "github.com/kairos-io/kairos-agent/v2/pkg/config"
v1 "github.com/kairos-io/kairos-agent/v2/pkg/types/v1"
"github.com/kairos-io/kairos-sdk/bundles"
"github.com/kairos-io/kairos-sdk/machine"
"os"
"os/exec"
"syscall"
)

type BundleOption struct{}
Expand All @@ -16,13 +20,27 @@ func (b BundleOption) Run(c config.Config, _ v1.Spec) error {
machine.Umount("/usr/local") //nolint:errcheck
}()

_ = os.MkdirAll("/usr/local/var-lib-extensions.bind", os.ModeDir|os.ModePerm)
cmd := exec.Command("rsync -aqAX /var/lib/extensions /usr/local/var-lib-extensions.bind")
_, err := cmd.CombinedOutput()
if err != nil {
fmt.Println(err)
}
err = syscall.Mount("/usr/local/var-lib-extensions.bind", "/var/lib/extensions", "", syscall.MS_BIND, "")
if err != nil {
fmt.Println(err)
}
defer func() {
_ = syscall.Unmount("/var/lib/extensions", 0)
}()

machine.Mount("COS_OEM", "/oem") //nolint:errcheck
defer func() {
machine.Umount("/oem") //nolint:errcheck
}()

opts := c.Install.Bundles.Options()
err := bundles.RunBundles(opts...)
err = bundles.RunBundles(opts...)
if c.FailOnBundleErrors && err != nil {
return err
}
Expand Down

0 comments on commit 98ccb57

Please sign in to comment.