routeros_firmware: Fix download for new html
This commit is contained in:
parent
e57cd06891
commit
e2fb492195
1 changed files with 13 additions and 4 deletions
|
@ -17,8 +17,19 @@ if [ $# -gt 0 ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
packageurl="$(curl -sSf "https://mikrotik.com/download" | \
|
||||
sed -n 's/.*<a href="\(.*routeros-[0-9\.]*-arm\.npk\)"[> ].*/\1/p')"
|
||||
packageinfo=$(curl -sSf "https://mikrotik.com/download" | awk -F '"' '
|
||||
{
|
||||
if (!url && $0 ~ /routeros-[0-9\.]+-arm.npk/) {
|
||||
url=$2
|
||||
} else if (!found && url && $0 ~ /data-checksum-sha256/) {
|
||||
print url " " $6
|
||||
found = 1
|
||||
}
|
||||
}
|
||||
')
|
||||
|
||||
packageurl="$(echo "$packageinfo" | cut -d " " -f 1)"
|
||||
checksum="$(echo "$packageinfo" | cut -d " " -f 2)"
|
||||
if [ -z "$packageurl" ]; then
|
||||
echo "ERR: Got empty package URL, exiting" 1>&2
|
||||
exit 1
|
||||
|
@ -29,8 +40,6 @@ if [ -f "$packagename" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
checksum="$(curl -sSf "https://mikrotik.com/download" | \
|
||||
sed -n 's/.*routeros-[0-9\.]*-arm\.npk<\/td>.*<td>SHA256<\/td><td>\(.*\)<\/td>.*/\1/p')"
|
||||
if [ -z "$checksum" ]; then
|
||||
echo "ERR: Failed to determine package checksum" 1>&2
|
||||
exit 1
|
||||
|
|
Loading…
Add table
Reference in a new issue