wip new config
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 10 Jan 2012 00:56:19 +0000 (00:56 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 10 Jan 2012 00:56:19 +0000 (00:56 +0000)
checkfiles [new file with mode: 0755]

diff --git a/checkfiles b/checkfiles
new file mode 100755 (executable)
index 0000000..c3d325b
--- /dev/null
@@ -0,0 +1,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
+