Last active
December 31, 2015 19:38
-
-
Save linyize/8034386 to your computer and use it in GitHub Desktop.
Revisions
-
linyize revised this gist
Jul 4, 2015 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -34,6 +34,7 @@ fi plist=/tmp/"${scheme}".plist rm -f "${plist}" plutil -convert xml1 -o "${plist}" "${projectpath}"/"${projectname}".xcodeproj/project.pbxproj customArchiveName=$(xmllint --xpath Scheme/ArchiveAction/@customArchiveName "${schemefile}" | cut -d '"' -f2) targetid=$(xmllint --xpath Scheme/BuildAction/BuildActionEntries/BuildActionEntry/BuildableReference/@BlueprintIdentifier "${schemefile}" | cut -d '"' -f2) buildConfigurationList=$(/usr/libexec/PlistBuddy -c "Print objects:"${targetid}":buildConfigurationList" "${plist}") buildConfiguration=$(/usr/libexec/PlistBuddy -c "Print objects:"${buildConfigurationList}":buildConfigurations:1" "${plist}") @@ -45,6 +46,10 @@ then exit 1 fi if [ ! -n "${customArchiveName}" ] then customArchiveName="${scheme}" fi # find certname (first valid certificate in mobileprovision file) mpplist=/tmp/"${profileuuid}".plist @@ -73,7 +78,7 @@ fi # package ipa archive=$(ls -dt ~/Library/Developer/Xcode/Archives/*/"${customArchiveName}"*.xcarchive|head -1) app=$(ls -dt "${archive}"/Products/Applications/*.app|head -1) ipa=/tmp/"${scheme}".ipa rm -f "${ipa}" -
linyize revised this gist
Dec 26, 2013 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -39,6 +39,11 @@ buildConfigurationList=$(/usr/libexec/PlistBuddy -c "Print objects:"${targetid}" buildConfiguration=$(/usr/libexec/PlistBuddy -c "Print objects:"${buildConfigurationList}":buildConfigurations:1" "${plist}") profileuuid=$(/usr/libexec/PlistBuddy -c "Print objects:"${buildConfiguration}":buildSettings:PROVISIONING_PROFILE" "${plist}") profile=~/Library/MobileDevice/Provisioning\ Profiles/"${profileuuid}".mobileprovision if [ ! -f "${profile}" ] then echo "mobileprovision file not found!" exit 1 fi # find certname (first valid certificate in mobileprovision file) -
linyize revised this gist
Dec 24, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -41,7 +41,7 @@ profileuuid=$(/usr/libexec/PlistBuddy -c "Print objects:"${buildConfiguration}": profile=~/Library/MobileDevice/Provisioning\ Profiles/"${profileuuid}".mobileprovision # find certname (first valid certificate in mobileprovision file) mpplist=/tmp/"${profileuuid}".plist certdata=/tmp/"${profileuuid}".cer validcerts=/tmp/"${profileuuid}".txt -
linyize revised this gist
Dec 24, 2013 . 1 changed file with 5 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -40,28 +40,27 @@ buildConfiguration=$(/usr/libexec/PlistBuddy -c "Print objects:"${buildConfigura profileuuid=$(/usr/libexec/PlistBuddy -c "Print objects:"${buildConfiguration}":buildSettings:PROVISIONING_PROFILE" "${plist}") profile=~/Library/MobileDevice/Provisioning\ Profiles/"${profileuuid}".mobileprovision # find certname mpplist=/tmp/"${profileuuid}".plist certdata=/tmp/"${profileuuid}".cer validcerts=/tmp/"${profileuuid}".txt security cms -D -i "${profile}" > "${mpplist}" security find-identity -v -p codesigning | cut -d ' ' -f4 > "${validcerts}" count=$(xmllint --xpath "count(plist/dict/array/data)" "${mpplist}") maxidx=$[${count} - 1] for idx in $(seq 0 ${maxidx}) do /usr/libexec/PlistBuddy -c "Print DeveloperCertificates:${idx}" "${mpplist}" > "${certdata}" certfingerprint=$(openssl x509 -inform der -in "${certdata}" -noout -fingerprint | cut -d '=' -f2 | sed 's/://g') if [ $(cat "${validcerts}" | grep "${certfingerprint}" | wc -l) -gt 0 ] then certsubject=$(openssl x509 -inform der -in "${certdata}" -noout -subject) certname=$(echo "${certsubject}" | cut -d '/' -f3 | cut -d '=' -f2) break fi done if [ ! -n "${certname}" ] then echo "valid certificate not found!" exit 1 -
linyize revised this gist
Dec 24, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -81,4 +81,4 @@ rm -f "${ipa}" # upload ipa to inhouse webserver #curl -F ipa=@"${ipa}" "${inhouseserver}" -
linyize revised this gist
Dec 24, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -40,7 +40,7 @@ buildConfiguration=$(/usr/libexec/PlistBuddy -c "Print objects:"${buildConfigura profileuuid=$(/usr/libexec/PlistBuddy -c "Print objects:"${buildConfiguration}":buildSettings:PROVISIONING_PROFILE" "${plist}") profile=~/Library/MobileDevice/Provisioning\ Profiles/"${profileuuid}".mobileprovision # find certname (first valid certificate in mobileprovision file) mpplist=/tmp/"${profileuuid}".plist certdata=/tmp/"${profileuuid}".cer validcerts=/tmp/"${profileuuid}".txt -
linyize revised this gist
Dec 24, 2013 . 1 changed file with 23 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -29,6 +29,7 @@ then exit 1 fi # find mobileprovision file plist=/tmp/"${scheme}".plist rm -f "${plist}" @@ -42,10 +43,29 @@ profile=~/Library/MobileDevice/Provisioning\ Profiles/"${profileuuid}".mobilepro # find certname (first certificate in mobileprovision file) mpplist=/tmp/"${profileuuid}".plist certdata=/tmp/"${profileuuid}".cer validcerts=/tmp/"${profileuuid}".txt security cms -D -i "${profile}" > "${mpplist}" security find-identity -v -p codesigning | cut -d ' ' -f4 > "${validcerts}" foundvalidcert=0 count=$(xmllint --xpath "count(plist/dict/array/data)" "${mpplist}") maxidx=$[${count} - 1] for idx in $(seq 0 ${maxidx}) do /usr/libexec/PlistBuddy -c "Print DeveloperCertificates:${idx}" "${mpplist}" > "${certdata}" certsubject=$(openssl x509 -inform der -in "${certdata}" -noout -subject) certfingerprint=$(openssl x509 -inform der -in "${certdata}" -noout -fingerprint | cut -d '=' -f2 | sed 's/://g') certname=$(echo "${certsubject}" | cut -d '/' -f3 | cut -d '=' -f2) if [ $(cat "${validcerts}" | grep "${certfingerprint}" | wc -l) -gt 0 ] then foundvalidcert=1 break fi done if [ foundvalidcert -eq 0 ] then echo "valid certificate not found!" exit 1 fi # package ipa -
linyize revised this gist
Dec 24, 2013 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,9 +18,6 @@ xctool -project "${projectname}".xcodeproj -scheme "${scheme}" clean archive -sd # find xcscheme file schemefile="${projectpath}"/"${projectname}".xcodeproj/xcshareddata/xcschemes/"${scheme}".xcscheme if [ ! -f "${schemefile}" ] then @@ -33,6 +30,9 @@ then fi # find mobileprovision file plist=/tmp/"${scheme}".plist rm -f "${plist}" plutil -convert xml1 -o "${plist}" "${projectpath}"/"${projectname}".xcodeproj/project.pbxproj targetid=$(xmllint --xpath Scheme/BuildAction/BuildActionEntries/BuildActionEntry/BuildableReference/@BlueprintIdentifier "${schemefile}" | cut -d '"' -f2) buildConfigurationList=$(/usr/libexec/PlistBuddy -c "Print objects:"${targetid}":buildConfigurationList" "${plist}") buildConfiguration=$(/usr/libexec/PlistBuddy -c "Print objects:"${buildConfigurationList}":buildConfigurations:1" "${plist}") -
linyize revised this gist
Dec 24, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -36,7 +36,7 @@ fi targetid=$(xmllint --xpath Scheme/BuildAction/BuildActionEntries/BuildActionEntry/BuildableReference/@BlueprintIdentifier "${schemefile}" | cut -d '"' -f2) buildConfigurationList=$(/usr/libexec/PlistBuddy -c "Print objects:"${targetid}":buildConfigurationList" "${plist}") buildConfiguration=$(/usr/libexec/PlistBuddy -c "Print objects:"${buildConfigurationList}":buildConfigurations:1" "${plist}") profileuuid=$(/usr/libexec/PlistBuddy -c "Print objects:"${buildConfiguration}":buildSettings:PROVISIONING_PROFILE" "${plist}") profile=~/Library/MobileDevice/Provisioning\ Profiles/"${profileuuid}".mobileprovision # find certname (first certificate in mobileprovision file) -
linyize revised this gist
Dec 23, 2013 . 1 changed file with 9 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,5 @@ #!/bin/sh -ex # install xctool : brew install xctool inhouseserver="http://inhouse.xxx.com/upload" @@ -23,6 +22,15 @@ plist=/tmp/"${scheme}".plist rm -f "${plist}" plutil -convert xml1 -o "${plist}" "${projectpath}"/"${projectname}".xcodeproj/project.pbxproj schemefile="${projectpath}"/"${projectname}".xcodeproj/xcshareddata/xcschemes/"${scheme}".xcscheme if [ ! -f "${schemefile}" ] then schemefile=$(ls -dt "${projectpath}"/"${projectname}".xcodeproj/xcuserdata/*.xcuserdatad/xcschemes/"${scheme}".xcscheme | head -1) fi if [ ! -f "${schemefile}" ] then echo "scheme not found!" exit 1 fi # find mobileprovision file targetid=$(xmllint --xpath Scheme/BuildAction/BuildActionEntries/BuildActionEntry/BuildableReference/@BlueprintIdentifier "${schemefile}" | cut -d '"' -f2) -
linyize revised this gist
Dec 23, 2013 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,6 @@ #!/bin/sh -ex # install xctool : brew install xctool # must be shared scheme inhouseserver="http://inhouse.xxx.com/upload" @@ -32,7 +31,7 @@ buildConfiguration=$(/usr/libexec/PlistBuddy -c "Print objects:"${buildConfigura profileuuid=$(/usr/libexec/PlistBuddy -c "Print objects:"${buildConfiguration}":buildSettings:PROVISIONING_PROFILE[sdk=iphoneos*]" "${plist}") profile=~/Library/MobileDevice/Provisioning\ Profiles/"${profileuuid}".mobileprovision # find certname (first certificate in mobileprovision file) mpplist=/tmp/"${profileuuid}".plist certdata=/tmp/"${profileuuid}".cer security cms -D -i "${profile}" > "${mpplist}" -
linyize revised this gist
Dec 23, 2013 . 1 changed file with 13 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -19,18 +19,26 @@ projectpath=$(pwd) xctool -project "${projectname}".xcodeproj -scheme "${scheme}" clean archive -sdk iphoneos # find xcscheme file plist=/tmp/"${scheme}".plist rm -f "${plist}" plutil -convert xml1 -o "${plist}" "${projectpath}"/"${projectname}".xcodeproj/project.pbxproj schemefile="${projectpath}"/"${projectname}".xcodeproj/xcshareddata/xcschemes/"${scheme}".xcscheme # find mobileprovision file targetid=$(xmllint --xpath Scheme/BuildAction/BuildActionEntries/BuildActionEntry/BuildableReference/@BlueprintIdentifier "${schemefile}" | cut -d '"' -f2) buildConfigurationList=$(/usr/libexec/PlistBuddy -c "Print objects:"${targetid}":buildConfigurationList" "${plist}") buildConfiguration=$(/usr/libexec/PlistBuddy -c "Print objects:"${buildConfigurationList}":buildConfigurations:1" "${plist}") profileuuid=$(/usr/libexec/PlistBuddy -c "Print objects:"${buildConfiguration}":buildSettings:PROVISIONING_PROFILE[sdk=iphoneos*]" "${plist}") profile=~/Library/MobileDevice/Provisioning\ Profiles/"${profileuuid}".mobileprovision # find certname mpplist=/tmp/"${profileuuid}".plist certdata=/tmp/"${profileuuid}".cer security cms -D -i "${profile}" > "${mpplist}" /usr/libexec/PlistBuddy -c "Print DeveloperCertificates:0" "${mpplist}" > "${certdata}" certsubject=$(openssl x509 -inform der -in "${certdata}" -noout -subject) certname=$(echo "${certsubject}" | cut -d '/' -f3 | cut -d '=' -f2) # package ipa @@ -41,7 +49,7 @@ rm -f "${ipa}" /usr/bin/xcrun -sdk iphoneos PackageApplication \ -o "${ipa}" \ -v "${app}" \ -s "${certname}" \ --embed "${profile}" -
linyize revised this gist
Dec 19, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ #!/bin/sh -ex # install xctool : brew install xctool # must be shared scheme # must be inhouse app inhouseserver="http://inhouse.xxx.com/upload" -
linyize revised this gist
Dec 19, 2013 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,12 @@ #!/bin/sh -ex # install xctool : brew install xctool # scheme must be shared scheme # must be inhouse app inhouseserver="http://inhouse.xxx.com/upload" export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer projectpath=$1 scheme=$2 projectname=$(basename "${projectpath}") -
linyize revised this gist
Dec 19, 2013 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,6 +5,7 @@ inhouseserver="http://inhouse.xxx.com/upload" export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer # scheme must be shared scheme # must be inhouse app projectpath=$1 scheme=$2 projectname=$(basename "${projectpath}") -
linyize revised this gist
Dec 19, 2013 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,6 +4,7 @@ inhouseserver="http://inhouse.xxx.com/upload" export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer # scheme must be shared scheme projectpath=$1 scheme=$2 projectname=$(basename "${projectpath}") -
linyize created this gist
Dec 19, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ #!/bin/sh -ex inhouseserver="http://inhouse.xxx.com/upload" export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer projectpath=$1 scheme=$2 projectname=$(basename "${projectpath}") cd "${projectpath}" projectpath=$(pwd) # archive xctool -project "${projectname}".xcodeproj -scheme "${scheme}" clean archive -sdk iphoneos # find certname and mobileprovision filepath plist=/tmp/"${scheme}".plist rm -f "${plist}" plutil -convert xml1 -o "${plist}" "${projectpath}"/"${projectname}".xcodeproj/project.pbxproj schemefile="${projectpath}"/"${projectname}".xcodeproj/xcshareddata/xcschemes/"${scheme}".xcscheme targetid=$(xmllint --xpath Scheme/BuildAction/BuildActionEntries/BuildActionEntry/BuildableReference/@BlueprintIdentifier "${schemefile}" | cut -d '"' -f2) buildConfigurationList=$(/usr/libexec/PlistBuddy -c "Print objects:"${targetid}":buildConfigurationList" "${plist}") buildConfiguration=$(/usr/libexec/PlistBuddy -c "Print objects:"${buildConfigurationList}":buildConfigurations:1" "${plist}") profileuuid=$(/usr/libexec/PlistBuddy -c "Print objects:"${buildConfiguration}":buildSettings:PROVISIONING_PROFILE[sdk=iphoneos*]" "${plist}") profile=~/Library/MobileDevice/Provisioning\ Profiles/"${profileuuid}".mobileprovision teamname=$(egrep -a -A 1 TeamName "${profile}" | grep string | cut -d '>' -f2 | cut -d '<' -f1) cert=iPhone\ Distribution:\ "${teamname}" # package ipa archive=$(ls -dt ~/Library/Developer/Xcode/Archives/*/"${scheme}"*.xcarchive|head -1) app=$(ls -dt "${archive}"/Products/Applications/*.app|head -1) ipa=/tmp/"${scheme}".ipa rm -f "${ipa}" /usr/bin/xcrun -sdk iphoneos PackageApplication \ -o "${ipa}" \ -v "${app}" \ -s "${cert}" \ --embed "${profile}" # upload ipa to inhouse webserver #curl -F "ipa=@"${ipa}"" "${inhouseserver}"