Changed xpath to use 'last()'

When I created PR #374, the sparkle feed had just one entry. Turns out, that Docker uses the last entry of the feed for the latest version.
With simply changing xpath to use `[last()]`, the version checking now behaves as expected.
This commit is contained in:
Adrian Bühler
2022-01-14 09:33:42 +01:00
committed by GitHub
parent 69372e4929
commit d2381d2053

View File

@@ -3,10 +3,10 @@ docker)
type="dmg"
if [[ $(arch) == arm64 ]]; then
downloadURL="https://desktop.docker.com/mac/stable/arm64/Docker.dmg"
appNewVersion=$( curl -fs "https://desktop.docker.com/mac/main/arm64/appcast.xml" | xpath '(//rss/channel/item/enclosure/@sparkle:shortVersionString)[1]' 2>/dev/null | cut -d '"' -f2 )
appNewVersion=$( curl -fs "https://desktop.docker.com/mac/main/arm64/appcast.xml" | xpath '(//rss/channel/item/enclosure/@sparkle:shortVersionString)[last()]' 2>/dev/null | cut -d '"' -f2 )
elif [[ $(arch) == i386 ]]; then
downloadURL="https://desktop.docker.com/mac/stable/amd64/Docker.dmg"
appNewVersion=$( curl -fs "https://desktop.docker.com/mac/main/amd64/appcast.xml" | xpath '(//rss/channel/item/enclosure/@sparkle:shortVersionString)[1]' 2>/dev/null | cut -d '"' -f2 )
appNewVersion=$( curl -fs "https://desktop.docker.com/mac/main/amd64/appcast.xml" | xpath '(//rss/channel/item/enclosure/@sparkle:shortVersionString)[last()]' 2>/dev/null | cut -d '"' -f2 )
fi
expectedTeamID="9BNSXJN65R"
;;