Merge pull request #63 from chiefy/feature/nfpm

deb/rpm builds with nfpm
This commit is contained in:
Caleb Bassi 2018-10-22 15:54:21 -07:00
commit 0609656e22
4 changed files with 62 additions and 1 deletions

3
.gitignore vendored
View File

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

34
Makefile Normal file
View File

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

View File

@ -81,6 +81,17 @@ 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):
```bash
make all
```
This will place the built packages into the `pkg` folder.
## Credits
- [mdnazmulhasan27771](https://github.com/mdnazmulhasan27771) for the [logo](https://github.com/cjbassi/gotop/blob/master/assets/logo.png)

15
build/gotop-nfpm.yaml Normal file
View File

@ -0,0 +1,15 @@
name: "gotop"
arch: "amd64"
platform: "linux"
version: "v${VERSION}"
section: "default"
priority: "extra"
maintainer: "Caleb Bassi <calebjbassi@gmail.com>"
description: |
A terminal based graphical activity monitor inspired by gtop and vtop
vendor: "Caleb Bassi"
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"