#!/bin/sh -e
# 
# preinst maintainer script for the Debian tex-common package.
#
# 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".

umask 022

# prepare for change of symlink to real dir

slink=/usr/share/texmf/doc
slinktarget=../doc/texmf

case "$1" in
  upgrade|install)
    ov=$2
    if [ -n "$ov" ] && dpkg --compare-versions "$ov" lt 4 ; then
      if [ -L $slink ] && [ "$(readlink $slink)" = $slinktarget ] ; then
        mv $slink $slink.dpkg-remove
      fi
    fi
  ;;
esac

#DEBHELPER#

### Local Variables:
### tab-width: 4
### indent-tabs-mode: nil
### End:
# vim:set tabstop=4 expandtab: #
