From cbbaaa4dccfa57d80722e8b67504e95c2177ec12 Mon Sep 17 00:00:00 2001 From: David Newhall II Date: Thu, 30 May 2019 22:24:54 -0700 Subject: [PATCH] A few tweaks. --- Makefile | 8 ++++---- scripts/after-install.sh | 1 + scripts/local_install.sh | 6 ++++-- scripts/local_uninstall.sh | 3 ++- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 1c5e78be..595d9e59 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ PACKAGES=`find ./cmd -mindepth 1 -maxdepth 1 -type d` BINARY=unifi-poller -all: clean test man build +all: clean man build clean: for p in $(PACKAGES); do rm -f `echo $${p}|cut -d/ -f3`{,.1,.1.gz}; done @@ -22,13 +22,13 @@ test: lint man: scripts/build_manpages.sh ./ -rpm: clean test man linux +rpm: clean man linux scripts/build_linux_packages.sh rpm -deb: clean test man linux +deb: clean man linux scripts/build_linux_packages.sh deb -osxpkg: clean test man darwin +osxpkg: clean man darwin scripts/build_osx_package.sh install: all diff --git a/scripts/after-install.sh b/scripts/after-install.sh index a59d5e10..2fb3cd87 100755 --- a/scripts/after-install.sh +++ b/scripts/after-install.sh @@ -3,4 +3,5 @@ # This file is used by rpm and deb packages. FPM use. systemctl daemon-reload +systemctl enable unifi-poller systemctl restart unifi-poller diff --git a/scripts/local_install.sh b/scripts/local_install.sh index 05a4dbce..74a082b0 100755 --- a/scripts/local_install.sh +++ b/scripts/local_install.sh @@ -29,6 +29,8 @@ fi # Making systemd happy by telling it to reload. if [ -x /bin/systemctl ]; then /bin/systemctl --system daemon-reload + /bin/systemctl start unifi-poller + /bin/systemctl enable unifi-poller fi echo "Installation Complete. Edit the config file @ /usr/local/etc/${BINARY}/up.conf" @@ -36,7 +38,7 @@ echo "Then start the daemon with:" if [ -d ~/Library/LaunchAgents ]; then echo " launchctl load ~/Library/LaunchAgents/com.github.davidnewhall.${BINARY}.plist" fi -if [ -d /etc/systemd/system ]; then - echo " sudo /bin/systemctl start ${BINARY}" +if [ -x /bin/systemctl ]; then + echo " sudo /bin/systemctl restart ${BINARY}" fi echo "Examine the log file at: /usr/local/var/log/${BINARY}.log (logs may go elsewhere on linux, check syslog)" diff --git a/scripts/local_uninstall.sh b/scripts/local_uninstall.sh index 2c33db37..fd5abce8 100755 --- a/scripts/local_uninstall.sh +++ b/scripts/local_uninstall.sh @@ -10,7 +10,8 @@ echo "Uninstall unifi-poller. You may need sudo on Linux. Do not use sudo on mac # Stopping the daemon if [ -x /bin/systemctl ]; then - /bin/systemctl stop ${BINARY} + /bin/systemctl disable ${BINARY} + /bin/systemctl stop ${BINARY} fi if [ -x /bin/launchctl ] && [ -f ~/Library/LaunchAgents/com.github.davidnewhall.${BINARY}.plist ]; then