Add support for checking latest version of unifi (#356)

This commit is contained in:
Mathias Fredriksson 2018-03-19 00:59:50 +02:00 committed by Jess Frazelle
parent 9c38f37fa4
commit 444d00e98a

View File

@ -53,12 +53,30 @@ get_latest() {
local current=$(cat "${dir}/Dockerfile" | grep -m 1 VERSION | awk '{print $(NF)}')
compare "$name" "$dir" "$tag" "$current" "https://github.com/${repo}/releases"
}
get_latest_unifi() {
local latest current
latest=$(curl -sSL http://www.ubnt.com/downloads/unifi/debian/dists/cloudkey-stable/ubiquiti/binary-armhf/Packages \
| awk 'BEGIN {FS="\n"; RS="";} /^Package: unifi/' \
| awk '/^Version:/ {print $2}' \
| cut -d- -f1)
current=$(grep -m 1 UNIFI_VERSION unifi/Dockerfile | tr '"' ' ' | awk '{print $(NF)}')
compare unifi unifi "$latest" "$current" https://www.ubnt.com/download/unifi
}
compare() {
local name="$1" dir="$2" tag="$3" current="$4" releases="$5"
if [[ "$tag" =~ "$current" ]] || [[ "$name" =~ "$current" ]] || [[ "$current" =~ "$tag" ]] || [[ "$current" == "master" ]]; then
echo -e "\e[36m${dir}:\e[39m current ${current} | ${tag} | ${name}"
else
# add to the bad versions
bad_versions+=( "${dir}" )
echo -e "\e[31m${dir}:\e[39m current ${current} | ${tag} | ${name} | https://github.com/${repo}/releases"
echo -e "\e[31m${dir}:\e[39m current ${current} | ${tag} | ${name} | ${releases}"
fi
}
@ -91,12 +109,19 @@ znc/znc
apache/zookeeper
)
other_projects=(
unifi
)
bad_versions=()
main() {
for p in ${projects[@]}; do
get_latest "$p"
done
for p in ${other_projects[@]}; do
get_latest_"$p"
done
if [[ ${#bad_versions[@]} -ne 0 ]]; then
echo