#! /usr/bin/env sh img="prololive.img" img_tmp="${img}.tmp" img_url="http://srv.ordiclic.eu/prololive.img" if [ ! -f "${img}" ] then local_size=0 remote_size=1 else remote_size=$(curl -s --head "${img_url}" | grep Content-Length | grep -oE [0-9]+) local_size=$(stat --printf="%s" "${img}") fi if [ "${local_size}" -eq "${remote_size}" ] then echo "Remote image is probably the same" exit fi rm -f "${img}" wget "${img_url}" -O "${img_tmp}" || { rm "${img_tmp}" echo "Failed to download image" >&2 exit 1 } mv ${img_tmp} ${img}