lilypond-1.1.55
[lilypond.git] / debian / preinst
blobfff81f284cfb5734a53d4ea66b7884bf5402ffbc
1 #!/bin/sh
3 # preinst script for the Debian GNU/Linux lilypond package
4 # by Anthony Fok <foka@debian.org>
5 # This is free software; see the GNU General Public Licence
6 # version 2 or later for copying conditions. There is NO warranty.
7 # Last modified: Mon, 5 Jan 1998 18:39:30 -0700
9 set -e
11 package=lilypond
12 font_supplier=public
13 font_typeface=lilypond
14 std_TEXMF=/usr/lib/texmf
16 #DEBHELPER#
18 if [ "`which kpsetool`" ]; then
19 TEXMF=`kpsetool -v '$TEXMF'`
21 : ${TEXMF:=$std_TEXMF}
24 case "$1" in
26 install | upgrade)
28 # Prior to the Debian release of the lilypond_0.1.29-1 package,
29 # LilyPond's fonts were not added to teTeX's special.map,
30 # and so the automatically generated TFM and PK files were placed
31 # in the wrong directory under /var/spool/texmf (or $MT_DESTROOT).
32 # So, now I have to clean up after my mess to make sure those fonts
33 # do not interfere with the new fonts! :)
35 : ${MAKETEXDIR=$TEXMF/maketex}
36 test -r $MAKETEXDIR/maketex.site && . $MAKETEXDIR/maketex.site
37 : ${MT_DESTROOT=$TEXMF/fonts}
39 # Remove the "stray" old LilyPond TFM and PK files.
40 for i in tfm pk
42 find $MT_DESTROOT/$i \( -name 'dyn10.*'$i -o -name 'font-en-tja*.*'$i \
43 -o -name 'vette-beams*.*'$i \) -print0 |
44 xargs --null --no-run-if-empty rm -f
45 done
47 # Remove empty directories.
48 # A note to myself or the future maintainer:
49 # Why the "for i in 1 2" loop? Well, it seems that either
50 # "find some_path -depth" isn't working properly, or I
51 # (Anthony) don't know its proper behaviour. Please look
52 # into it and see if this ugly hack could be removed.
53 for i in 1 2
55 find $MT_DESTROOT/tfm -depth -mindepth 1 -type d -empty -print0 2> /dev/null |
56 xargs -0r --null --no-run-if-empty rmdir
57 find $MT_DESTROOT/pk -depth -mindepth 2 -type d -empty -print0 2> /dev/null |
58 xargs -0r --null --no-run-if-empty rmdir
59 done
62 abort-upgrade)
66 echo "$0 called with unknown argument \`$1'" >&2
67 exit 0
70 esac