-
Notifications
You must be signed in to change notification settings - Fork 0
/
systemspecific.in
executable file
·79 lines (76 loc) · 2.18 KB
/
systemspecific.in
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
case "@HOST@" in
*-apple-darwin*)
#Add FontForge to the X11 applications menu, so that mac users don't have
# to deal with xterms or messing around with paths
#Mac OS/X 10.1 did not have plutil (it didn't have X11 either)
if test -d ~/Library/Preferences -a -e /usr/bin/plutil ; then
if test \! -e ~/Library/Preferences/com.apple.x11.plist ; then
cat <<EOF >~/Library/Preferences/com.apple.x11.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>apps_menu</key>
<array>
<array>
<string>Terminal</string>
<string>xterm</string>
<string>n</string>
</array>
<array>
<string>FontForge</string>
<string>@prefix@/bin/fontforge</string>
<string>f</string>
</array>
</array>
</dict>
</plist>
EOF
plutil -convert binary1 ~/Library/Preferences/com.apple.x11.plist
elif grep -q fontforge ~/Library/Preferences/com.apple.x11.plist ; then
cat </dev/null >/dev/null
# It's already in the menu, no need to add it
else
if grep -q "xml version=" ~/Library/Preferences/com.apple.x11.plist ; then
# It's already in xml format
cp ~/Library/Preferences/com.apple.x11.plist /tmp/x11.xml
else
plutil -convert xml1 -o /tmp/x11.xml ~/Library/Preferences/com.apple.x11.plist
fi
if grep -q apps_menu ~/Library/Preferences/com.apple.x11.plist ; then
cat >/tmp/fontforge-sed-script <<EOF
/apps_menu/ { N
a \\
<array>\\
<string>FontForge</string>\\
<string>@prefix@/bin/fontforge</string>\\
<string>f</string>\\
</array>
}
EOF
else
cat >/tmp/fontforge-sed-script <<EOF
/<dict/ a \\
<key>apps_menu</key>\\
<array>\\
<array>\\
<string>Terminal</string>\\
<string>xterm</string>\\
<string>n</string>\\
</array>\\
<array>\\
<string>FontForge</string>\\
<string>@prefix@/bin/fontforge</string>\\
<string>f</string>\\
</array>\\
</array>
EOF
fi
sed -f /tmp/fontforge-sed-script /tmp/x11.xml >/tmp/x11_1.xml
plutil -convert binary1 -o ~/Library/Preferences/com.apple.x11.plist /tmp/x11_1.xml
rm -f /tmp/x11_1.xml /tmp/fontforge-sed-script /tmp/x11.xml
fi
fi
;;
esac