Fitz Mutch
Senior Member
I never found an easy way to automatically name the downloaded "master.tar.gz" file, so I wrote this script. It will download the latest development snapshot from Github and automatically give it an appropriate filename. Example:
380.65-beta3-cf1bb54.tar.gz
/jffs/scripts/dl-merlin.sh
If you need to download through a proxy, just add "--socks5-hostname 192.168.1.1:9050" to the curl commands.
380.65-beta3-cf1bb54.tar.gz
/jffs/scripts/dl-merlin.sh
Code:
#!/bin/sh
VERSION_CONF=$(/usr/sbin/curl -L -s https://raw.githubusercontent.com/RMerl/asuswrt-merlin/master/release/src-rt/version.conf)
eval $(/bin/echo $VERSION_CONF | /bin/sed 's# #\n#g' | grep SERIALNO)
eval $(/bin/echo $VERSION_CONF | /bin/sed 's# #\n#g' | grep EXTENDNO)
LATEST_COMMIT=$(/usr/sbin/curl -L -s https://github.com/RMerl/asuswrt-merlin | # download HTML using curl
/usr/bin/tr -d '\n' | # remove carriage returns
/bin/sed 's#</#\n</#g' | # tokenize by HTML tag
/bin/grep 'Latest commit' | # locate lines with "Latest commit"
/bin/sed 's# *# #g' | # convert all multispaces to single space
/bin/sed 's# $##g' | # remove trailing space
/bin/sed 's# #\n#g' | # tokenize by space
/usr/bin/tail -n1) # get the last token
FILENAME="$SERIALNO-$EXTENDNO-$LATEST_COMMIT.tar.gz"
/bin/echo
/bin/echo "Downloading $FILENAME ..."
/bin/echo
[ -n "$FILENAME" ] && /usr/sbin/curl -L -S --retry 90 --retry-delay 5 -o "$FILENAME" https://github.com/RMerl/asuswrt-merlin/archive/master.tar.gz
If you need to download through a proxy, just add "--socks5-hostname 192.168.1.1:9050" to the curl commands.
Last edited: