Last active
May 6, 2017 04:57
-
-
Save z448/fd5b7d32289bb8a0cbc8 to your computer and use it in GitHub Desktop.
shell script for listing app bundle IDs, display names, UUIDs installed applications
This file contains 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 characters
#!/bin/bash | |
#see output in < aplst_setlinks.sh aplst_setvars appList.err appList.log appList.out > | |
#dep:plutil.pl | |
dataPath=/var/mobile/Containers/Data/Application | |
bundlePath=/var/mobile/Containers/Bundle/Application | |
mcmMetaPrefFile=.com.apple.mobile_container_manager.metadata.plist | |
itunesMetaPrefFile=iTunesMetadata.plist | |
myAppLinksFolder=/var/mobile/applinks | |
exec > >(tee appList.log) | |
exec 2>appList.err | |
displayName=0 | |
echo -n "searching bundleDisplayNames" | |
for i in $(ls -a $bundlePath) | |
do | |
appBundleHash=$i | |
appBundleHashPATH=$bundlePath/$appBundleHash | |
if [ -e "$appBundleHashPATH/$itunesMetaPrefFile" ] | |
then | |
appBundleID=$(plutil -key softwareVersionBundleId $appBundleHashPATH/$itunesMetaPrefFile) | |
appDisplayName=$(plutil -key bundleDisplayName $appBundleHashPATH/$itunesMetaPrefFile) | |
#might not work for some apps that dont have bundle name; fix w -key playlistName instead; | |
echo -n \. | |
declare -A bundlename | |
bundlename[$appBundleID]="$appDisplayName" | |
((displayName=displayName+1)) | |
fi | |
done | |
echo "done" | |
echo "found $displayName bundleDisplayNames\n" | |
uuid=0 | |
echo -n "matching UUIDs" | |
for j in $(ls -a $dataPath) | |
do | |
appDataHash=$j | |
appDataHashPATH=$dataPath/$appDataHash | |
if [ -e "$appDataHashPATH/$mcmMetaPrefFile" ] | |
then | |
declare -A datahash | |
appDataID=$(plutil -key MCMMetadataIdentifier $appDataHashPATH/$mcmMetaPrefFile) | |
datahash[$appDataID]="$appDataHash" | |
echo -n \. | |
((uuid=uuid+1)) | |
fi | |
done | |
echo "done" | |
echo "result in appList.out" | |
exec 1>appList.out | |
#for bundle in "${!bundlename[@]}" | |
#do | |
# echo ${bundlename[$bundle]}\=${datahash[$bundle]} | |
#done | |
# | |
exec 1>aplst_setvars | |
for bundle in "${!bundlename[@]}" | |
do | |
bundleNameLC=${bundlename[$bundle]} | |
echo ${bundleNameLC,,}\=${datahash[$bundle]} | |
done | |
exec 1>aplst_setlinks.sh | |
for bundle in "${!bundlename[@]}" | |
do | |
bundleNameLC=${bundlename[$bundle]} | |
#bundleNameLC2=${bundleNameLC,,} | |
#bundleNameLCnospace=($bundleNameLC2 | xargs) | |
#echo 'ln -s '$dataPath\/${datahash[$bundle]}\ $myAppLinksFolder ${bundleNameLCnospace,,} | |
echo 'ln -s '$dataPath\/${datahash[$bundle]}\ $myAppLinksFolder\/${bundleNameLC,,} | |
done | |
#### | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment