Merge branch 'pr-33'

This commit is contained in:
Morten Linderud 2020-11-08 19:01:38 +01:00
commit fe1f0365f9
No known key found for this signature in database
GPG Key ID: E742683BA08CB2FF
6 changed files with 45 additions and 11 deletions

24
.github/workflows/ci.yaml vendored Normal file
View File

@ -0,0 +1,24 @@
name: CI
on: [push, pull_request]
jobs:
arch:
runs-on: ubuntu-latest
container: archlinux:latest
steps:
- run: pacman --noconfirm --noprogressbar -Syu
- run: pacman --noconfirm --noprogressbar -S make go asciidoc gcc
- uses: actions/checkout@v1
- run: make
- run: make test
- run: make deps lint
void:
runs-on: ubuntu-latest
container: voidlinux/voidlinux-musl
steps:
# update xbps, if necessary
- run: xbps-install -Syu || ( xbps-install -yu xbps && xbps-install -yu )
- run: xbps-install -y make go asciidoc gcc
- uses: actions/checkout@v1
- run: make
- run: make test
- run: make deps lint

View File

@ -47,3 +47,16 @@ push-aur:
clean:
rm -f $(MANS)
rm -f sbctl
.PHONY: deps
deps:
go get honnef.co/go/tools/cmd/staticcheck@2020.1.6
.PHONY: lint
lint:
go vet ./...
staticcheck ./...
.PHONY: test
test:
go test -v ./...

View File

@ -1,5 +1,5 @@
sbctl - Secure Boot Manager
===========================
# sbctl - Secure Boot Manager
[![Build Status](https://github.com/Foxboron/sbctl/workflows/build/badge.svg)](https://github.com/Foxboron/sbctl/actions)
The goal of the project is to have one consistent UI to manage secure boot keys.

View File

@ -79,18 +79,18 @@ func signAllCmd() *cobra.Command {
Use: "sign-all",
Short: "Sign all enrolled files with secure boot keys",
Run: func(cmd *cobra.Command, args []string) {
var out_bundle error = nil
out_sign := false
var outBundle error
outSign := false
if generate {
out_bundle = sbctl.GenerateAllBundles(true)
outBundle = sbctl.GenerateAllBundles(true)
}
files := sbctl.ReadFileDatabase(sbctl.DBPath)
for _, entry := range files {
if sbctl.SignFile(sbctl.DBKey, sbctl.DBCert, entry.File, entry.OutputFile, entry.Checksum) != nil {
out_sign = true
outSign = true
continue
}
@ -102,7 +102,7 @@ func signAllCmd() *cobra.Command {
}
if out_bundle != nil || out_sign {
if outBundle != nil || outSign {
log.Fatalln("Errors were encountered, see above")
}
},

1
go.sum
View File

@ -41,6 +41,7 @@ github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmg
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=

4
log.go
View File

@ -10,7 +10,6 @@ import (
)
var (
plain *log.Logger
msg *log.Logger
msg2 *log.Logger
warning *log.Logger
@ -42,9 +41,6 @@ func ColorsOff() {
}
func init() {
plainfmt := fmt.Sprintf("%s%s ", prefix, bold)
plain = log.New(os.Stdout, plainfmt, 0)
msgfmt := fmt.Sprintf("%s%s%s==>%s%s ", prefix, bold, green, off, bold)
msg = log.New(os.Stdout, msgfmt, 0)