Commit | Line | Data |
---|---|---|
be65f15a IJ |
1 | #!/bin/sh |
2 | # run from the prerm and postinst | |
3 | set -e | |
4 | ||
5 | install=$1 | |
6 | ||
7 | check_file () { | |
8 | dckey=$1; regexp=$2; file=$3 | |
9 | ||
10 | if ! test -f $file; then return; fi | |
11 | ||
12 | if $install; then | |
13 | if test -e $file.not-trad; then return; fi | |
14 | before=misc | |
15 | after=trad | |
16 | newfile=$file.trad | |
17 | oldfile=$file.not-trad | |
18 | else | |
19 | if ! test -e $file.not-trad; then return; fi | |
20 | before=trad | |
21 | after=misc | |
22 | newfile=$file.undo-trad | |
23 | oldfile=$file.trad | |
24 | fi | |
25 | ||
26 | perl -pe ' | |
27 | s/^('"$regexp"'\s+)\-'$before'\-(fixed-medium-r-semicondensed)/$1-'$after'-$2/ | |
28 | ' <$file >$file | |
29 | if cmp -s $file $newfile; then | |
30 | rm $newfile | |
31 | return | |
32 | fi | |
33 | ||
34 | db_get $dckey | |
35 | if [ $RET != true ]; then return; fi | |
36 | ||
37 | if $install; then | |
38 | db_get $dckey-done || true | |
39 | if [ $RET = true ]; then return; fi | |
40 | ||
41 | echo "Updating $file to use traditional fixed..." | |
42 | else | |
43 | echo "Restoring $file with nontraditional fixed..." | |
44 | fi | |
45 | rm -f $oldfile | |
46 | ln $file $oldfile | |
47 | mv -f $newfile $file | |
48 | ||
49 | case "$file" in | |
50 | *.alias) update-fonts-alias misc ;; | |
51 | esac | |
52 | ||
53 | db_set $dckey-done $install | |
54 | # only ever do this once, unless we've actually undone it since | |
55 | } | |
56 | ||
57 | echo "Checking configuration..." | |
58 | ||
59 | check_file reconfigure-xterm '\*VT100\.utf8Fonts\.font\:' \ | |
60 | /etc/X11/app-defaults/XTerm | |
61 | ||
62 | check_file remap-fixed 'fixed' \ | |
63 | /etc/X11/fonts/misc/xfonts-base.alias | |
64 |