Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pull/363'
Browse files Browse the repository at this point in the history
* origin/pull/363:
  Update staticcheck
  Allow exporting keys without efivars again
  • Loading branch information
Foxboron committed Aug 16, 2024
2 parents 55ab027 + 076034f commit 2669fe9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ clean:
.PHONY: lint
lint:
go vet ./...
go run honnef.co/go/tools/cmd/staticcheck@v0.4.7 ./...
go run honnef.co/go/tools/cmd/staticcheck@v0.5.1 ./...

.PHONY: test
test:
Expand Down
5 changes: 3 additions & 2 deletions cmd/sbctl/enroll-keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,12 @@ func KeySync(state *config.State, oems []string) error {
}

func RunEnrollKeys(state *config.State) error {
// SetupMode is not necessarily required on a partial enrollment
ok, err := state.Efivarfs.GetSetupMode()
if err != nil {
// EFI variables are missing in some CI / build environments and setup mode is not needed for exporting keys
if err != nil && enrollKeysCmdOptions.Export.Value == "" {
return err
}
// SetupMode is not necessarily required for a partial enrollment and not needed for exporting keys
if !ok && enrollKeysCmdOptions.Partial.Value == "" && enrollKeysCmdOptions.Export.Value == "" {
return ErrSetupModeDisabled
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/sbctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,11 @@ func main() {
} else if errors.Is(err, sbctl.ErrImmutable) {
logging.Println("You need to chattr -i files in efivarfs")
} else if errors.Is(err, sbctl.ErrOprom) {
logging.Error(fmt.Errorf(opromErrorMsg))
logging.Error(errors.New(opromErrorMsg))
} else if errors.Is(err, sbctl.ErrNoEventlog) {
logging.Error(fmt.Errorf(noEventlogErrorMsg))
logging.Error(errors.New(noEventlogErrorMsg))
} else if errors.Is(err, ErrSetupModeDisabled) {
logging.Error(fmt.Errorf(setupModeDisabled))
logging.Error(errors.New(setupModeDisabled))
} else if !errors.Is(err, ErrSilent) {
logging.Error(err)
}
Expand Down

0 comments on commit 2669fe9

Please sign in to comment.