Skip to content
This repository has been archived by the owner on Sep 6, 2023. It is now read-only.

Commit

Permalink
Set the app version
Browse files Browse the repository at this point in the history
So that 'trust --version' will show a meaningful value instead
of always 0.10.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
  • Loading branch information
hallyn committed Aug 23, 2023
1 parent 49e71af commit cf6cfa2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
sbsigntool
pip install virt-firmware
run: |
git describe --always --dirty
go version
make
make test
Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
all: trust

MAIN_VERSION ?= $(shell git describe --always --dirty || echo no-git)
ifeq ($(MAIN_VERSION),$(filter $(MAIN_VERSION), "", no-git))
$(error "Bad value for MAIN_VERSION: '$(MAIN_VERSION)'")
endif

VERSION_LDFLAGS=-X github.com/project-machine/trust/pkg/trust.Version=$(MAIN_VERSION)
trust: cmd/trust/*.go pkg/trust/*.go pkg/printdirtree/*.go
go build -buildvcs=false -o trust ./cmd/trust/
go build -buildvcs=false -ldflags "$(VERSION_LDFLAGS)" -o trust ./cmd/trust/

clean:
rm -f trust
Expand Down
7 changes: 2 additions & 5 deletions cmd/trust/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,19 @@ import (
"os"

"github.com/apex/log"
"github.com/project-machine/trust/pkg/trust"
"github.com/urfave/cli"
)

// provision - dangerous
// boot - read data from tpm, extend pcr7
// intrd-setup - create new luks key, extend pcr7


// Version of trust
const Version = "0.01"

func main() {
app := cli.NewApp()
app.Name = "trust"
app.Usage = "Manage the trustroot"
app.Version = Version
app.Version = trust.Version
app.Commands = []cli.Command{
initrdSetupCmd,
preInstallCmd,
Expand Down
2 changes: 2 additions & 0 deletions pkg/trust/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,5 @@ var SBFPartitionTypeID = [16]byte{
0x9f, 0xe1, 0xa3, 0x01, 0xea, 0x9f, 0x47, 0xed, 0x92, 0xc2, 0xe7, 0x56, 0x39, 0xff, 0x56, 0x02}

const MiB, GiB = uint64(1024 * 1024), uint64(1024 * 1024 * 1024)

var Version string

0 comments on commit cf6cfa2

Please sign in to comment.