File: postrm

package info (click to toggle)
tex-common 6.20
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 252 kB
  • sloc: sh: 658; perl: 593; makefile: 26
file content (74 lines) | stat: -rw-r--r-- 2,496 bytes parent folder | download | duplicates (3)
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
65
66
67
68
69
70
71
72
73
74
#!/bin/sh
# 
# postrm maintainer script for the Debian tex-common package.
#
# Copyright (C) 2004 by Frank Küster <frank@kuesterei.ch>. 
# Copyright (C) 2012 by Norbert Preining <preining@debian.org>.
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# This file is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to: The Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
#
# On Debian GNU/Linux System you can find a copy of the GNU General Public
# License in "/usr/share/common-licenses/GPL".

set -e

# give commandline args a name
action=$1 # remove, purge, upgrade, failed-upgrade, abort-install, abort-upgrade, disappear

## do the things we have to do always
case $action in
  abort-install|abort-upgrade)
    syml=/usr/share/texmf/doc
    if [ -n "$2" ] && dpkg --compare-versions "$2" lt "4" ; then
      if [ -L $syml.dpkg-remove ] && [ ! -e $syml ] ; then
        echo "Reinstatiating $syml"
        mv $syml.dpkg-remove $syml
      fi
    fi
  ;;
  remove)
    # remove TEXMFSYSVARDIR: All files and dirs are created either by
    # us, or by packages depending on us.
    rm -rf /var/lib/texmf
    # same with obsolete /var/cache/fonts
    rm -rf /var/cache/fonts
    ;;
  purge)
    if [ -L /usr/share/texmf/doc.dpkg-remove ] ; then
      rm -f /usr/share/texmf/doc.dpkg-remove
    fi

    # TODO purge ucf files

    # remove texmf.cnf
    if [ -d /etc/texmf/web2c ] ; then
      rm -rf /etc/texmf/web2c/texmf.cnf
      rmdir --ignore-fail-on-non-empty /etc/texmf/web2c
    fi

    # try to remove /usr/local/share/texmf if it is empty
    # people should normally not have TEXMFLOCAL ls-R files
    # unless they called mktexlsr manually, in which case this is fine
    # maintainer scripts should call mktexlsr with a list of trees so
    # no /u/l/s/texmf/ls-R is created
    #rm -f /usr/local/share/texmf/ls-R 2>/dev/null || true
    rmdir --ignore-fail-on-non-empty /usr/local/share/texmf/ 2>/dev/null || true
    ;;
  *)
    ;;
esac

#DEBHELPER#