Skip to content

Instantly share code, notes, and snippets.

@inolen
Created January 27, 2020 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inolen/75a836f48a2e54d8d4bd5bf3d9e79856 to your computer and use it in GitHub Desktop.
Save inolen/75a836f48a2e54d8d4bd5bf3d9e79856 to your computer and use it in GitHub Desktop.
redream latest url
#!/bin/bash
get_latest_url() {
local REDREAM_URL=https://redream.io
local REDREAM_TARGET=aarch32-raspberry-linux
wget -qO /tmp/redream-download.html ${REDREAM_URL}/download
local links=$( \
grep -E 'href="([^"]*redream.'$REDREAM_TARGET'[^"]+)' /tmp/redream-download.html | \
sed -E 's/.*href="([^"]*redream.'$REDREAM_TARGET'[^"]+)".*/\1/g' | \
uniq \
)
rm /tmp/redream-download.html
local latest=$(echo "$links" | head -n1)
echo ${REDREAM_URL}${latest}
}
LATEST_URL=$(get_latest_url)
echo $LATEST_URL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment