| 1 | # Copyright 1999-2004 Gentoo Foundation |
1 | # Copyright 1999-2004 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/sgml-catalog.eclass,v 1.10 2005/07/06 20:20:04 agriffis Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/sgml-catalog.eclass,v 1.11 2005/07/11 15:08:06 swegener Exp $ |
| 4 | # |
4 | # |
| 5 | # Author Matthew Turk <satai@gentoo.org> |
5 | # Author Matthew Turk <satai@gentoo.org> |
| 6 | |
6 | |
| 7 | inherit base |
7 | inherit base |
| 8 | |
8 | |
| … | |
… | |
| 11 | declare -a toinstall |
11 | declare -a toinstall |
| 12 | declare -i catcounter |
12 | declare -i catcounter |
| 13 | let "catcounter=0" |
13 | let "catcounter=0" |
| 14 | |
14 | |
| 15 | sgml-catalog_cat_include() { |
15 | sgml-catalog_cat_include() { |
| 16 | debug-print function $FUNCNAME $* |
16 | debug-print function $FUNCNAME $* |
| 17 | toinstall["catcounter++"]="${1}:${2}" |
17 | toinstall["catcounter++"]="${1}:${2}" |
| 18 | } |
18 | } |
| 19 | |
19 | |
| 20 | sgml-catalog_cat_doinstall() { |
20 | sgml-catalog_cat_doinstall() { |
| 21 | debug-print function $FUNCNAME $* |
21 | debug-print function $FUNCNAME $* |
| 22 | /usr/bin/install-catalog --add $1 $2 &>/dev/null |
22 | /usr/bin/install-catalog --add $1 $2 &>/dev/null |
| 23 | } |
23 | } |
| 24 | |
24 | |
| 25 | sgml-catalog_cat_doremove() { |
25 | sgml-catalog_cat_doremove() { |
| 26 | debug-print function $FUNCNAME $* |
26 | debug-print function $FUNCNAME $* |
| 27 | /usr/bin/install-catalog --remove $1 $2 &>/dev/null |
27 | /usr/bin/install-catalog --remove $1 $2 &>/dev/null |
| 28 | } |
28 | } |
| 29 | |
29 | |
| 30 | sgml-catalog_pkg_postinst() { |
30 | sgml-catalog_pkg_postinst() { |
| 31 | debug-print function $FUNCNAME $* |
31 | debug-print function $FUNCNAME $* |
| 32 | declare -i topindex |
32 | declare -i topindex |
| 33 | topindex="catcounter-1" |
33 | topindex="catcounter-1" |
| 34 | for i in `seq 0 ${topindex}` |
34 | for i in `seq 0 ${topindex}` |
| 35 | do |
35 | do |
| 36 | arg1=`echo ${toinstall[$i]} | cut -f1 -d\:` |
36 | arg1=`echo ${toinstall[$i]} | cut -f1 -d\:` |
| 37 | arg2=`echo ${toinstall[$i]} | cut -f2 -d\:` |
37 | arg2=`echo ${toinstall[$i]} | cut -f2 -d\:` |
| 38 | if [ ! -e $arg2 ] |
38 | if [ ! -e ${arg2} ] |
| 39 | then |
39 | then |
| 40 | ewarn "${arg2} doesn't appear to exist, although it ought to!" |
40 | ewarn "${arg2} doesn't appear to exist, although it ought to!" |
| 41 | continue |
41 | continue |
| 42 | fi |
42 | fi |
| 43 | einfo "Now adding $arg2 to $arg1 and /etc/sgml/catalog" |
43 | einfo "Now adding ${arg2} to ${arg1} and /etc/sgml/catalog" |
| 44 | sgml-catalog_cat_doinstall $arg1 $arg2 |
44 | sgml-catalog_cat_doinstall ${arg1} ${arg2} |
| 45 | done |
45 | done |
| 46 | sgml-catalog_cleanup |
46 | sgml-catalog_cleanup |
| 47 | } |
47 | } |
| 48 | |
48 | |
| 49 | sgml-catalog_pkg_prerm() { |
49 | sgml-catalog_pkg_prerm() { |
| 50 | sgml-catalog_cleanup |
50 | sgml-catalog_cleanup |
| 51 | } |
51 | } |
| 52 | |
52 | |
| 53 | sgml-catalog_pkg_postrm() { |
53 | sgml-catalog_pkg_postrm() { |
| 54 | debug-print function $FUNCNAME $* |
54 | debug-print function $FUNCNAME $* |
| 55 | declare -i topindex |
55 | declare -i topindex |
| 56 | topindex="catcounter-1" |
56 | topindex="catcounter-1" |
| 57 | for i in `seq 0 ${topindex}` |
57 | for i in `seq 0 ${topindex}` |
| 58 | do |
58 | do |
| 59 | arg1=`echo ${toinstall[$i]} | cut -f1 -d\:` |
59 | arg1=`echo ${toinstall[$i]} | cut -f1 -d\:` |
| 60 | arg2=`echo ${toinstall[$i]} | cut -f2 -d\:` |
60 | arg2=`echo ${toinstall[$i]} | cut -f2 -d\:` |
| 61 | if [ -e $arg2 ] |
61 | if [ -e ${arg2} ] |
| 62 | then |
62 | then |
| 63 | ewarn "${arg2} still exists! Not removing from ${arg1}" |
63 | ewarn "${arg2} still exists! Not removing from ${arg1}" |
| 64 | ewarn "This is normal behavior for an upgrade ..." |
64 | ewarn "This is normal behavior for an upgrade ..." |
| 65 | continue |
65 | continue |
| 66 | fi |
66 | fi |
| 67 | einfo "Now removing $arg1 from $arg2 and /etc/sgml/catalog" |
67 | einfo "Now removing $arg1 from $arg2 and /etc/sgml/catalog" |
| 68 | sgml-catalog_cat_doremove $arg1 $arg2 |
68 | sgml-catalog_cat_doremove ${arg1} ${arg2} |
| 69 | done |
69 | done |
| 70 | } |
70 | } |
| 71 | |
71 | |
| 72 | sgml-catalog_cleanup() { |
72 | sgml-catalog_cleanup() { |
| 73 | if [ -e /usr/bin/gensgmlenv ] |
73 | if [ -e /usr/bin/gensgmlenv ] |
| 74 | then |
74 | then |
| 75 | einfo Regenerating SGML environment variables ... |
75 | einfo Regenerating SGML environment variables ... |
| 76 | gensgmlenv |
76 | gensgmlenv |
| 77 | grep -v export /etc/sgml/sgml.env > /etc/env.d/93sgmltools-lite |
77 | grep -v export /etc/sgml/sgml.env > /etc/env.d/93sgmltools-lite |
| 78 | fi |
78 | fi |
| 79 | } |
79 | } |
| 80 | |
80 | |
| 81 | sgml-catalog_src_compile() { |
81 | sgml-catalog_src_compile() { |
| 82 | return |
82 | return |
| 83 | } |
83 | } |
| 84 | |
84 | |
| 85 | EXPORT_FUNCTIONS pkg_postrm pkg_postinst src_compile pkg_prerm |
85 | EXPORT_FUNCTIONS pkg_postrm pkg_postinst src_compile pkg_prerm |