Skip to content
This repository has been archived by the owner on Aug 29, 2020. It is now read-only.

Commit

Permalink
Cleanup merge from chiefy:feature/nfpm
Browse files Browse the repository at this point in the history
  • Loading branch information
cjbassi committed Oct 23, 2018
1 parent 0609656 commit 69e3564
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 24 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
dist/
build/gotop
pkg/
gotop
32 changes: 15 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand All @@ -38,7 +38,7 @@ brew install gotop

### Source

```sh
```bash
go get github.com/cjbassi/gotop
```

Expand Down Expand Up @@ -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):
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion build/gotop-nfpm.yaml → build/gotop-nfpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 69e3564

Please sign in to comment.