Merge pull request #39 from davidnewhall/dn2_osxpkg
Stop building OSX package. Using homebrew now and the package was buggy.
This commit is contained in:
commit
97fc8d049b
|
|
@ -4,7 +4,6 @@
|
||||||
/unifi-poller*.1
|
/unifi-poller*.1
|
||||||
/unifi-poller*.deb
|
/unifi-poller*.deb
|
||||||
/unifi-poller*.rpm
|
/unifi-poller*.rpm
|
||||||
/unifi-poller*.pkg
|
|
||||||
/unifi-poller.macos
|
/unifi-poller.macos
|
||||||
/unifi-poller.linux
|
/unifi-poller.linux
|
||||||
/unifi-poller.rb
|
/unifi-poller.rb
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,36 @@
|
||||||
language: go
|
language: go
|
||||||
# so we can build an osx package.
|
|
||||||
os: osx
|
|
||||||
addons:
|
addons:
|
||||||
homebrew:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
|
- ruby-dev
|
||||||
- rpm
|
- rpm
|
||||||
- gnu-tar
|
- build-essential
|
||||||
|
- git
|
||||||
|
- libgnome-keyring-dev
|
||||||
|
- fakeroot
|
||||||
go:
|
go:
|
||||||
- 1.12.x
|
- 1.12.x
|
||||||
|
services:
|
||||||
|
- docker
|
||||||
before_install:
|
before_install:
|
||||||
- mkdir -p $GOPATH/bin
|
- mkdir -p $GOPATH/bin
|
||||||
# Download the `dep` binary to bin folder in $GOPATH
|
# Download the `dep` binary to bin folder in $GOPATH
|
||||||
- curl -sLo $GOPATH/bin/dep https://github.com/golang/dep/releases/download/v0.5.3/dep-darwin-amd64
|
- curl -sLo $GOPATH/bin/dep https://github.com/golang/dep/releases/download/v0.5.3/dep-linux-amd64
|
||||||
- chmod +x $GOPATH/bin/dep
|
- chmod +x $GOPATH/bin/dep
|
||||||
# download super-linter: golangci-lint
|
# download super-linter: golangci-lint
|
||||||
- curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin latest
|
- curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin latest
|
||||||
#- curl -sL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin latest
|
#- curl -sL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin latest
|
||||||
|
- rvm install 2.0.0
|
||||||
install:
|
install:
|
||||||
|
- rvm 2.0.0 do gem install --no-document fpm
|
||||||
- dep ensure
|
- dep ensure
|
||||||
- rvm $brew_ruby do gem install --no-document fpm
|
- docker build -t unifi-poller .
|
||||||
|
- docker run -d --name unifi-poller unifi-poller | tee docker_id
|
||||||
script:
|
script:
|
||||||
- rvm $brew_ruby do make release
|
# Once we figure out how to keep it running we can remove the -a in ps args.
|
||||||
|
- docker ps -a | grep -q unifi-poller
|
||||||
|
- docker logs $(<docker_id) 2>&1 | grep -Eq "Loaded Configuration[:] /etc/unifi-poller/up.conf"
|
||||||
|
- rvm 2.0.0 do make release
|
||||||
# get deploy key for golift/homebrew-mugs.
|
# get deploy key for golift/homebrew-mugs.
|
||||||
after_success:
|
after_success:
|
||||||
- |
|
- |
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ BINARY:=unifi-poller
|
||||||
URL:=https://github.com/davidnewhall/$(BINARY)
|
URL:=https://github.com/davidnewhall/$(BINARY)
|
||||||
MAINT=David Newhall II <david at sleepers dot pro>
|
MAINT=David Newhall II <david at sleepers dot pro>
|
||||||
DESC=This daemon polls a Unifi controller at a short interval and stores the collected measurements in an Influx Database.
|
DESC=This daemon polls a Unifi controller at a short interval and stores the collected measurements in an Influx Database.
|
||||||
OSX_PKG_PREFIX=com.github.davidnewhall
|
|
||||||
GOLANGCI_LINT_ARGS=--enable-all -D gochecknoglobals
|
GOLANGCI_LINT_ARGS=--enable-all -D gochecknoglobals
|
||||||
PACKAGE:=./cmd/$(BINARY)
|
PACKAGE:=./cmd/$(BINARY)
|
||||||
LIBRARY:=./pkg/$(BINARY)
|
LIBRARY:=./pkg/$(BINARY)
|
||||||
|
|
@ -21,13 +20,13 @@ RPMVERSION:=$(shell echo $(VERSION) | tr -- - _)
|
||||||
all: man build
|
all: man build
|
||||||
|
|
||||||
# Prepare a release. Called in Travis CI.
|
# Prepare a release. Called in Travis CI.
|
||||||
release: clean test $(BINARY)-$(RPMVERSION)-$(ITERATION).x86_64.rpm $(BINARY)_$(VERSION)-$(ITERATION)_amd64.deb $(BINARY)-$(VERSION).pkg
|
release: clean test $(BINARY)-$(RPMVERSION)-$(ITERATION).x86_64.rpm $(BINARY)_$(VERSION)-$(ITERATION)_amd64.deb macos
|
||||||
# Prepareing a release!
|
# Prepareing a release!
|
||||||
mkdir -p release
|
mkdir -p release
|
||||||
gzip -9 $(BINARY).linux
|
gzip -9 $(BINARY).linux
|
||||||
gzip -9 $(BINARY).macos
|
gzip -9 $(BINARY).macos
|
||||||
mv $(BINARY)-$(RPMVERSION)-$(ITERATION).x86_64.rpm $(BINARY)_$(VERSION)-$(ITERATION)_amd64.deb \
|
mv $(BINARY)-$(RPMVERSION)-$(ITERATION).x86_64.rpm $(BINARY)_$(VERSION)-$(ITERATION)_amd64.deb \
|
||||||
$(BINARY)-$(VERSION).pkg $(BINARY).macos.gz $(BINARY).linux.gz release/
|
$(BINARY).macos.gz $(BINARY).linux.gz release/
|
||||||
# Generating File Hashes
|
# Generating File Hashes
|
||||||
openssl dgst -sha256 release/* | tee release/$(BINARY)_checksums_$(VERSION)-$(ITERATION).txt
|
openssl dgst -sha256 release/* | tee release/$(BINARY)_checksums_$(VERSION)-$(ITERATION).txt
|
||||||
|
|
||||||
|
|
@ -35,7 +34,7 @@ release: clean test $(BINARY)-$(RPMVERSION)-$(ITERATION).x86_64.rpm $(BINARY)_$(
|
||||||
clean:
|
clean:
|
||||||
# Cleaning up.
|
# Cleaning up.
|
||||||
rm -f $(BINARY){.macos,.linux,.1,}{,.gz} $(BINARY).rb
|
rm -f $(BINARY){.macos,.linux,.1,}{,.gz} $(BINARY).rb
|
||||||
rm -f $(BINARY){_,-}*.{deb,rpm,pkg} md2roff v$(VERSION).tar.gz.sha256
|
rm -f $(BINARY){_,-}*.{deb,rpm} md2roff v*.tar.gz.sha256
|
||||||
rm -f cmd/$(BINARY)/README{,.html} README{,.html} ./$(BINARY)_manual.html
|
rm -f cmd/$(BINARY)/README{,.html} README{,.html} ./$(BINARY)_manual.html
|
||||||
rm -rf package_build_* release
|
rm -rf package_build_* release
|
||||||
|
|
||||||
|
|
@ -108,38 +107,9 @@ $(BINARY)_$(VERSION)-$(ITERATION)_amd64.deb: check_fpm package_build_linux
|
||||||
--description "$(DESC)" \
|
--description "$(DESC)" \
|
||||||
--chdir package_build_linux
|
--chdir package_build_linux
|
||||||
|
|
||||||
osxpkg: clean $(BINARY)-$(VERSION).pkg
|
|
||||||
$(BINARY)-$(VERSION).pkg: check_fpm package_build_osx
|
|
||||||
@echo "Building 'osx' package for $(BINARY) version '$(VERSION)-$(ITERATION)'."
|
|
||||||
fpm -s dir -t osxpkg \
|
|
||||||
--name $(BINARY) \
|
|
||||||
--version $(VERSION) \
|
|
||||||
--iteration $(ITERATION) \
|
|
||||||
--after-install scripts/after-install.sh \
|
|
||||||
--osxpkg-identifier-prefix $(OSX_PKG_PREFIX) \
|
|
||||||
--license MIT \
|
|
||||||
--url $(URL) \
|
|
||||||
--maintainer "$(MAINT)" \
|
|
||||||
--description "$(DESC)" \
|
|
||||||
--chdir package_build_osx
|
|
||||||
|
|
||||||
docker:
|
docker:
|
||||||
docker build -t $(DOCKER_REPO)/$(BINARY) .
|
docker build -t $(DOCKER_REPO)/$(BINARY) .
|
||||||
|
|
||||||
# OSX packages use /usr/local because Apple doesn't allow writing many other places.
|
|
||||||
package_build_osx: readme man macos
|
|
||||||
# Building package environment for macOS.
|
|
||||||
mkdir -p $@/usr/local/bin $@/usr/local/etc/$(BINARY) $@/Library/LaunchAgents
|
|
||||||
mkdir -p $@/usr/local/share/man/man1 $@/usr/local/share/doc/$(BINARY)/examples $@/usr/local/var/log/$(BINARY)
|
|
||||||
# Copying the binary, config file and man page into the env.
|
|
||||||
cp $(BINARY).macos $@/usr/local/bin/$(BINARY)
|
|
||||||
cp *.1.gz $@/usr/local/share/man/man1
|
|
||||||
cp examples/*.conf.example $@/usr/local/etc/$(BINARY)/
|
|
||||||
cp LICENSE *.html examples/{*dash.json,up.conf.example} $@/usr/local/share/doc/$(BINARY)/
|
|
||||||
# These go to their own folder so the img src in the html pages continue to work.
|
|
||||||
cp examples/*.png $@/usr/local/share/doc/$(BINARY)/examples
|
|
||||||
cp init/launchd/$(OSX_PKG_PREFIX).$(BINARY).plist $@/Library/LaunchAgents/
|
|
||||||
|
|
||||||
# Build an environment that can be packaged for linux.
|
# Build an environment that can be packaged for linux.
|
||||||
package_build_linux: readme man linux
|
package_build_linux: readme man linux
|
||||||
# Building package environment for linux.
|
# Building package environment for linux.
|
||||||
|
|
@ -150,7 +120,7 @@ package_build_linux: readme man linux
|
||||||
cp *.1.gz $@/usr/share/man/man1
|
cp *.1.gz $@/usr/share/man/man1
|
||||||
cp examples/*.conf.example $@/etc/$(BINARY)/
|
cp examples/*.conf.example $@/etc/$(BINARY)/
|
||||||
cp examples/up.conf.example $@/etc/$(BINARY)/up.conf
|
cp examples/up.conf.example $@/etc/$(BINARY)/up.conf
|
||||||
cp LICENSE *.html examples/{*dash.json,up.conf.example} $@/usr/share/doc/$(BINARY)/
|
cp LICENSE *.html examples/*dash.json examples/up.conf.example $@/usr/share/doc/$(BINARY)/
|
||||||
# These go to their own folder so the img src in the html pages continue to work.
|
# These go to their own folder so the img src in the html pages continue to work.
|
||||||
cp examples/*.png $@/usr/share/doc/$(BINARY)/examples
|
cp examples/*.png $@/usr/share/doc/$(BINARY)/examples
|
||||||
cp init/systemd/$(BINARY).service $@/lib/systemd/system/
|
cp init/systemd/$(BINARY).service $@/lib/systemd/system/
|
||||||
|
|
@ -177,7 +147,7 @@ lint:
|
||||||
# Checking lint.
|
# Checking lint.
|
||||||
golangci-lint run $(GOLANGCI_LINT_ARGS)
|
golangci-lint run $(GOLANGCI_LINT_ARGS)
|
||||||
|
|
||||||
# Deprecated.
|
# Used for Homebrew only. Other disros can create packages.
|
||||||
install: man readme $(BINARY)
|
install: man readme $(BINARY)
|
||||||
@echo - Done Building! -
|
@echo - Done Building! -
|
||||||
@echo - Local installation with the Makefile is only supported on macOS.
|
@echo - Local installation with the Makefile is only supported on macOS.
|
||||||
|
|
@ -203,16 +173,16 @@ uninstall:
|
||||||
@echo " ==> You must run make uninstall as root on Linux. Recommend not running as root on macOS."
|
@echo " ==> You must run make uninstall as root on Linux. Recommend not running as root on macOS."
|
||||||
[ -x /bin/systemctl ] && /bin/systemctl disable $(BINARY) || true
|
[ -x /bin/systemctl ] && /bin/systemctl disable $(BINARY) || true
|
||||||
[ -x /bin/systemctl ] && /bin/systemctl stop $(BINARY) || true
|
[ -x /bin/systemctl ] && /bin/systemctl stop $(BINARY) || true
|
||||||
[ -x /bin/launchctl ] && [ -f ~/Library/LaunchAgents/$(OSX_PKG_PREFIX).$(BINARY).plist ] \
|
[ -x /bin/launchctl ] && [ -f ~/Library/LaunchAgents/com.github.davidnewhall.$(BINARY).plist ] \
|
||||||
&& /bin/launchctl unload ~/Library/LaunchAgents/$(OSX_PKG_PREFIX).$(BINARY).plist || true
|
&& /bin/launchctl unload ~/Library/LaunchAgents/com.github.davidnewhall.$(BINARY).plist || true
|
||||||
[ -x /bin/launchctl ] && [ -f /Library/LaunchAgents/$(OSX_PKG_PREFIX).$(BINARY).plist ] \
|
[ -x /bin/launchctl ] && [ -f /Library/LaunchAgents/com.github.davidnewhall.$(BINARY).plist ] \
|
||||||
&& /bin/launchctl unload /Library/LaunchAgents/$(OSX_PKG_PREFIX).$(BINARY).plist || true
|
&& /bin/launchctl unload /Library/LaunchAgents/com.github.davidnewhall.$(BINARY).plist || true
|
||||||
rm -rf /usr/local/{etc,bin,share/doc}/$(BINARY)
|
rm -rf /usr/local/{etc,bin,share/doc}/$(BINARY)
|
||||||
rm -f ~/Library/LaunchAgents/$(OSX_PKG_PREFIX).$(BINARY).plist
|
rm -f ~/Library/LaunchAgents/com.github.davidnewhall.$(BINARY).plist
|
||||||
rm -f /Library/LaunchAgents/$(OSX_PKG_PREFIX).$(BINARY).plist || true
|
rm -f /Library/LaunchAgents/com.github.davidnewhall.$(BINARY).plist || true
|
||||||
rm -f /etc/systemd/system/$(BINARY).service /usr/local/share/man/man1/$(BINARY).1.gz
|
rm -f /etc/systemd/system/$(BINARY).service /usr/local/share/man/man1/$(BINARY).1.gz
|
||||||
[ -x /bin/systemctl ] && /bin/systemctl --system daemon-reload || true
|
[ -x /bin/systemctl ] && /bin/systemctl --system daemon-reload || true
|
||||||
@[ -f /Library/LaunchAgents/$(OSX_PKG_PREFIX).$(BINARY).plist ] && echo " ==> Unload and delete this file manually:" && echo " sudo launchctl unload /Library/LaunchAgents/$(OSX_PKG_PREFIX).$(BINARY).plist" && echo " sudo rm -f /Library/LaunchAgents/$(OSX_PKG_PREFIX).$(BINARY).plist" || true
|
@[ -f /Library/LaunchAgents/com.github.davidnewhall.$(BINARY).plist ] && echo " ==> Unload and delete this file manually:" && echo " sudo launchctl unload /Library/LaunchAgents/com.github.davidnewhall.$(BINARY).plist" && echo " sudo rm -f /Library/LaunchAgents/com.github.davidnewhall.$(BINARY).plist" || true
|
||||||
|
|
||||||
# Don't run this unless you're ready to debug untested vendored dependencies.
|
# Don't run this unless you're ready to debug untested vendored dependencies.
|
||||||
deps:
|
deps:
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ Issue and lets discuss.
|
||||||
If you're a nerd you can probably figure it out. I'd still like some pretty
|
If you're a nerd you can probably figure it out. I'd still like some pretty
|
||||||
pictures and maybe even a Twitch VOD. Update: The installation has been
|
pictures and maybe even a Twitch VOD. Update: The installation has been
|
||||||
simplified tremendously with the
|
simplified tremendously with the
|
||||||
[creation of binary packages](https://github.com/davidnewhall/unifi-poller/wiki/Package-Install).
|
[creation of binary packages](https://github.com/davidnewhall/unifi-poller/wiki/Installation).
|
||||||
More to come!
|
More to come!
|
||||||
|
|
||||||
- Radios, Frequencies, Interfaces, vAPs
|
- Radios, Frequencies, Interfaces, vAPs
|
||||||
|
|
@ -86,5 +86,5 @@ sites side-by-side. So easy! This screenshot barely does it justice.
|
||||||
|
|
||||||
## Copyright & License
|
## Copyright & License
|
||||||
- Copyright © 2016 Garrett Bjerkhoel.
|
- Copyright © 2016 Garrett Bjerkhoel.
|
||||||
- Copyright © 2018 David Newhall II.
|
- Copyright © 2018-2019 David Newhall II.
|
||||||
- See [MIT-LICENSE](MIT-LICENSE) for license information.
|
- See [LICENSE](LICENSE) for license information.
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,5 @@
|
||||||
<string>/usr/local/var/log/unifi-poller/log</string>
|
<string>/usr/local/var/log/unifi-poller/log</string>
|
||||||
<key>StandardOutPath</key>
|
<key>StandardOutPath</key>
|
||||||
<string>/usr/local/var/log/unifi-poller/log</string>
|
<string>/usr/local/var/log/unifi-poller/log</string>
|
||||||
<key>UserName</key>
|
|
||||||
<string>nobody</string>
|
|
||||||
<key>GroupName</key>
|
|
||||||
<string>nobody</string>
|
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,15 @@
|
||||||
|
# Sytemd service unit for unifi-poller.
|
||||||
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Unifi Poller - Ubiquiti Metrics->InfluxDB
|
Description=Unifi Poller - Stores Unifi Metrics in InfluxDB
|
||||||
After=network.target
|
After=network.target
|
||||||
Requires=network.target
|
Requires=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/usr/bin/unifi-poller --config=/etc/unifi-poller/up.conf
|
ExecStart=/usr/bin/unifi-poller $DAEMON_OPTS
|
||||||
Restart=always
|
EnvironmentFile=-/etc/default/unifi-poller
|
||||||
|
EnvironmentFile=-/etc/sysconfig/unifi-poller
|
||||||
|
Restart=on-error
|
||||||
StandardOutput=syslog
|
StandardOutput=syslog
|
||||||
StandardError=syslog
|
StandardError=syslog
|
||||||
SyslogIdentifier=unifi-poller
|
SyslogIdentifier=unifi-poller
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue