mirror of
https://github.com/kairos-io/immucore.git
synced 2025-04-28 11:25:39 +00:00
21 lines
314 B
Go
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
|
||
|
}
|