RFC: change of example postinst scripts for fonts, and impl in dh_installtexfonts
Hi all!
I propose to change the postinst-texfonts and postrm-texfonts
(those snippets installed by debhelper when using dh_installtexfonts,
and the very same stuff does occur in the TeX Policy appendix as example
implementation) as bellow.
Please tell me your opinion, especially what you think about the
check_run_without_error function in the postrm part. It uses set -e and
set +e to catch errors.
Thanks a lot for any comments.
#
# postinst-texfonts
#
# postinst snippets for installing fonts for TeX
#
# Authors:
# Florent Rougon <f.rougon@free.fr>
# Norbert Preining <preining@logic.at>
#
# Please note that comments in this file are stripped before installation
# by calling a grep -v '^[ \t]*#'
# So please be careful if you add stuff here!
update_lsr_files ()
{
tempfile=`mktemp -p /tmp mktexlsr.XXXXXXXX`
echo -n "Running mktexlsr. This may take some time. ..."
if mktexlsr > $tempfile 2>&1 ; then
rm -f $tempfile
echo " done."
else
echo
echo "mktexlsr failed. Output has been stored in"
echo "$tempfile"
echo "Please include this file if you report a bug."
echo
exit 1
fi
}
create_fontmaps ()
{
tempfile=`mktemp -p /tmp updmap.XXXXXXXX`
echo -n "Running updmap-sys. This may take some time. ..."
if updmap-sys > $tempfile 2>&1 ; then
rm -f $tempfile
echo " done."
else
echo
echo "updmap failed. Output has been stored in"
echo "$tempfile"
echo "Please include this file if you report a bug."
echo
exit 1
fi
}
case "$1" in
configure|abort-upgrade|abort-remove|abort-deconfigure)
update-updmap
if which mktexlsr >/dev/null; then
update_lsr_files
fi
if which updmap-sys >/dev/null; then
create_fontmaps
fi
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# end of postinst-texfonts
#
# postrm-texfonts
#
# postrm snippets for installing fonts for TeX
#
# Authors:
# Florent Rougon <f.rougon@free.fr>
# Norbert Preining <preining@logic.at>
#
# Please note that comments in this file are stripped before installation
# by calling a grep -v '^[ \t]*#'
# So please be careful if you add stuff here!
# The function name is check_run_without_erros because the following
# scenario might happen:
# 1. this package is deconfigured
# 2. tex-common and tetex-bin are removed
# 3. this package is removed or purged
#
# (cf. Policy § 6.5, step 2, about a conflicting package being removed due
# to the installation of the package being discussed).
#
check_run_without_errors ()
{
tempfile=`mktemp -p /tmp checkrun.XXXXXXXX`
if which $1 >/dev/null; then
echo -n "Running $*. This may take some time. ..."
set +e
$* > $tempfile 2>&1
if [ $? = 0 ] ; then
rm -f $tempfile
echo " done."
else
echo
echo "$* failed. Output has been stored in"
echo "$tempfile"
echo "If tex-common is not configured you can ignore this error message!"
echo "Otherwise please include this file if you report a bug."
echo
fi
set -e
else
rm -f $tempfile
fi
return 0
}
case "$1" in
remove|disappear)
check_run_without_errors update-updmap
check_run_without_errors mktexlsr
check_run_without_errors updmap-sys
;;
purge|upgrade|failed-upgrade|abort-upgrade|abort-install)
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac
# end of postrm-texfonts
Best wishes
Norbert
-------------------------------------------------------------------------------
Dr. Norbert Preining <preining AT logic DOT at> Università di Siena
gpg DSA: 0x09C5B094 fp: 14DF 2E6C 0307 BE6D AD76 A9C0 D2BF 4AA3 09C5 B094
-------------------------------------------------------------------------------
STEBBING (n.)
The erection you cannot conceal because you're not wearing a jacket.
--- Douglas Adams, The Meaning of Liff
Reply to: