You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

update_img.sh 551B

123456789101112131415161718192021222324252627282930
  1. #! /usr/bin/env sh
  2. img="prololive.img"
  3. img_tmp="${img}.tmp"
  4. img_url="http://srv.ordiclic.eu/prololive.img"
  5. if [ ! -f "${img}" ]
  6. then
  7. local_size=0
  8. remote_size=1
  9. else
  10. remote_size=$(curl -s --head "${img_url}" | grep Content-Length | grep -oE [0-9]+)
  11. local_size=$(stat --printf="%s" "${img}")
  12. fi
  13. if [ "${local_size}" -eq "${remote_size}" ]
  14. then
  15. echo "Remote image is probably the same"
  16. exit
  17. fi
  18. rm -f "${img}"
  19. wget "${img_url}" -O "${img_tmp}" || {
  20. rm "${img_tmp}"
  21. echo "Failed to download image" >&2
  22. exit 1
  23. }
  24. mv ${img_tmp} ${img}