]> git.donarmstrong.com Git - lilypond.git/blob - debian/preinst
release: 0.1.31
[lilypond.git] / debian / preinst
1 #!/bin/bash -e
2 #
3 # preinst script for the Debian GNU/Linux lilypond package
4 #   by Anthony Fok <foka@gpu.srv.ualberta.ca>
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:  Tue, 11 Nov 1997 01:25:15 -0700
8
9 package=lilypond
10 font_supplier=public
11 font_typeface=lilypond
12 std_TEXMF=/usr/lib/texmf
13
14 if [ "`which kpsetool`" ]; then
15     TEXMF=`kpsetool -v '$TEXMF'`
16 fi
17 : ${TEXMF:=$std_TEXMF}
18
19
20 case "$1" in
21
22     install | upgrade)
23
24         # Prior to the Debian release of the lilypond_0.1.29-1 package,
25         # LilyPond's fonts were not added to teTeX's special.map,
26         # and so the automatically generated TFM and PK files were placed
27         # in the wrong directory under /var/spool/texmf (or $MT_DESTROOT).
28         # So, now I have to clean up after my mess to make sure those fonts
29         # do not interfere with the new fonts!  :)
30
31         : ${MAKETEXDIR=$TEXMF/maketex}
32         test -r $MAKETEXDIR/maketex.site && . $MAKETEXDIR/maketex.site
33         : ${MT_DESTROOT=$TEXMF/fonts}
34
35         # Remove the "stray" old LilyPond TFM and PK files.
36         for i in tfm pk
37         do
38             find $MT_DESTROOT/$i \( -name 'dyn10.*'$i -o -name 'font-en-tja*.*'$i \
39                 -o -name 'vette-beams*.*'$i \) -print0 |
40                 xargs --null --no-run-if-empty rm -f
41         done
42
43         # Remove empty directories.
44         # A note to myself or the future maintainer:
45         #   Why the "for i in 1 2" loop?  Well, it seems that either
46         #   "find some_path -depth" isn't working properly, or I
47         #   (Anthony) don't know its proper behaviour.  Please look
48         #   into it and see if this ugly hack could be removed.
49         for i in 1 2
50         do
51             find $MT_DESTROOT/tfm -depth -mindepth 1 -type d -empty -print0 2> /dev/null |
52                 xargs -0r --null --no-run-if-empty rmdir
53             find $MT_DESTROOT/pk -depth -mindepth 2 -type d -empty -print0 2> /dev/null |
54                 xargs -0r --null --no-run-if-empty rmdir
55         done
56     ;;
57
58     abort-upgrade)
59     ;;
60
61     *)
62         echo "$0 called with unknown argument \`$1'" >&2
63         exit 0
64     ;;
65
66 esac