Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlangille/54924a9cfcdb014306eb042c19014cfb to your computer and use it in GitHub Desktop.
Save dlangille/54924a9cfcdb014306eb042c19014cfb to your computer and use it in GitHub Desktop.
download stuff, make it LATEST - see https://twitter.com/DLangille/status/1522026048229097472
#!/bin/sh
DST="/tmp/dvl"
WGET="/usr/local/bin/wget"
URL_BASE="https://example.net/downloads/stuff/"
mkdir $DST
cd $DST
$WGET -O new_download "$URL_BASE/LATEST"
LATEST=$(cat new_download)
if [ -d $LATEST ]
then
exit
fi
$WGET -P $LATEST --no-if-modified-since --mirror --no-parent -r -nd --https-only "$URL_BASE/$LATEST/"
mv new_download LATEST
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment