diff --git a/.gitignore b/.gitignore index f81dcf1..2892e2e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ -vendor yubikey-touch-detector -release +dist diff --git a/Gopkg.lock b/Gopkg.lock deleted file mode 100644 index 2f75328..0000000 --- a/Gopkg.lock +++ /dev/null @@ -1,55 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - digest = "1:6a874e3ddfb9db2b42bd8c85b6875407c702fa868eed20634ff489bc896ccfd3" - name = "github.com/konsorten/go-windows-terminal-sequences" - packages = ["."] - pruneopts = "" - revision = "5c8c8bd35d3832f5d134ae1e1e375b69a4d25242" - version = "v1.0.1" - -[[projects]] - digest = "1:6938b6ee0351393c55baa54b64352e49a741a1b7b616a7d134d237106812070f" - name = "github.com/rjeczalik/notify" - packages = ["."] - pruneopts = "" - revision = "69d839f37b13a8cb7a78366f7633a4071cb43be7" - version = "v0.9.2" - -[[projects]] - digest = "1:9a3c631555e0351fdc4e696577bb63afd90c399d782a8462dba9d100d7021db3" - name = "github.com/sirupsen/logrus" - packages = ["."] - pruneopts = "" - revision = "e1e72e9de974bd926e5c56f83753fba2df402ce5" - version = "v1.3.0" - -[[projects]] - branch = "master" - digest = "1:5462386895a322b94a79a5de7314310edbd5f4d15f851ae032f146b2c951b3de" - name = "golang.org/x/crypto" - packages = ["ssh/terminal"] - pruneopts = "" - revision = "74369b46fc6756741c016591724fd1cb8e26845f" - -[[projects]] - branch = "master" - digest = "1:c05d7df4515a5ade109706194fbda5cfd23c1754b26e17b012281c2d247c01d9" - name = "golang.org/x/sys" - packages = [ - "unix", - "windows", - ] - pruneopts = "" - revision = "3b5209105503162ded1863c307ac66fec31120dd" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - input-imports = [ - "github.com/rjeczalik/notify", - "github.com/sirupsen/logrus", - ] - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml deleted file mode 100644 index 5b99939..0000000 --- a/Gopkg.toml +++ /dev/null @@ -1,7 +0,0 @@ -[[constraint]] - name = "github.com/rjeczalik/notify" - version = "0.9.2" - -[[constraint]] - name = "github.com/sirupsen/logrus" - version = "1.3.0" diff --git a/Makefile b/Makefile index 2988c37..bd0d61f 100644 --- a/Makefile +++ b/Makefile @@ -1,34 +1,41 @@ -APP_NAME := yubikey-touch-detector +BIN := yubikey-touch-detector +VERSION = 1.3.0 + +PREFIX ?= /usr +LIB_DIR = $(DESTDIR)$(PREFIX)/lib +BIN_DIR = $(DESTDIR)$(PREFIX)/bin +SHARE_DIR = $(DESTDIR)$(PREFIX)/share GO_GCFLAGS := "all=-trimpath=${PWD}" GO_ASMFLAGS := "all=-trimpath=${PWD}" GO_LDFLAGS := "-extldflags ${LDFLAGS}" -all: deps build - -deps: - dep ensure -vendor-only - +.PHONY: build build: main.go detector/ notifier/ - go build -ldflags $(GO_LDFLAGS) -gcflags $(GO_GCFLAGS) -asmflags $(GO_ASMFLAGS) -o $(APP_NAME) main.go + go build -ldflags $(GO_LDFLAGS) -gcflags $(GO_GCFLAGS) -asmflags $(GO_ASMFLAGS) -o $(BIN) main.go +.PHONY: clean clean: - rm -f $(APP_NAME) - rm -rf release - -tarball: clean deps - rm -rf /tmp/$(APP_NAME) /tmp/$(APP_NAME)-src.tar.gz - cp -r ../$(APP_NAME) /tmp/$(APP_NAME) - rm -rf /tmp/$(APP_NAME)/.git /tmp/$(APP_NAME)/tags - (cd /tmp && tar -czf /tmp/$(APP_NAME)-src.tar.gz $(APP_NAME)) - mkdir -p release - cp /tmp/$(APP_NAME)-src.tar.gz release/ - -release: tarball deps build - mkdir -p release - tar -czf release/$(APP_NAME).tar.gz $(APP_NAME) $(APP_NAME).service - -sign: release - for file in release/*; do \ - gpg --detach-sign "$$file"; \ + rm -f "$(BIN)" + rm -rf dist + +.PHONY: dist +dist: clean build + mkdir -p dist + + git archive -o "dist/$(BIN)-$(VERSION).tar.gz" --format tar.gz --prefix "$(BIN)-$(VERSION)/" "$(VERSION)" + + tar -cvzf "dist/$(BIN)-$(VERSION)-linux64.tar.gz" "$(BIN)" "$(BIN).service" LICENSE README.md + + for file in dist/*; do \ + gpg --detach-sign --armor "$$file"; \ done + + rm -f "dist/$(BIN)-$(VERSION).tar.gz" + +.PHONY: install +install: + install -Dm755 -t "$(BIN_DIR)/" $(BIN) + install -Dm644 -t "$(LIB_DIR)/systemd/user" "$(BIN).service" + install -Dm644 -t "$(SHARE_DIR)/licenses/$(BIN)/" LICENSE + install -Dm644 -t "$(SHARE_DIR)/doc/$(BIN)/" README.md diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..e29d559 --- /dev/null +++ b/go.mod @@ -0,0 +1,15 @@ +module github.com/maximbaz/yubikey-touch-detector + +go 1.12 + +require ( + github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect + github.com/rjeczalik/notify v0.9.2 + github.com/sirupsen/logrus v1.4.2 + github.com/stretchr/objx v0.2.0 // indirect + golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 // indirect + golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 // indirect + golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7 // indirect + golang.org/x/text v0.3.2 // indirect + golang.org/x/tools v0.0.0-20190724185037-8aa4eac1a7c1 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..6925fcb --- /dev/null +++ b/go.sum @@ -0,0 +1,36 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rjeczalik/notify v0.9.2 h1:MiTWrPj55mNDHEiIX5YUSKefw/+lCQVoAFmD6oQm5w8= +github.com/rjeczalik/notify v0.9.2/go.mod h1:aErll2f0sUX9PXZnVNyeiObbmTlk5jnMoCa4QEjJeqM= +github.com/sirupsen/logrus v1.3.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180926160741-c2ed4eda69e7/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7 h1:LepdCS8Gf/MVejFIt8lsiexZATdoGVyp5bcyS+rYoUI= +golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190724185037-8aa4eac1a7c1/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI=