Cleanup merge from chiefy:feature/nfpm

This commit is contained in:
Caleb Bassi 2018-10-22 19:18:06 -07:00
parent 0609656e22
commit 69e3564268
4 changed files with 20 additions and 24 deletions

3
.gitignore vendored
View File

@ -1,3 +1,2 @@
dist/
build/gotop
pkg/
gotop

View File

@ -1,34 +1,32 @@
VERSION=$(shell awk '/([0-9]{1}.?){3}/ {print $$4;}' main.go)
.PHONY: all
all: pkg/gotop.rpm pkg/gotop.deb
.PHONY: default
default: dist/gotop.rpm dist/gotop.deb
build/gotop:
dist/gotop:
@GOOS=linux GOARCH=amd64 go build -o $@
pkg:
dist:
@mkdir $@
pkg/gotop.rpm: pkg build/gotop
dist/gotop.rpm: dist dist/gotop
@docker run --rm \
-v "$(PWD)/build:/tmp/pkg" \
-v "$(PWD)/build:/tmp/build" \
-v "$(PWD)/dist:/tmp/dist" \
-e "VERSION=$(VERSION)" \
goreleaser/nfpm pkg \
--config /tmp/pkg/gotop-nfpm.yaml \
--target /tmp/pkg/gotop.rpm \
&& mv ./build/gotop.rpm $@
--config /tmp/build/gotop-nfpm.yml \
--target /tmp/dist/gotop.rpm
pkg/gotop.deb: pkg build/gotop
dist/gotop.deb: dist dist/gotop
@docker run --rm \
-v "$(PWD)/build:/tmp/pkg" \
-v "$(PWD)/build:/tmp/build" \
-v "$(PWD)/dist:/tmp/dist" \
-e "VERSION=$(VERSION)" \
goreleaser/nfpm pkg \
--config /tmp/pkg/gotop-nfpm.yaml \
--target /tmp/pkg/gotop.deb \
&& mv ./build/gotop.deb $@
--config /tmp/build/gotop-nfpm.yml \
--target /tmp/dist/gotop.deb
.PHONY: clean
clean:
@-rm -f build/gotop
@-rm -rf pkg
@-rm -rf dist

View File

@ -18,7 +18,7 @@ Working and tested on Linux and OSX. Windows support is planned.
Clone the repo and then run [scripts/download.sh](https://github.com/cjbassi/gotop/blob/master/scripts/download.sh) to download the correct binary for your system from the [releases tab](https://github.com/cjbassi/gotop/releases):
```sh
```bash
git clone --depth 1 https://github.com/cjbassi/gotop /tmp/gotop
/tmp/gotop/scripts/download.sh
```
@ -38,7 +38,7 @@ brew install gotop
### Source
```sh
```bash
go get github.com/cjbassi/gotop
```
@ -81,7 +81,6 @@ To make a custom colorscheme, check out the [template](https://github.com/cjbass
`-p`, `--percpu` Show each CPU in the CPU widget.
`-a`, `--averagecpu` Show average CPU in the CPU widget.
## Building deb/rpms
To build dep/rpms using [nfpm](https://github.com/goreleaser/nfpm):
@ -90,7 +89,7 @@ To build dep/rpms using [nfpm](https://github.com/goreleaser/nfpm):
make all
```
This will place the built packages into the `pkg` folder.
This will place the built packages into the `dist` folder.
## Credits

View File

@ -12,4 +12,4 @@ homepage: "https://github.com/cjbassi/gotop"
license: "GNU Affero General Public License v3.0"
bindir: "/usr/local/bin"
files:
/tmp/pkg/gotop: "/usr/local/bin/gotop"
/tmp/dist/gotop: "/usr/local/bin/gotop"