Deprecate make install
This commit is contained in:
parent
3419469b28
commit
c04ceaf820
|
|
@ -104,22 +104,20 @@ package_build_osx: man macos
|
|||
cp *.1.gz $@/usr/local/share/man/man1
|
||||
cp examples/*.conf.example $@/usr/local/etc/$(BINARY)/
|
||||
cp examples/* $@/usr/local/share/doc/$(BINARY)/
|
||||
cp init/launchd/com.github.davidnewhall.unifi-poller.plist $@/Library/LaunchAgents/
|
||||
cp init/launchd/com.github.davidnewhall.$(BINARY).plist $@/Library/LaunchAgents/
|
||||
|
||||
# Build an environment that can be packaged for linux.
|
||||
package_build_linux: man linux
|
||||
# Building package environment for linux.
|
||||
mkdir -p $@/usr/bin $@/etc/$(BINARY) $@/lib/systemd/system
|
||||
mkdir -p $@/usr/share/man/man1 $@/usr/share/doc/$(BINARY)
|
||||
# Copying the binary, config file and man page into the env.
|
||||
# Copying the binary, config file, unit file, and man page into the env.
|
||||
cp $(BINARY).linux $@/usr/bin/$(BINARY)
|
||||
cp *.1.gz $@/usr/share/man/man1
|
||||
cp examples/*.conf.example $@/etc/$(BINARY)/
|
||||
cp examples/up.conf.example $@/etc/$(BINARY)/up.conf
|
||||
cp examples/* $@/usr/share/doc/$(BINARY)/
|
||||
# Fixing the paths in the systemd unit file before copying it into the emv.
|
||||
sed "s%ExecStart.*%ExecStart=/usr/bin/$(BINARY) --config=/etc/$(BINARY)/up.conf%" \
|
||||
init/systemd/unifi-poller.service > $@/lib/systemd/system/$(BINARY).service
|
||||
cp init/systemd/$(BINARY).service $@/lib/systemd/system/
|
||||
|
||||
check_fpm:
|
||||
@fpm --version > /dev/null || (echo "FPM missing. Install FPM: https://fpm.readthedocs.io/en/latest/installing.html" && false)
|
||||
|
|
@ -134,9 +132,14 @@ lint:
|
|||
# Checking lint.
|
||||
golangci-lint run --enable-all -D gochecknoglobals
|
||||
|
||||
# Install locally into /usr/local. Not recommended.
|
||||
install: man
|
||||
scripts/local_install.sh
|
||||
# Deprecated.
|
||||
install:
|
||||
@echo - Local installation with the Makefile is no longer possible.
|
||||
@echo If you wish to install the application manually, check out the wiki: \
|
||||
https://github.com/davidnewhall/unifi-poller/wiki/Installation
|
||||
@echo - Otherwise, build and install a package: make rpm, make deb, make osxpkg
|
||||
@echo See the Package Install wiki for more info: \
|
||||
https://github.com/davidnewhall/unifi-poller/wiki/Package-Install
|
||||
|
||||
# If you installed with `make install` run `make uninstall` before installing a binary package.
|
||||
# This will remove the package install from macOS, it will not remove a package install from Linux.
|
||||
|
|
@ -147,11 +150,11 @@ uninstall:
|
|||
&& /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}/$(BINARY) /usr/local/share/man/man1/$(BINARY).1.gz
|
||||
rm -rf /usr/local/{etc,bin,share/doc}/$(BINARY)
|
||||
rm -f ~/Library/LaunchAgents/com.github.davidnewhall.$(BINARY).plist
|
||||
rm -f /etc/systemd/system/$(BINARY).service
|
||||
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/launchctl ] && [ -f /Library/LaunchAgents/com.github.davidnewhall.$(BINARY).plist ] \
|
||||
@[ -f /Library/LaunchAgents/com.github.davidnewhall.$(BINARY).plist ] \
|
||||
&& echo " ==> Delete this file manually: sudo rm -f /Library/LaunchAgents/com.github.davidnewhall.$(BINARY).plist" || true
|
||||
|
||||
# Don't run this unless you're ready to debug untested vendored dependencies.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
# unifi-poller primary configuration file. #
|
||||
# copy this file to: /usr/local/etc/unifi-poller/up.conf #
|
||||
# commented lines are defaults, uncomment to change. #
|
||||
##########################################################
|
||||
# unifi-poller primary configuration file. #
|
||||
# commented lines are defaults, uncomment to change. #
|
||||
######################################################
|
||||
|
||||
# If the controller has more than one site, specify which sites to poll here.
|
||||
# If only one site, "default" is likely the correct name.
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ After=network.target
|
|||
Requires=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/local/bin/unifi-poller --config=/usr/local/etc/unifi-poller/up.conf
|
||||
ExecStart=/usr/bin/unifi-poller --config=/etc/unifi-poller/up.conf
|
||||
Restart=always
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog
|
||||
|
|
|
|||
|
|
@ -6,5 +6,7 @@ if [ "$1" = "upgrade" ] || [ "$1" = "1" ] ; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
systemctl stop unifi-poller
|
||||
systemctl disable unifi-poller
|
||||
if [ -x "/bin/systemctl" ]; then
|
||||
/bin/systemctl stop unifi-poller
|
||||
/bin/systemctl disable unifi-poller
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,44 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This script creates a local installation of unifi-poller.
|
||||
# Recommend using Makefile to invoke: make install
|
||||
# Supports Linux (systemd only) and macOS.
|
||||
|
||||
BINARY=unifi-poller
|
||||
|
||||
echo "Installing unifi-poller. If you get errors, you may need sudo."
|
||||
|
||||
# Install binary.
|
||||
GOBIN=/usr/local/bin go install -ldflags "-w -s" ./...
|
||||
|
||||
# Making config folders and installing man page.
|
||||
mkdir -p /usr/local/etc/${BINARY} /usr/local/share/man/man1
|
||||
mv *.1.gz /usr/local/share/man/man1
|
||||
|
||||
# Installing config file, man page and launch agent or systemd unit file.
|
||||
if [ ! -f /usr/local/etc/${BINARY}/up.conf ]; then
|
||||
cp examples/up.conf.example /usr/local/etc/${BINARY}/up.conf
|
||||
fi
|
||||
if [ -d ~/Library/LaunchAgents ]; then
|
||||
cp init/launchd/com.github.davidnewhall.${BINARY}.plist ~/Library/LaunchAgents
|
||||
fi
|
||||
if [ -d /etc/systemd/system ]; then
|
||||
cp init/systemd/${BINARY}.service /etc/systemd/system
|
||||
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"
|
||||
echo "Then start the daemon with:"
|
||||
if [ -d ~/Library/LaunchAgents ]; then
|
||||
echo " launchctl load ~/Library/LaunchAgents/com.github.davidnewhall.${BINARY}.plist"
|
||||
fi
|
||||
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)"
|
||||
Loading…
Reference in New Issue