Workaround for kairos sdk not detecting netboot

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
This commit is contained in:
Itxaka
2023-02-16 15:30:54 +01:00
parent dac147da2d
commit bc53b0de3a
2 changed files with 24 additions and 1 deletions

View File

@@ -62,7 +62,19 @@ build-immucore:
ARG LDFLAGS="-s -w -X github.com/kairos-io/immucore/internal/version.version=$VERSION"
RUN echo ${LDFLAGS}
RUN CGO_ENABLED=0 go build -o immucore -ldflags "${LDFLAGS}"
SAVE ARTIFACT /work/immucore AS LOCAL build/immucore-$VERSION
SAVE ARTIFACT /work/immucore immucore AS LOCAL build/immucore-$VERSION
dracut-artifacts:
FROM $BASE_IMAGE
WORKDIR /build
COPY --dir dracut/28immucore .
COPY dracut/02-kairos-setup-initramfs.conf .
COPY dracut/10-immucore.conf .
COPY dracut/50-kairos-initrd.conf .
SAVE ARTIFACT 28immucore 28immucore
SAVE ARTIFACT 02-kairos-setup-initramfs.conf 02-kairos-setup-initramfs.conf
SAVE ARTIFACT 10-immucore.conf 10-immucore.conf
SAVE ARTIFACT 50-kairos-initrd.conf 50-kairos-initrd.conf
build-dracut:
FROM $BASE_IMAGE

View File

@@ -343,6 +343,17 @@ func (s *State) WriteSentinelDagStep(g *herd.Graph) error {
default:
sentinel = string(state.Unknown)
}
// Workaround for runtime not detecting netboot as live_mode
// Needs changes to the kairos sdk
// TODO: drop once the netboot detection change is on the kairos sdk
cmdline, err := os.ReadFile("/proc/cmdline")
cmdlineS := string(cmdline)
if strings.Contains(cmdlineS, "netboot") {
sentinel = "live_mode"
}
s.Logger.Info().Str("to", sentinel).Msg("Setting sentinel file")
err = os.WriteFile(filepath.Join("/run/cos/", sentinel), []byte("1"), os.ModePerm)
if err != nil {
return err