Documentation ¶
Index ¶
- Variables
- func ActivateLVM() error
- func AppendSlash(path string) string
- func BootStateToLabelDevice() string
- func CleanSysrootForFstab(path string) string
- func CleanupSlice(slice []string) []string
- func CloseLogFiles()
- func CommandWithPath(c string) (string, error)
- func Copy(src, dst string) error
- func CreateIfNotExists(path string) error
- func DisableImmucore() bool
- func DiskFSType(s string) string
- func DropToEmergencyShell()
- func Fsck(device string) error
- func GetHostProcCmdline() string
- func GetOemLabel() string
- func GetOemTimeout() int
- func GetOverlayBase() string
- func GetRootDir() string
- func GetState() string
- func GetTarget(dryRun bool) (string, string, error)
- func IsMounted(dev string) bool
- func IsUKI() bool
- func Mount(source string, target string, fstype string, flags uintptr, data string) (err error)
- func MountBasic()
- func MountToFstab(m mount.Mount) *fstab.Mount
- func NewYipExecutor(l logger.Interface) executor.Executor
- func PCRExtend(pcr int, data []byte) error
- func ParseMount(s string) string
- func PrepareCommandWithPath(c string) *exec.Cmd
- func ReadCMDLineArg(arg string) []string
- func ReadEnv(file string) (map[string]string, error)
- func RebootOrWait(msg string, err error)
- func RootRW() string
- func RunStage(stage string) (bytes.Buffer, error)
- func SetLogger()
- func Sync()
- func SyncState(src, dst string) error
- func UniqueSlice(slice []string) []string
- func UpgradeKcryptPartitions() error
- type Chroot
- type ImmucoreConsole
- type MiddleLog
- func (m MiddleLog) Debug(args ...interface{})
- func (m MiddleLog) Debugf(tpl string, args ...interface{})
- func (m MiddleLog) Error(args ...interface{})
- func (m MiddleLog) Errorf(tpl string, args ...interface{})
- func (m MiddleLog) Fatal(args ...interface{})
- func (m MiddleLog) Fatalf(tpl string, args ...interface{})
- func (m MiddleLog) Info(args ...interface{})
- func (m MiddleLog) Infof(tpl string, args ...interface{})
- func (m MiddleLog) Panic(args ...interface{})
- func (m MiddleLog) Panicf(tpl string, args ...interface{})
- func (m MiddleLog) Trace(args ...interface{})
- func (m MiddleLog) Tracef(tpl string, args ...interface{})
- func (m MiddleLog) Warn(args ...interface{})
- func (m MiddleLog) Warnf(tpl string, args ...interface{})
Constants ¶
This section is empty.
Variables ¶
var Log zerolog.Logger
Functions ¶
func ActivateLVM ¶ added in v0.0.18
func ActivateLVM() error
func AppendSlash ¶
AppendSlash it's in the name. Appends a slash.
func BootStateToLabelDevice ¶ added in v0.0.11
func BootStateToLabelDevice() string
BootStateToLabelDevice lets us know the device we need to mount sysroot on based on labels.
func CleanSysrootForFstab ¶
CleanSysrootForFstab will clean up the pesky sysroot dir from entries to make them suitable to be written in the fstab As we mount on /sysroot during initramfs but the fstab file is for the real init process, we need to remove Any mentions to /sysroot from the fstab lines, otherwise they won't work Special care for the root (/sysroot) path as we can't just simple remove that path and call it a day as that will return an empty mountpoint which will break fstab mounting.
func CleanupSlice ¶
CleanupSlice will clean a slice of strings of empty items Typos can be made on writing the cos-layout.env file and that could introduce empty items In the lists that we need to go over, which causes bad stuff.
func CloseLogFiles ¶ added in v0.0.13
func CloseLogFiles()
func CommandWithPath ¶ added in v0.0.13
CommandWithPath runs a command adding the usual PATH to environment Useful under UKI as there is nothing setting the PATH.
func CreateIfNotExists ¶
CreateIfNotExists will check if a path exists and create it if needed.
func DisableImmucore ¶ added in v0.0.11
func DisableImmucore() bool
DisableImmucore identifies if we need to be disabled We disable if we boot from CD, netboot, squashfs recovery or have the rd.cos.disable stanza in cmdline.
func DiskFSType ¶
DiskFSType will return the FS type for a given disk Does NOT need to be mounted Needs full path so either /dev/sda1 or /dev/disk/by-{label,uuid}/{label,uuid} .
func DropToEmergencyShell ¶ added in v0.1.22
func DropToEmergencyShell()
func Fsck ¶ added in v0.0.11
Fsck will run fsck over the device options are set on cmdline, but they are for systemd-fsck, so we need to interpret ourselves.
func GetHostProcCmdline ¶ added in v0.0.13
func GetHostProcCmdline() string
GetHostProcCmdline returns the path to /proc/cmdline Mainly used to override the cmdline during testing.
func GetOemLabel ¶ added in v0.0.13
func GetOemLabel() string
GetOemLabel will ge the oem label to mount, first from the cmdline and if that fails, from the runtime This way users can override the oem label.
func GetOemTimeout ¶ added in v0.0.13
func GetOemTimeout() int
GetOemTimeout parses the cmdline to get the oem timeout to use. Defaults to 5 (converted into seconds afterwards).
func GetOverlayBase ¶ added in v0.0.13
func GetOverlayBase() string
GetOverlayBase parses the cdmline and gets the overlay config Format is rd.cos.overlay=tmpfs:20% or rd.cos.overlay=LABEL=$LABEL or rd.cos.overlay=UUID=$UUID Notice that this can be later override by the config coming from cos-layout.env .
func GetRootDir ¶
func GetRootDir() string
GetRootDir returns the proper dir to mount all the stuff Useful if we want to move to a no-pivot boot.
func GetState ¶ added in v0.0.11
func GetState() string
GetState returns the disk-by-label of the state partition to mount This is only valid for either active/passive or normal recovery.
func Mount ¶ added in v0.1.26
Mount will mount the given source to the target with the given fstype and flags.
func MountBasic ¶ added in v0.1.6
func MountBasic()
MountBasic will mount /proc and /run For now proc is needed to read the cmdline fully in uki mode in normal modes this should already be done by the initramfs process, so we can skip this. /run is needed to start logging from the start.
func MountToFstab ¶
MountToFstab transforms a mount.Mount into a fstab.Mount so we can transform existing mounts into the fstab format.
func ParseMount ¶
ParseMount will return a proper full disk path based on UUID or LABEL given input: LABEL=FOO:/mount output: /dev/disk...:/mount .
func PrepareCommandWithPath ¶ added in v0.0.14
PrepareCommandWithPath prepares a cmd with the proper env For running under yip.
func ReadCMDLineArg ¶
ReadCMDLineArg will return the pair of arg=value for a given arg if it was passed on the cmdline TODO: Split this into GetBool and GetValue to return decent defaults.
func RebootOrWait ¶ added in v0.2.0
RebootOrWait will reboot the system or wait forever. It will print the error message before rebooting/waiting If the rd.immucore.rebootonfailure is set in the cmdline, it will reboot. If not, it will wait forever. If the error is not nil it will log it.
func UniqueSlice ¶
UniqueSlice removes duplicated entries from a slice.So dumb. Like really? Why not have a set which enforces uniqueness????
func UpgradeKcryptPartitions ¶ added in v0.0.23
func UpgradeKcryptPartitions() error
UpgradeKcryptPartitions will try check for the uuid of the persistent partition and upgrade its uuid.
Types ¶
type Chroot ¶ added in v0.0.13
type Chroot struct {
// contains filtered or unexported fields
}
Chroot represents the struct that will allow us to run commands inside a given chroot.
func (*Chroot) Close ¶ added in v0.0.13
Close will unmount all active mounts created in Prepare on reverse order.
func (*Chroot) Prepare ¶ added in v0.0.13
Prepare will mount the defaultMounts as bind mounts, to be ready when we run chroot.
func (*Chroot) RunCallback ¶ added in v0.0.13
RunCallback runs the given callback in a chroot environment.
type ImmucoreConsole ¶ added in v0.0.14
type ImmucoreConsole struct { }
ImmucoreConsole is the console for yip. As we have to hijack the Run method to be able to run under UKI To add the paths, we need to create our own console.
func (ImmucoreConsole) RunTemplate ¶ added in v0.0.14
func (s ImmucoreConsole) RunTemplate(st []string, template string) error
type MiddleLog ¶ added in v0.1.6
MiddleLog implements the bridge between zerolog and the logger.Interface that yip needs.