This file is indexed.

preinst is in texlive-base 2009-15.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

  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
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
#!/bin/sh -e
# common.functions.preinst start
# $Id: common.functions.preinst 3435 2008-06-23 19:54:16Z frank $

dpkg_md5sum()
{
    conffile="$1"
    package="$2"
    md5sum=$(dpkg-query -W -f='${Conffiles}' "$package" \
            | grep -F " $conffile " | cut -d ' ' -f 3)
    if [ -z "$md5sum" ]; then
        echo "$conffile: md5sum not known." >&2
        echo "It seems that this file is not handled by dpkg conffiles." >&2
        # don't exit but return empty md5sum
        md5sum=""
        # exit 1
    fi
    echo $md5sum
}

check_move ()
{
    dodelete="$1"
    orig="$2"
    local package
    package="$3"
    new="$4"
    version="$5"
    if [ -r "$orig" ] ; then
      mdorig=$(dpkg_md5sum "$orig" "$package")
      if [ $(md5sum "$orig" | cut -f 1 -d ' ') = "$mdorig" ] ; then
        rm "$orig"
      else
        mkdir -p $(dirname "$new")
        mv "$orig" "$new".preinst-copy
      fi
    else
      if [ -n "$version" ]; then
	# there is a previous version, we are actually upgrading 
        # (or reinstalling)
        # in case we handle a foreign conffile (different package) $dodelete
        # can be set to 0 (or != 1) in which case the .preinst-deleted file
        # will not be created.
        if [ "$dodelete" = 1 ] ; then
          mkdir -p $(dirname "$new")
          touch $new.preinst-deleted
        fi
      fi
    fi
}

