summaryrefslogtreecommitdiff
path: root/checkfiles
blob: c3d325b3ebd46aea72e5f66f74def51da9366816 (plain)
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
#!/bin/sh
# run from the prerm and postinst
set -e

install=$1

check_file () {
	dckey=$1; regexp=$2; file=$3

	if ! test -f $file; then return; fi

	if $install; then
		if test -e $file.not-trad; then return; fi
		before=misc
		after=trad
		newfile=$file.trad
		oldfile=$file.not-trad
	else
		if ! test -e $file.not-trad; then return; fi
		before=trad
		after=misc
		newfile=$file.undo-trad
		oldfile=$file.trad
	fi

	perl -pe '
 s/^('"$regexp"'\s+)\-'$before'\-(fixed-medium-r-semicondensed)/$1-'$after'-$2/
		' <$file >$file
	if cmp -s $file $newfile; then
		rm $newfile
		return
	fi

	db_get $dckey
	if [ $RET != true ]; then return; fi

	if $install; then
		db_get $dckey-done || true
		if [ $RET = true ]; then return; fi

		echo "Updating $file to use traditional fixed..."
	else
		echo "Restoring $file with nontraditional fixed..."
	fi
	rm -f $oldfile
	ln $file $oldfile
	mv -f $newfile $file

	case "$file" in
	*.alias) update-fonts-alias misc ;;
	esac

	db_set $dckey-done $install
	# only ever do this once, unless we've actually undone it since
}

echo "Checking configuration..."

check_file reconfigure-xterm '\*VT100\.utf8Fonts\.font\:' \
	/etc/X11/app-defaults/XTerm

check_file remap-fixed 'fixed' \
	/etc/X11/fonts/misc/xfonts-base.alias