Merge pull request #137 from Ornias1993/poller_update_fix

Don't try to update unifi poller if it isn't installed
This commit is contained in:
Kjeld Schouten-Lebbing 2020-05-27 11:05:12 +02:00 committed by GitHub
commit 05c58b6e6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,10 @@
# This file contains the update script for unifi # This file contains the update script for unifi
# Unifi Controller is updated through pkg, Unifi-Poller is not. This script updates Unifi-Poller # Unifi Controller is updated through pkg, Unifi-Poller is not. This script updates Unifi-Poller
if [[ ! "${!POLLER}" ]]; then
echo "Skipping Unifi Poller for update, not installed"
else
FILE_NAME=$(curl -s https://api.github.com/repos/unifi-poller/unifi-poller/releases/latest | jq -r ".assets[] | select(.name | contains(\"amd64.txz\")) | .name") FILE_NAME=$(curl -s https://api.github.com/repos/unifi-poller/unifi-poller/releases/latest | jq -r ".assets[] | select(.name | contains(\"amd64.txz\")) | .name")
DOWNLOAD=$(curl -s https://api.github.com/repos/unifi-poller/unifi-poller/releases/latest | jq -r ".assets[] | select(.name | contains(\"amd64.txz\")) | .browser_download_url") DOWNLOAD=$(curl -s https://api.github.com/repos/unifi-poller/unifi-poller/releases/latest | jq -r ".assets[] | select(.name | contains(\"amd64.txz\")) | .browser_download_url")
@ -14,8 +18,9 @@ else
# Download and install the package # Download and install the package
iocage exec "${1}" fetch -o /config "${DOWNLOAD}" iocage exec "${1}" fetch -o /config "${DOWNLOAD}"
iocage exec "${1}" pkg install -qy /config/"${FILE_NAME}" iocage exec "${1}" pkg install -qy /config/"${FILE_NAME}"
iocage exec "${1}" service unifi restart
iocage exec "${1}" service unifi_poller restart iocage exec "${1}" service unifi_poller restart
fi fi
fi
iocage exec "${1}" service unifi restart
echo "Update complete!" echo "Update complete!"