diff --git a/Makefile b/Makefile index c564273e..167a7103 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ $(PACKAGE_SCRIPTS) \ --vendor "$(VENDOR)" \ --description "$(DESC)" \ --config-files "/etc/$(BINARY)/$(CONFIG_FILE)" \ ---freebsd-origin "golift/$(BINARY)" +--freebsd-origin "$(BINARY)/$(BINARY)" endef PLUGINS:=$(patsubst plugins/%/main.go,%,$(wildcard plugins/*/main.go)) diff --git a/scripts/after-install.sh b/scripts/after-install.sh index acf7bafe..a465fdf4 100755 --- a/scripts/after-install.sh +++ b/scripts/after-install.sh @@ -1,11 +1,14 @@ -#!/bin/bash +#!/bin/sh -# This file is used by deb and rpm packages. -# FPM adds this as the after-install script. +# This file is used by txz, deb and rpm packages. +# FPM adds this as the after-install script to all packages. if [ -x "/bin/systemctl" ]; then # Reload and restart - this starts the application as user nobody. /bin/systemctl daemon-reload /bin/systemctl enable unifi-poller /bin/systemctl restart unifi-poller +elif [ -x /usr/sbin/service ]; then + # Do not start or restart on freebsd. That's "bad practice." + /usr/sbin/service unifi-poller enabled || /usr/sbin/service unifi-poller enable fi diff --git a/scripts/before-remove.sh b/scripts/before-remove.sh index 83ae4004..a6f2fce3 100755 --- a/scripts/before-remove.sh +++ b/scripts/before-remove.sh @@ -1,6 +1,6 @@ -#!/bin/bash +#!/bin/sh -# This file is used by rpm and deb packages. FPM use. +# This file is used by txz, rpm and deb packages. FPM use. if [ "$1" = "upgrade" ] || [ "$1" = "1" ] ; then exit 0 @@ -9,4 +9,7 @@ fi if [ -x "/bin/systemctl" ]; then /bin/systemctl stop unifi-poller /bin/systemctl disable unifi-poller +elif [ -x /usr/sbin/service ]; then + /usr/sbin/service unifi-poller stop + /usr/sbin/service unifi-poller disable fi