Skip to content

Instantly share code, notes, and snippets.

@ggshily
Created November 27, 2014 10:25
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save ggshily/8594b69a266a410d82a0 to your computer and use it in GitHub Desktop.
Save ggshily/8594b69a266a410d82a0 to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# Upload ipa file to fir.im
#
# Syntax: upload_fir.sh {my-application.ipa}
#
IPA=$1
if [ -z "$IPA" ]
then
echo "Syntax: upload_fir.sh {my-application.ipa}"
exit 1
fi
USER_TOKEN="XXX"
APP_ID="XXX"
echo "getting token"
INFO=`curl http://fir.im/api/v2/app/info/${APP_ID}?token=${USER_TOKEN} 2>/dev/null`
KEY=$(echo ${INFO} | grep "pkg.*url" -o | grep "key.*$" -o | awk -F '"' '{print $3;}')
TOKEN=$(echo ${INFO} | grep "pkg.*url" -o | grep "token.*$" -o | awk -F '"' '{print $3;}')
#echo key ${KEY}
#echo token ${TOKEN}
echo "uploading"
APP_INFO=`curl -# -F file=@${IPA} -F "key=${KEY}" -F "token=${TOKEN}" http://up.qiniu.com`
if [ $? != 0 ]
then
echo "upload error"
exit 1
fi
APPOID=`echo ${APP_INFO} | grep "appOid.*," -o | awk -F '"' '{print $3;}'`
#echo ${APP_INFO}
#echo ${APPOID}
curl -X PUT -d changelog="update version" http://fir.im/api/v2/app/${APPOID}?token=${USER_TOKEN}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment