~ubuntu-branches/ubuntu/edgy/tipa/edgy

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
#!/bin/sh -e

#
# we have to move the map and dvips config file into /u/s/texmf
# but want to preserve changes done by the user!
#
dpkg_md5sum(){
  grep "$1[[:space:]]"  /var/lib/dpkg/status | cut -f 3 -d ' '
}

config_move ()
{
    oldfile=$1
    newloc=$2
    oldmd5sum=`dpkg_md5sum $oldfile`

    if ! [ -r $oldfile ] ; then
        return 0
    fi
    oldloc=`dirname $1`
    newmd5sum=`md5sum $oldfile |  cut -d ' ' -f 1`
    if [ "$newmd5sum" = "$oldmd5sum" ] ; then
	echo "Removing obsolete, unchanged conffile $oldfile"
	rm $oldfile
    else
    	if [ "X$newloc" = "X" ] ; then
	    echo "Conffile $oldfile was changed, leaving it at the same place"
	else
	    echo "Conffile $oldfile was changed, moving it to new location $newloc"
	    mkdir -p $newloc
	    mv $oldfile $newloc
	fi
    fi
    test -d $oldloc && rmdir --ignore-fail-on-non-empty $oldloc || true
}

   

case "$1" in
    upgrade|install)
	set -e
	config_move /etc/texmf/dvips/tipa.map /etc/texmf/fonts/map/dvips
    ;;

    abort-upgrade)
    ;;

    *)
        echo "preinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac


#DEBHELPER#

exit 0