Skip to content

Commit

Permalink
Create font2mobileconfig.sh
Browse files Browse the repository at this point in the history
This is a script that wraps any file in an Apple mobile provisioning profile as if that file were a font.  If you use the script on a TTF or OTF font file, you'll get a ".mobileconfig" file that can be installed on most versions of iOS or recent versions of OS X to make that font generally available in that environment.
  • Loading branch information
dfjdejulio committed Feb 27, 2015
1 parent 19c0f6c commit d8b5849
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions font2mobileconfig.sh
@@ -0,0 +1,51 @@
#!/bin/sh -

if [ ! "$#" -eq 1 ] ; then
/bin/echo "Usage: $0 fontfilename"
exit 1
fi

fontfile=$1
outfile=$fontfile\.mobileconfig
outeruuid=`uuidgen`
inneruuid=`uuidgen`
/bin/echo -n '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadDisplayName</key><string>' > $outfile
/bin/echo -n $fontfile >> $outfile
/bin/echo -n '</string>
<key>PayloadIdentifier</key>
<string>' >> $outfile
/bin/echo -n `hostname`.$outeruuid >> $outfile
/bin/echo -n '</string>
<key>PayloadType</key><string>Configuration</string>
<key>PayloadUUID</key><string>' >> $outfile
/bin/echo -n $outeruuid >> $outfile
/bin/echo -n '</string>' >> $outfile
/bin/echo -n '<key>PayloadVersion</key><integer>1</integer>
<key>PayloadContent</key>
<array>
<dict>
<key>PayloadType</key><string>com.apple.font</string>
<key>Font</key>
<data>' >> $outfile
base64 -b 72 -i $fontfile >> $outfile
/bin/echo -n '</data>
<key>Name</key>
<string>' >> $outfile
/bin/echo -n $fontfile >> $outfile
/bin/echo -n '</string>
<key>PayloadIdentifier</key>
<string>' >> $outfile
/bin/echo -n `hostname`.$outeruuid.com.apple.font.$inneruuid >> $outfile
/bin/echo -n '</string>
<key>PayloadVersion</key><integer>1</integer>
<key>PayloadUUID</key><string>' >> $outfile
/bin/echo -n $inneruuid >> $outfile
/bin/echo '</string>
</dict>
</array>
</dict>
</plist>' >> $outfile

0 comments on commit d8b5849

Please sign in to comment.