fix merge conflict.

This commit is contained in:
David Newhall II 2019-06-14 00:37:44 -07:00
parent 3d89c3fcba
commit ba0c348340
5 changed files with 22 additions and 73 deletions

1
.gitignore vendored
View File

@ -4,7 +4,6 @@
/unifi-poller*.1
/unifi-poller*.deb
/unifi-poller*.rpm
/unifi-poller*.pkg
/unifi-poller.macos
/unifi-poller.linux
/unifi-poller.rb

View File

@ -1,17 +1,19 @@
language: go
# so we can build an osx package.
os: osx
addons:
homebrew:
apt:
packages:
- ruby-dev
- rpm
- gnu-tar
- build-essential
- git
- libgnome-keyring-dev
- fakeroot
go:
- 1.12.x
before_install:
- mkdir -p $GOPATH/bin
# 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
# 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

View File

@ -5,7 +5,6 @@ BINARY:=unifi-poller
URL:=https://github.com/davidnewhall/$(BINARY)
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.
OSX_PKG_PREFIX=com.github.davidnewhall
GOLANGCI_LINT_ARGS=--enable-all -D gochecknoglobals
PACKAGE:=./cmd/$(BINARY)
LIBRARY:=./pkg/$(BINARY)
@ -35,7 +34,7 @@ release: clean test $(BINARY)-$(RPMVERSION)-$(ITERATION).x86_64.rpm $(BINARY)_$(
clean:
# Cleaning up.
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,pkg} md2roff v*.tar.gz.sha256
rm -f cmd/$(BINARY)/README{,.html} README{,.html} ./$(BINARY)_manual.html
rm -rf package_build_* release
@ -108,38 +107,9 @@ $(BINARY)_$(VERSION)-$(ITERATION)_amd64.deb: check_fpm package_build_linux
--description "$(DESC)" \
--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 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.
package_build_linux: readme man linux
# Building package environment for linux.
@ -203,16 +173,16 @@ uninstall:
@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 stop $(BINARY) || true
[ -x /bin/launchctl ] && [ -f ~/Library/LaunchAgents/$(OSX_PKG_PREFIX).$(BINARY).plist ] \
&& /bin/launchctl unload ~/Library/LaunchAgents/$(OSX_PKG_PREFIX).$(BINARY).plist || true
[ -x /bin/launchctl ] && [ -f /Library/LaunchAgents/$(OSX_PKG_PREFIX).$(BINARY).plist ] \
&& /bin/launchctl unload /Library/LaunchAgents/$(OSX_PKG_PREFIX).$(BINARY).plist || true
[ -x /bin/launchctl ] && [ -f ~/Library/LaunchAgents/com.github.davidnewhall.$(BINARY).plist ] \
&& /bin/launchctl unload ~/Library/LaunchAgents/com.github.davidnewhall.$(BINARY).plist || true
[ -x /bin/launchctl ] && [ -f /Library/LaunchAgents/com.github.davidnewhall.$(BINARY).plist ] \
&& /bin/launchctl unload /Library/LaunchAgents/com.github.davidnewhall.$(BINARY).plist || true
rm -rf /usr/local/{etc,bin,share/doc}/$(BINARY)
rm -f ~/Library/LaunchAgents/$(OSX_PKG_PREFIX).$(BINARY).plist
rm -f /Library/LaunchAgents/$(OSX_PKG_PREFIX).$(BINARY).plist || true
rm -f ~/Library/LaunchAgents/com.github.davidnewhall.$(BINARY).plist
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
[ -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.
deps:

View File

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.github.davidnewhall.unifi-poller</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/unifi-poller</string>
<string>-c</string>
<string>/usr/local/etc/unifi-poller/up.conf</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardErrorPath</key>
<string>/usr/local/var/log/unifi-poller/log</string>
<key>StandardOutPath</key>
<string>/usr/local/var/log/unifi-poller/log</string>
<key>UserName</key>
<string>nobody</string>
<key>GroupName</key>
<string>nobody</string>
</dict>
</plist>

View File

@ -1,11 +1,15 @@
# Sytemd service unit for unifi-poller.
[Unit]
Description=Unifi Poller - Ubiquiti Metrics->InfluxDB
Description=Unifi Poller - Stores Unifi Metrics in InfluxDB
After=network.target
Requires=network.target
[Service]
ExecStart=/usr/bin/unifi-poller --config=/etc/unifi-poller/up.conf
Restart=always
ExecStart=/usr/bin/unifi-poller $DAEMON_OPTS
EnvironmentFile=-/etc/default/unifi-poller
EnvironmentFile=-/etc/sysconfig/unifi-poller
Restart=on-error
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=unifi-poller