diff --git a/core/poller/scripts/after-install-osx.sh b/core/poller/scripts/after-install-osx.sh index 28248634..bc2ad33c 100755 --- a/core/poller/scripts/after-install-osx.sh +++ b/core/poller/scripts/after-install-osx.sh @@ -7,6 +7,10 @@ if [ ! -f /usr/local/etc/unifi-poller/up.conf ] && [ -f /usr/local/etc/unifi-pol cp /usr/local/etc/unifi-poller/up.conf.example /usr/local/etc/unifi-poller/up.conf fi +# Allow admins to change the configuration and write logs. +chgrp -R admin /usr/local/etc/unifi-poller +chmod -R g+wr /usr/local/etc/unifi-poller + # Make sure admins can write logs. chgrp admin /usr/local/var/log chmod g=rwx /usr/local/var/log diff --git a/core/poller/scripts/local_uninstall.sh b/core/poller/scripts/local_uninstall.sh index c814e208..2c33db37 100755 --- a/core/poller/scripts/local_uninstall.sh +++ b/core/poller/scripts/local_uninstall.sh @@ -6,14 +6,22 @@ BINARY=unifi-poller -echo "Uninstall unifi-poller. If you get errors, you may need sudo." +echo "Uninstall unifi-poller. You may need sudo on Linux. Do not use sudo on macOS." # Stopping the daemon if [ -x /bin/systemctl ]; then /bin/systemctl stop ${BINARY} fi + if [ -x /bin/launchctl ] && [ -f ~/Library/LaunchAgents/com.github.davidnewhall.${BINARY}.plist ]; then - /bin/launchctl unload ~/Library/LaunchAgents/com.github.davidnewhall.${BINARY}.plist + echo Unloading ~/Library/LaunchAgents/com.github.davidnewhall.${BINARY}.plist + /bin/launchctl unload ~/Library/LaunchAgents/com.github.davidnewhall.${BINARY}.plist || true +fi + +if [ -x /bin/launchctl ] && [ -f /Library/LaunchAgents/com.github.davidnewhall.${BINARY}.plist ]; then + echo Unloading /Library/LaunchAgents/com.github.davidnewhall.${BINARY}.plist + /bin/launchctl unload /Library/LaunchAgents/com.github.davidnewhall.${BINARY}.plist || true + echo "Delete this file manually: sudo rm -f /Library/LaunchAgents/com.github.davidnewhall.${BINARY}.plist" fi # Deleting config file, binary, man page, launch agent or unit file.