-
Notifications
You must be signed in to change notification settings - Fork 26
/
font2mobileconfig.sh
51 lines (49 loc) · 1.42 KB
/
font2mobileconfig.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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