Skip to content

Commit

Permalink
Merge branch 'main' into lvm
Browse files Browse the repository at this point in the history
  • Loading branch information
matbme committed Oct 15, 2023
2 parents 3085c59 + 87b1f63 commit f2b5dae
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
container: ghcr.io/vanilla-os/pico:main

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
Expand Down
19 changes: 18 additions & 1 deletion core/grub.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"os"
"path/filepath"
"regexp"
"strings"
)

Expand Down Expand Up @@ -107,7 +108,7 @@ func RunGrubInstall(targetRoot, bootDirectory, diskPath string, target FirmwareT
}
}

grubInstallCmd := "grub-install --boot-directory %s --target=%s --uefi-secure-boot %s"
grubInstallCmd := "grub-install --bootloader-id=debian --boot-directory %s --target=%s --uefi-secure-boot %s"

var err error
if targetRoot != "" {
Expand All @@ -119,6 +120,22 @@ func RunGrubInstall(targetRoot, bootDirectory, diskPath string, target FirmwareT
return fmt.Errorf("Failed to run grub-install: %s", err)
}

if targetRoot != "" {
return nil
}

// FIXME: This is needed on Vanilla due to some recent GRUB change. If you're using Debian sid as
// base, consider keeping it.
efibootmgrCmd := "efibootmgr --create --disk=%s --part=%s --label=vanilla --loader=\"\\EFI\\debian\\shimx64.efi\""
diskExpr := regexp.MustCompile("^/dev/[a-zA-Z]+([0-9]+[a-z][0-9]+)?")
partExpr := regexp.MustCompile("[0-9]+$")
diskName := diskExpr.FindString(diskPath)
part := partExpr.FindString(diskPath)
err = RunCommand(fmt.Sprintf(efibootmgrCmd, diskName, part))
if err != nil {
return fmt.Errorf("Failed to run grub-install: %s", err)
}

return nil
}

Expand Down

0 comments on commit f2b5dae

Please sign in to comment.