#
# handle_config_file_preinst/postinst/prerm/postrm
# handle those config files which are left over from old texlive and
# tetex installations
handle_config_file_preinst ()
{
    cfgfile="$1"
    action="$2"
    version="$3"
    upgrade_needed=false
    case "$action" in
      install|upgrade)
	if [ -n "$version" ] && dpkg --compare-versions "$version" ge 2007; then
	  return 0
	fi
	;;
      *)
	return 0
	;;
    esac
    
    conf_relpath=${cfgfile#/etc/texmf/}
    conf_oldpath="/etc/texmf/texlive/$conf_relpath"
    # default package is texlive-base-bin
    package=texlive-base-bin
    case "$cfgfile" in 
        /etc/texmf/dvips/config/*)
            # special case for dvips config
            conf_oldpath="/etc/texmf/texlive/dvips/${conf_oldpath#/etc/texmf/texlive/dvips/config/}"
            ;;
        # files which were only present in tetex
        /etc/texmf/texdoctk/texdoctk.dat)
            package=tetex-base
            conf_oldpath="/etc/texdoctk/texdoctk.dat"
            ;;
        # symlink target had a different name
        /etc/texmf/dvipdfm/config/config)
            conf_oldpath="/etc/texmf/texlive/dvipdfm.cfg"
            ;;
        # for xdvi.cfg we first want to move tetex files, and later texlives
        /etc/texmf/xdvi/xdvi.cfg)
            # tetex version
            # it could either be deleted, or tetex was never installed.
            # We do not want to create .preinst-deleted, so we call
            # check_move with first argument 0 which means that the
            # preinst-deleted file will not be created
            check_move 0 /etc/texmf/xdvi.cfg tetex-bin /etc/texmf/xdvi/xdvi.cfg $version
            # now set the conf_oldpath to the texlive version
            conf_oldpath="/etc/texmf/texlive/xdvi.cfg"
            ;;   
    esac
    check_move 1 $conf_oldpath $package $cfgfile $version
}

resurrect_conffile_sid(){
  cfgfile="$1"
  package="$2"
  action="$3"
  version="$4"
  template_source="/usr/share/$package"
  basefile=$(basename $cfgfile)
  dirname=$(dirname $cfgfile)

  # continue only in the following cases:
  # - we are upgrading
  # - at least from version 2007 (not etch=2005)
  case "$action" in
    upgrade)
      if [ -n "$version" ] && dpkg --compare-versions "$version" ge 2007; then
        : do nothing
      else
        return 0
      fi
    ;;
    *)
      return 0
    ;;
  esac

  if ! [ -f "$cfgfile" ]; then
    mkdir -p $dirname
    echo "Reinstalling deleted mandatory conffile $basefile" >&2
    cp $template_source/$basefile $cfgfile
  fi
}

# common.functions.preinst end
# Local Variables:
# mode: shell-script
# End:
# vim:set expandtab: #
# preinst.pre
# $Id: preinst.pre 2583 2007-03-15 20:12:56Z frank $
# we want to be sure that experimental versions are purged before
# the first unstable is installed
# furthermore check that we are at least at version 2005 for the 
# temporary tetex packages upgrades
case "$1" in
  upgrade|install)
    old_version=$2
    if [ -n "$old_version" ] && dpkg --compare-versions "$old_version" lt 2005-2 && dpkg --compare-versions "$old_version" gt 2005 ; then
      echo "Upgrade from experimental versions are not supported!" >&2
      echo "Please purge all texlive packages before installation." >&2
      exit 1
    fi
    ;;
esac

# end preinst.pre
handle_config_file_preinst /etc/texmf/dvipdfm/config/config $1 $2
handle_config_file_preinst /etc/texmf/dvips/config/alt-rule.pro $1 $2
handle_config_file_preinst /etc/texmf/dvips/config/canonex.cfg $1 $2
handle_config_file_preinst /etc/texmf/dvips/config/config.bakoma $1 $2
handle_config_file_preinst /etc/texmf/dvips/config/config.canonex $1 $2
handle_config_file_preinst /etc/texmf/dvips/config/config.cx $1 $2
handle_config_file_preinst /etc/texmf/dvips/config/config.deskjet $1 $2
handle_config_file_preinst /etc/texmf/dvips/config/config.dvired $1 $2
handle_config_file_preinst /etc/texmf/dvips/config/config.epson $1 $2
handle_config_file_preinst /etc/texmf/dvips/config/config.ibmvga $1 $2
handle_config_file_preinst /etc/texmf/dvips/config/config.ljfour $1 $2
handle_config_file_preinst /etc/texmf/dvips/config/config.luc $1 $2
handle_config_file_preinst /etc/texmf/dvips/config/config.mbn $1 $2
handle_config_file_preinst /etc/texmf/dvips/config/config.mga $1 $2
handle_config_file_preinst /etc/texmf/dvips/config/config.mirrorprint $1 $2
handle_config_file_preinst /etc/texmf/dvips/config/config.ot2 $1 $2
handle_config_file_preinst /etc/texmf/dvips/config/config.qms $1 $2
handle_config_file_preinst /etc/texmf/dvips/config/config.toshiba $1 $2
handle_config_file_preinst /etc/texmf/dvips/config/config.unms $1 $2
handle_config_file_preinst /etc/texmf/dvips/config/config.xyp $1 $2
handle_config_file_preinst /etc/texmf/dvips/config/cx.cfg $1 $2
handle_config_file_preinst /etc/texmf/dvips/config/deskjet.cfg $1 $2
handle_config_file_preinst /etc/texmf/dvips/config/dfaxhigh.cfg $1 $2
handle_config_file_preinst /etc/texmf/dvips/config/dvired.cfg $1 $2
handle_config_file_preinst /etc/texmf/dvips/config/epson.cfg $1 $2
handle_config_file_preinst /etc/texmf/dvips/config/ibmvga.cfg $1 $2
handle_config_file_preinst /etc/texmf/dvips/config/ljfour.cfg $1 $2
handle_config_file_preinst /etc/texmf/dvips/config/qms.cfg $1 $2
handle_config_file_preinst /etc/texmf/dvips/config/toshiba.cfg $1 $2
handle_config_file_preinst /etc/texmf/xdvi/xdvi.cfg $1 $2
handle_config_file_preinst /etc/texmf/texdoc/texdoc.cnf $1 $2
handle_config_file_preinst /etc/texmf/texdoctk/texdocrc.defaults $1 $2


# texlive-base preinst.post begin

# make sure that no strange old duplicate lines are hanging around in
# 10texlive-base.cnf
# but do the sed command only if the key line below actually occurs, so
# that we do not create spurious empty conffiles in /etc/texmf/fmt.d
cnffile=/etc/texmf/fmt.d/10texlive-base.cnf
if [ -r $cnffile ] && [ -n "$(sed -n '/^# The following added lines have been transferred from/ {p;q}' $cnffile)" ]; then
  sed --in-place=pre-edit '
    /^# The following added lines have been transferred from/ {
                  # the next four N command merge the following lines into
                  # the current one (which is the one above "# The following.."
                  # and does not output anything.
	    N
	    N
	    N
	    N
                  # now match for the full 5 lines bunch, but replaces 
                  # matches spaces between the different entries in the 
                  # format definitions with at least one whitespace
	    /^# The following added lines have been transferred from\W*\n# \/etc\/texmf\/fmt.d\/10texlive-base-bin.cnf\W*\n#They take precedence over earlier entries\W*\netex\W\+pdftex\W\+language.def\W\+-translate-file=cp227.tcx\W\+\*etex.ini\W*\npdfetex\W\+pdftex\W\+language.def\W\+-translate-file=cp227.tcx\W\+\*pdfetex.ini\W*$/ {
                  # replace all beginning of lines with ###
		    s/\n/\n###/g
                  # do the same for the first line where there is no newline
                  # and add a comment there, too
		    s/^/# The following lines are disabled to protect loops\n# Please see Debian bug #557091 for details\n###/
	    }
    }
  ' /etc/texmf/fmt.d/10texlive-base.cnf
fi


## 20110524, FK: remove the following code completely if we are sure
# Cleanup after Bug #420390 for sid users
# resurrect_conffile_sid /etc/texmf/metafont/misc/modes.mf texlive-base "$1" "$2"
# resurrect_conffile_sid /etc/texmf/tex/generic/config/pdftexconfig.tex texlive-base "$1" "$2"
# we do not ship config.ps currently, do we need to resurrect that one, too?
#resurrect_conffile_sid /etc/texmf/dvips/config/config.ps texlive-bin "$1" "$2"


# texlive-base preinst.post end

# Let vim know that we don't want tabs
# vim:set tabstop=2 expandtab: #
exit 0