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
|
#!/bin/bash
# jadetex postinst
# jobs: texhash, remove old cruft we used to make, and run fmtutil
set -e
# clear environment
TETEXDIR=
TEXMF=
TEXINPUTS=
ETC_CONFIG=/etc/texmf/jadetex
WEB2CDIR=$(dirname $(kpsewhich latex.fmt))
umask 022
checkfmt ( ) {
format=$1
baseformat=`basename $1 .fmt`
if ! kpsewhich $format > /dev/null ; then
echo "WARNING: memory dump $format not found, attempting to reconstruct ..."
echo "running 'fmtutil --byfmt $baseformat'" >> $MYTMPFILE
fmtutil --byfmt $baseformat >> $MYTMPFILE
if kpsewhich $format > /dev/null ; then
echo " ok, reconstructed"
else
echo "ERROR: cannot create TeX memory dump $format"
echo " Your TeX environment seems to be broken; the memory dump file $format"
echo " was not found and cannot be created. Probably, TeX is miconfigured."
echo " You should submit the log file $MYTEMPFILE as a bug against"
echo " the package tetex-bin."
echo
echo "JadeTeX cannot be installed."
exit 1
fi
fi
}
makejadetexfmt ( ) {
fmtutil --cnffile $ETC_CONFIG/fmtutil.cnf --all >> $MYTMPFILE
}
jadetexfmtcheck ( ) {
# check whether it actually worked, since the texconfig program
# doesn't exit non-zero
# file exists test
local goterror
goterror=
if ! kpsewhich jadetex.fmt > /dev/null ; then
echo "ERROR: JadeTeX memory dump (jadetex.fmt) cannot be found"
goterror=yes
fi
if ! kpsewhich pdfjadetex.fmt > /dev/null ; then
echo "ERROR: PDFJadeTeX memory dump (pdfjadetex.fmt) cannot be found"
goterror=yes
fi
if [ $goterror ]; then
return -1
else
return 0
fi
}
if [ "$1" = "configure" ]; then
# old crufty stuff we used to build in postinst - I wonder whether we
# should actually do this in preinst?
if [ -L /usr/lib/texmf/tex/jadetex/config ]; then
echo removing old JadeTeX config symlink
rm /usr/lib/texmf/tex/jadetex/config
fi
if [ -d /usr/lib/texmf/tex/jadetex ]; then
rmdir /usr/lib/texmf/tex/jadetex || \
echo "unused, obsolete dir /usr/lib/texmf/tex/jadetex, remove it yourself if you care"
fi
texhash
MYTMPFILE=`mktemp /tmp/jadetex-postinst.XXXXXX`
: > $MYTMPFILE
echo "Checking for TeX memory dumps (.fmt) ..."
checkfmt latex.fmt
checkfmt pdftex.fmt
checkfmt pdflatex.fmt
echo " done."
echo "Creating JadeTeX memory dumps ..."
makejadetexfmt
if jadetexfmtcheck; then
echo " done."
else
echo "Desperate measures: running 'fmtutil --all' to rebuild existing TeX"
echo " memory dumps ..."
fmtutil --all
echo " done."
echo "Retrying to create JadeTeX memory dumps ..."
makejadetexfmt
if jadetexfmtcheck; then
echo " done."
else
echo "ERROR: cannot create JadeTeX memory dump"
echo " Please report this bug; include tetex* package version"
echo " numbers and the file $MYTMPFILE in the bug report."
exit 1
fi
fi
# remove temp file
rm -f $MYTMPFILE
fi
#DEBHELPER#
exit 0
|