From be65f15aacb3b55f504a18f7eecac9356d71e2ce Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Tue, 10 Jan 2012 00:56:19 +0000 Subject: [PATCH] wip new config Organization: Straylight/Edgeware From: Ian Jackson --- checkfiles | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100755 checkfiles diff --git a/checkfiles b/checkfiles new file mode 100755 index 0000000..c3d325b --- /dev/null +++ b/checkfiles @@ -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 + -- [mdw]