mirror of
https://github.com/kairos-io/immucore.git
synced 2025-09-02 15:14:27 +00:00
more
more logging run as dry-run print version remove nouser opt Signed-off-by: Itxaka <itxaka@spectrocloud.com>
This commit is contained in:
@@ -62,7 +62,7 @@ build-immucore:
|
||||
COPY main.go /work
|
||||
COPY --dir internal /work
|
||||
COPY --dir pkg /work
|
||||
RUN CGO_ENABLED=0 go build -o immucore -ldflags "-X main.Version=$VERSION"
|
||||
RUN CGO_ENABLED=0 go build -o immucore -ldflags "-X internal/version.Version=$VERSION"
|
||||
SAVE ARTIFACT /work/immucore AS LOCAL build/immucore-$VERSION
|
||||
|
||||
build-dracut:
|
||||
|
@@ -29,8 +29,8 @@ oem_label=$(getarg rd.cos.oemlabel=)
|
||||
echo "After=sysroot.mount"
|
||||
echo "[Service]"
|
||||
echo "Type=oneshot"
|
||||
echo "RemainAfterExit=no"
|
||||
echo "ExecStart=/usr/bin/immucore start"
|
||||
echo "RemainAfterExit=yes"
|
||||
echo "ExecStart=/usr/bin/immucore start --dry-run"
|
||||
} > "$GENERATOR_DIR"/immucore.service
|
||||
|
||||
|
||||
|
34
internal/version/version.go
Normal file
34
internal/version/version.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package version
|
||||
|
||||
import "runtime"
|
||||
|
||||
var (
|
||||
version = "v0.0.1"
|
||||
// gitCommit is the git sha1
|
||||
gitCommit = ""
|
||||
)
|
||||
|
||||
func GetVersion() string {
|
||||
return version
|
||||
}
|
||||
|
||||
// BuildInfo describes the compiled time information.
|
||||
type BuildInfo struct {
|
||||
// Version is the current semver.
|
||||
Version string `json:"version,omitempty"`
|
||||
// GitCommit is the git sha1.
|
||||
GitCommit string `json:"git_commit,omitempty"`
|
||||
// GoVersion is the version of the Go compiler used.
|
||||
GoVersion string `json:"go_version,omitempty"`
|
||||
}
|
||||
|
||||
// Get returns build info
|
||||
func Get() BuildInfo {
|
||||
v := BuildInfo{
|
||||
Version: GetVersion(),
|
||||
GitCommit: gitCommit,
|
||||
GoVersion: runtime.Version(),
|
||||
}
|
||||
|
||||
return v
|
||||
}
|
3
main.go
3
main.go
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/kairos-io/immucore/internal/version"
|
||||
"os"
|
||||
|
||||
"github.com/kairos-io/immucore/internal/cmd"
|
||||
@@ -23,6 +24,8 @@ func main() {
|
||||
|
||||
Commands: cmd.Commands,
|
||||
}
|
||||
|
||||
fmt.Println(version.Get())
|
||||
|
||||
err := app.Run(os.Args)
|
||||
if err != nil {
|
||||
|
@@ -203,8 +203,11 @@ func (s *State) Register(g *herd.Graph) error {
|
||||
func(ctx context.Context) error {
|
||||
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr}).With().Caller().Logger()
|
||||
cmd := fmt.Sprintf("losetup --show -f %s", s.path("/run/initramfs/cos-state", s.TargetImage))
|
||||
log.Logger.Debug().Str("targetImage", s.TargetImage).Str("fullcmd", cmd).Msg("Mounting image")
|
||||
log.Logger.Debug().Str("targetImage", s.TargetImage).Str("path", s.Rootdir).Str("fullcmd", cmd).Msg("Mounting image")
|
||||
_, err := utils.SH(cmd)
|
||||
if err != nil {
|
||||
log.Logger.Debug().Err(err).Msg("")
|
||||
}
|
||||
return err
|
||||
},
|
||||
))
|
||||
@@ -238,14 +241,14 @@ func (s *State) Register(g *herd.Graph) error {
|
||||
s.MountOP(
|
||||
fmt.Sprintf("/dev/disk/by-label/%s", s.TargetLabel),
|
||||
s.Rootdir,
|
||||
"ext2", // are images always ext2?
|
||||
"ext4", // are images always ext2?
|
||||
[]string{
|
||||
"ro", // or rw
|
||||
"suid",
|
||||
"dev",
|
||||
"exec",
|
||||
"auto",
|
||||
"nouser",
|
||||
//"nouser",
|
||||
"async",
|
||||
}, 60*time.Second),
|
||||
),
|
||||
|
Reference in New Issue
Block a user