immucore/internal/utils/common.go
Itxaka 4ade174057 dont do anything if booting from CD
We leave dracut to do its own thing and mount the CD properly

Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-06 11:31:46 +01:00

21 lines
314 B
Go

package utils
import (
"regexp"
"github.com/twpayne/go-vfs"
)
func BootedFromCD(fs vfs.FS) bool {
cdlabel := regexp.MustCompile("root=live:CDLABEL=")
cmdLine, err := fs.ReadFile("/proc/cmdline")
if err != nil {
return false
}
if cdlabel.MatchString(string(cmdLine)) {
return true
}
return false
}