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

« back to all changes in this revision

Viewing changes to debian/preinst

  • Committer: Bazaar Package Importer
  • Author(s): Rafael Laboissiere
  • Date: 2006-06-19 11:42:41 UTC
  • mfrom: (2.1.1 etch)
  • Revision ID: james.westby@ubuntu.com-20060619114241-ko4dkfuau1gkfxa3
Tags: 2:1.3-4
debian/postrm: Removed this file, whose job is done automatically by
dh_installtex (this should hopefully really closes: #335990).  Thanks
again to Norbert Preining for the heads up.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh -e
 
2
 
 
3
#
 
4
# we have to move the map and dvips config file into /u/s/texmf
 
5
# but want to preserve changes done by the user!
 
6
#
 
7
dpkg_md5sum(){
 
8
  grep "$1[[:space:]]"  /var/lib/dpkg/status | cut -f 3 -d ' '
 
9
}
 
10
 
 
11
config_move ()
 
12
{
 
13
    oldfile=$1
 
14
    newloc=$2
 
15
    oldmd5sum=`dpkg_md5sum $oldfile`
 
16
 
 
17
    if ! [ -r $oldfile ] ; then
 
18
        return 0
 
19
    fi
 
20
    oldloc=`dirname $1`
 
21
    newmd5sum=`md5sum $oldfile |  cut -d ' ' -f 1`
 
22
    if [ "$newmd5sum" = "$oldmd5sum" ] ; then
 
23
        echo "Removing obsolete, unchanged conffile $oldfile"
 
24
        rm $oldfile
 
25
    else
 
26
        if [ "X$newloc" = "X" ] ; then
 
27
            echo "Conffile $oldfile was changed, leaving it at the same place"
 
28
        else
 
29
            echo "Conffile $oldfile was changed, moving it to new location $newloc"
 
30
            mkdir -p $newloc
 
31
            mv $oldfile $newloc
 
32
        fi
 
33
    fi
 
34
    test -d $oldloc && rmdir --ignore-fail-on-non-empty $oldloc || true
 
35
}
 
36
 
 
37
   
 
38
 
 
39
case "$1" in
 
40
    upgrade|install)
 
41
        set -e
 
42
        config_move /etc/texmf/dvips/tipa.map /etc/texmf/fonts/map/dvips
 
43
    ;;
 
44
 
 
45
    abort-upgrade)
 
46
    ;;
 
47
 
 
48
    *)
 
49
        echo "preinst called with unknown argument \`$1'" >&2
 
50
        exit 1
 
51
    ;;
 
52
esac
 
53
 
 
54
 
 
55
#DEBHELPER#
 
56
 
 
57
exit 0