Upgrade dep, more readme updates.

This commit is contained in:
David Newhall II
2019-01-26 02:08:09 -08:00
parent 34bda3d10b
commit d09bd354f4
2 changed files with 41 additions and 8 deletions

View File

@@ -14,20 +14,34 @@ linux:
install: man test build
@echo "If you get errors, you may need sudo."
# Install binary.
GOBIN=/usr/local/bin go install -ldflags "-w -s" ./...
# Make folders and install man page.
mkdir -p /usr/local/etc/unifi-poller /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.
test -f /usr/local/etc/unifi-poller/up.conf || cp up.conf.example /usr/local/etc/unifi-poller/up.conf
test -d ~/Library/LaunchAgents && cp startup/launchd/com.github.davidnewhall.unifi-poller.plist ~/Library/LaunchAgents || true
test -d /etc/systemd/system && cp startup/systemd/unifi-poller.service /etc/systemd/system || true
mv *.1.gz /usr/local/share/man/man1
# Make systemd happy by telling it to reload.
test -x /bin/systemctl && /bin/systemctl --system daemon-reload
@echo "Installation Complete. Edit the config file @ /usr/local/etc/unifi-poller/up.conf "
@echo "Then start the daemon with:"
@test -d ~/Library/LaunchAgents && echo " launchctl load ~/Library/LaunchAgents/com.github.davidnewhall.unifi-poller.plist"
@test -d /etc/systemd/system && echo " sudo /bin/systemctl start unifi-poller"
@echo "Examine the log file at: /usr/local/var/log/unifi-poller.log (logs may go elsewhere on linux, check syslog)"
uninstall:
@echo "If you get errors, you may need sudo."
test -f ~/Library/LaunchAgents/com.github.davidnewhall.unifi-poller.plist && launchctl unload ~/Library/LaunchAgents/com.github.davidnewhall.unifi-poller.plist || true
test -f /etc/systemd/system/unifi-poller.service && systemctl stop unifi-poller || true
# Stop the daemon
test -x /bin/systemctl && /bin/systemctl stop unifi-poller
test -x /bin/launchctl && /bin/launchctl unload ~/Library/LaunchAgents/com.github.davidnewhall.unifi-poller.plist
# Delete 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 -f ~/Library/LaunchAgents/com.github.davidnewhall.unifi-poller.plist
rm -f /etc/systemd/system/unifi-poller.service
# Make systemd happy by telling it to reload.
test -x /bin/systemctl && /bin/systemctl --system daemon-reload
test: lint
for p in $(PACKAGES) $(LIBRARYS); do go test -race -covermode=atomic $${p}; done