Bump version, fix Makefile.

This commit is contained in:
David Newhall II 2019-01-26 15:49:58 -08:00
parent e165a47162
commit ae112d269e
2 changed files with 26 additions and 24 deletions

View File

@ -1,5 +1,6 @@
PACKAGES=`find ./cmd -mindepth 1 -maxdepth 1 -type d` PACKAGES=`find ./cmd -mindepth 1 -maxdepth 1 -type d`
LIBRARYS=./unidev LIBRARYS=
BINARY=unifi-poller
all: clean man build all: clean man build
@ -14,34 +15,35 @@ linux:
install: man test build install: man test build
@echo "If you get errors, you may need sudo." @echo "If you get errors, you may need sudo."
# Install binary. # Install binary. binary.
GOBIN=/usr/local/bin go install -ldflags "-w -s" ./... GOBIN=/usr/local/bin go install -ldflags "-w -s" ./...
# Make folders and install man page. # Making config folders and installing man page.
mkdir -p /usr/local/etc/unifi-poller /usr/local/share/man/man1 mkdir -p /usr/local/etc/$(BINARY) /usr/local/share/man/man1
mv *.1.gz /usr/local/share/man/man1 mv *.1.gz /usr/local/share/man/man1
# Install config file, man page and launch agent or systemd unit file. # Installing config file, man page and launch agent or systemd unit file.
test -f /usr/local/etc/unifi-poller/up.conf || cp up.conf.example /usr/local/etc/unifi-poller/up.conf test -f /usr/local/etc/$(BINARY)/up.conf || cp up.conf.example /usr/local/etc/$(BINARY)/up.conf
test -d ~/Library/LaunchAgents && cp startup/launchd/com.github.davidnewhall.unifi-poller.plist ~/Library/LaunchAgents || true test -d ~/Library/LaunchAgents && cp startup/launchd/com.github.davidnewhall.$(BINARY).plist ~/Library/LaunchAgents || true
test -d /etc/systemd/system && cp startup/systemd/unifi-poller.service /etc/systemd/system || true test -d /etc/systemd/system && cp startup/systemd/$(BINARY).service /etc/systemd/system || true
# Make systemd happy by telling it to reload. # Making systemd happy by telling it to reload.
test -x /bin/systemctl && /bin/systemctl --system daemon-reload test -x /bin/systemctl && /bin/systemctl --system daemon-reload || true
@echo "Installation Complete. Edit the config file @ /usr/local/etc/unifi-poller/up.conf " @echo
@echo "Installation Complete. Edit the config file @ /usr/local/etc/$(BINARY)/up.conf "
@echo "Then start the daemon with:" @echo "Then start the daemon with:"
@test -d ~/Library/LaunchAgents && echo " launchctl load ~/Library/LaunchAgents/com.github.davidnewhall.unifi-poller.plist" @test -d ~/Library/LaunchAgents && echo " launchctl load ~/Library/LaunchAgents/com.github.davidnewhall.$(BINARY).plist" || true
@test -d /etc/systemd/system && echo " sudo /bin/systemctl start unifi-poller" @test -d /etc/systemd/system && echo " sudo /bin/systemctl start $(BINARY)" || true
@echo "Examine the log file at: /usr/local/var/log/unifi-poller.log (logs may go elsewhere on linux, check syslog)" @echo "Examine the log file at: /usr/local/var/log/$(BINARY).log (logs may go elsewhere on linux, check syslog)"
uninstall: uninstall:
@echo "If you get errors, you may need sudo." @echo "If you get errors, you may need sudo."
# Stop the daemon # Stopping the daemon
test -x /bin/systemctl && /bin/systemctl stop unifi-poller test -x /bin/systemctl && /bin/systemctl stop $(BINARY) || true
test -x /bin/launchctl && /bin/launchctl unload ~/Library/LaunchAgents/com.github.davidnewhall.unifi-poller.plist test -x /bin/launchctl && /bin/launchctl unload ~/Library/LaunchAgents/com.github.davidnewhall.$(BINARY).plist || true
# Delete config file, binary, man page, launch agent or unit file. # Deleting config file, binary, man page, launch agent or unit file.
rm -rf /usr/local/{etc,bin}/unifi-poller /usr/local/share/man/man1/unifi-poller.1.gz rm -rf /usr/local/{etc,bin}/$(BINARY) /usr/local/share/man/man1/$(BINARY).1.gz
rm -f ~/Library/LaunchAgents/com.github.davidnewhall.unifi-poller.plist rm -f ~/Library/LaunchAgents/com.github.davidnewhall.$(BINARY).plist
rm -f /etc/systemd/system/unifi-poller.service rm -f /etc/systemd/system/$(BINARY).service
# Make systemd happy by telling it to reload. # Making systemd happy by telling it to reload.
test -x /bin/systemctl && /bin/systemctl --system daemon-reload test -x /bin/systemctl && /bin/systemctl --system daemon-reload || true
test: lint test: lint
for p in $(PACKAGES) $(LIBRARYS); do go test -race -covermode=atomic $${p}; done for p in $(PACKAGES) $(LIBRARYS); do go test -race -covermode=atomic $${p}; done

View File

@ -3,7 +3,7 @@ package main
import "time" import "time"
// Version is loosely followed. // Version is loosely followed.
var Version = "v0.3.0" var Version = "v1.0.0"
const ( const (
// App defaults in case they're missing from the config. // App defaults in case they're missing from the config.