Skip to content

Commit

Permalink
Update kexec.go
Browse files Browse the repository at this point in the history
  • Loading branch information
ttwd80 authored Sep 2, 2024
1 parent 12cf23f commit fa2ed46
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion kexec/cmd/kexec.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var kexecCmd = &cobra.Command{
filesystemType := os.Getenv("FS_TYPE")
kernelPath := os.Getenv("KERNEL_PATH")
initrdPath := os.Getenv("INITRD_PATH")
grubCfgPath := os.Getenv("GRUBCFG_PATH")
cmdLine := os.Getenv("CMD_LINE")

// These two strings contain the updated paths including the mountAction path
Expand All @@ -39,6 +40,10 @@ var kexecCmd = &cobra.Command{
log.Fatalf("No Block Device speified with Environment Variable [BLOCK_DEVICE]")
}

if grubCfgPath == "" {
grubCfgPath = "boot/grub/grub.cfg"
}

// Create the /mountAction mountpoint (no folders exist previously in scratch container)
err := os.Mkdir(mountAction, os.ModeDir)
if err != nil {
Expand All @@ -55,7 +60,7 @@ var kexecCmd = &cobra.Command{
// If we specify no kernelPath then we will fallback to autodetect and ignore the initrd and cmdline that may be passed
// by environment variables
if kernelPath == "" {
grubFile, err := ioutil.ReadFile(fmt.Sprintf("%s/boot/grub/grub.cfg", mountAction))
grubFile, err := ioutil.ReadFile(fmt.Sprintf("%s/%s", mountAction, grubCfgPath))
if err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit fa2ed46

Please sign in to comment.