routeros_firmware: Use real tmpfile
This commit is contained in:
parent
d282b132ab
commit
776b562abe
1 changed files with 5 additions and 4 deletions
|
@ -46,15 +46,16 @@ if [ -z "$checksum" ]; then
|
|||
fi
|
||||
|
||||
echo "Downloading new package '${packagename}'"
|
||||
trap 'rm -f -- "${packagename}.tmp"' EXIT
|
||||
curl -sSf -o "${packagename}.tmp" "$packageurl"
|
||||
tmpfile="$(mktemp -p .)"
|
||||
trap 'rm -f -- "$tmpfile"' EXIT
|
||||
curl -sSf -o "$tmpfile" "$packageurl"
|
||||
|
||||
if [ "$(sha256sum "${packagename}.tmp" | cut -d " " -f 1)" != "$checksum" ]; then
|
||||
if [ "$(sha256sum "$tmpfile" | cut -d " " -f 1)" != "$checksum" ]; then
|
||||
echo "ERR: Checksum check failed, not saving package" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mv "${packagename}.tmp" "$packagename"
|
||||
mv "$tmpfile" "$packagename"
|
||||
|
||||
echo
|
||||
curl -sSf "https://cdn.mikrotik.com/routeros/$(echo "$packagename" | cut -d "-" -f 2)/CHANGELOG"
|
||||
|
|
Loading…
Add table
Reference in a new issue