3007
|
1 |
#!/bin/bash
|
2297
|
2 |
#
|
2311
|
3 |
# $Id$
|
9788
|
4 |
# Author: Markus Wenzel, TU Muenchen
|
|
5 |
# License: GPL (GNU GENERAL PUBLIC LICENSE)
|
2311
|
6 |
#
|
9974
|
7 |
# DESCRIPTION: install symbol fonts on the current X11 server
|
2311
|
8 |
|
2297
|
9 |
|
9788
|
10 |
PRG=$(basename "$0")
|
2297
|
11 |
|
|
12 |
function usage()
|
|
13 |
{
|
|
14 |
echo
|
9974
|
15 |
echo "Usage: $PRG [OPTIONS]"
|
2297
|
16 |
echo
|
9974
|
17 |
echo " Options are:"
|
|
18 |
echo " -x install X-Symbol fonts"
|
|
19 |
echo
|
|
20 |
echo " Install symbol fonts on the current X11 server."
|
2297
|
21 |
echo
|
|
22 |
exit 1
|
|
23 |
}
|
|
24 |
|
|
25 |
|
9974
|
26 |
## process command line
|
|
27 |
|
|
28 |
# options
|
|
29 |
|
|
30 |
XSYMB=""
|
|
31 |
|
|
32 |
while getopts "x" OPT
|
|
33 |
do
|
|
34 |
case "$OPT" in
|
|
35 |
x)
|
|
36 |
XSYMB=true
|
|
37 |
;;
|
|
38 |
\?)
|
|
39 |
usage
|
|
40 |
;;
|
|
41 |
esac
|
|
42 |
done
|
|
43 |
|
|
44 |
shift $(($OPTIND - 1))
|
|
45 |
|
|
46 |
|
|
47 |
# args
|
|
48 |
|
|
49 |
[ "$#" -ne 0 ] && usage
|
|
50 |
|
|
51 |
|
|
52 |
## check fonts
|
2578
|
53 |
|
|
54 |
function checkfonts()
|
|
55 |
{
|
9974
|
56 |
RESULT=$(xlsfonts -fn "$1" 2>&1) || return 1
|
2578
|
57 |
|
|
58 |
case "$RESULT" in
|
|
59 |
xlsfonts:*)
|
|
60 |
return 1
|
|
61 |
;;
|
|
62 |
esac
|
|
63 |
|
|
64 |
return 0
|
|
65 |
}
|
|
66 |
|
|
67 |
|
2297
|
68 |
## main
|
|
69 |
|
9974
|
70 |
ISABELLE_PATTERN="-isabelle-fixed-*-isabelle-0"
|
|
71 |
XSYMBOL_PATTERN="-xsymb-xsymb0-*"
|
2297
|
72 |
|
9974
|
73 |
if [ -z "$XSYMB" ]; then
|
|
74 |
checkfonts "$ISABELLE_PATTERN" || eval $ISABELLE_INSTALLFONTS
|
|
75 |
checkfonts "$ISABELLE_PATTERN" || \
|
|
76 |
echo "Warning: Isabelle fonts probably not installed correctly!" >&2
|
|
77 |
else
|
|
78 |
checkfonts "$XSYMBOL_PATTERN" || eval $XSYMBOL_INSTALLFONTS
|
|
79 |
checkfonts "$XSYMBOL_PATTERN" || \
|
|
80 |
echo "Warning: X-Symbol fonts probably not installed correctly!" >&2
|
|
81 |
fi
|