chiark / gitweb /
debian/copyright: Explain the origin and copyright status of 6x13O.
[xfonts-traditional] / checkfiles
... / ...
CommitLineData
1#!/bin/sh
2# run from the prerm and postinst
3set -e
4
5script=$1
6mode=$2
7
8. /usr/share/debconf/confmodule
9
10gen_file_overwrite () {
11 before=$1; after=$2; infile=$3; outfile=$4; backupmode=$5; backup=$6
12 perl -pe '
13 s/^('"$regexp"'\s+)\-'$before'\-(fixed-medium-r-semicondensed)/$1-'$after'-$2/
14 ' <$infile >$outfile.tmp
15 if cmp -s $outfile.tmp $outfile; then
16 rm $outfile.tmp
17 return
18 fi
19 echo " Updating $file ($before=>$after)..."
20 case $backupmode in
21 once)
22 if ! test -e $backup; then
23 ln $outfile $backup
24 fi
25 ;;
26 never)
27 ;;
28 esac
29 mv -f $outfile.tmp $outfile
30
31 case "$file" in
32 *.alias) update-fonts-alias misc ;;
33 esac
34}
35
36check_file () {
37 dckey=$1; regexp=$2; file=$3
38
39 if ! test -f $file; then return; fi
40
41 needundo=true
42
43 case "$script.$mode" in
44 postinst.*)
45 db_get xfonts-traditional/$dckey ||:
46 if [ $RET = true ]; then
47 gen_file_overwrite misc trad \
48 $file $file once $file.backup.not-trad
49 needundo=false
50 else
51 gen_file_overwrite misc trad \
52 $file $file.trad never
53 fi
54 ;;
55 prerm.upgrade*)
56 needundo=false
57 ;;
58 prerm.remove*)
59 ;;
60 *)
61 echo >&2 "huh $script.mode ?"
62 exit 1
63 ;;
64 esac
65 if $needundo && test -f $file.backup.not-trad; then
66 gen_file_overwrite trad misc \
67 $file $file $file.backup.trad
68 mv -f $file.backup.not-trad $file.old.not-trad
69 fi
70 # only ever do this once, unless we've actually undone it since
71}
72
73echo "Checking configuration..."
74
75check_file reconfigure-xterm '\*VT100\.utf8Fonts\.font\:' \
76 /etc/X11/app-defaults/XTerm
77
78check_file remap-fixed 'fixed' \
79 /etc/X11/fonts/misc/xfonts-base.alias
80
81true