| 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.9 2004/10/19 19:51:12 vapier Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/sgml-catalog.eclass,v 1.14 2005/09/08 17:37:32 leonardop 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 | INHERITED="$INHERITED $ECLASS" |
|
|
| 9 | |
8 | |
| 10 | DEPEND=">=app-text/sgml-common-0.6.3-r2" |
9 | DEPEND=">=app-text/sgml-common-0.6.3-r2" |
| 11 | ECLASS=sgml-catalog |
|
|
| 12 | |
10 | |
| 13 | declare -a toinstall |
11 | |
| 14 | declare -i catcounter |
12 | # List of catalogs to install |
| 15 | let "catcounter=0" |
13 | SGML_TOINSTALL="" |
|
|
14 | |
| 16 | |
15 | |
| 17 | sgml-catalog_cat_include() { |
16 | sgml-catalog_cat_include() { |
| 18 | debug-print function $FUNCNAME $* |
17 | debug-print function $FUNCNAME $* |
| 19 | toinstall["catcounter++"]="${1}:${2}" |
18 | SGML_TOINSTALL="${SGML_TOINSTALL} ${1}:${2}" |
| 20 | } |
19 | } |
| 21 | |
20 | |
| 22 | sgml-catalog_cat_doinstall() { |
21 | sgml-catalog_cat_doinstall() { |
| 23 | debug-print function $FUNCNAME $* |
22 | debug-print function $FUNCNAME $* |
| 24 | /usr/bin/install-catalog --add $1 $2 &>/dev/null |
23 | /usr/bin/install-catalog --add $1 $2 &>/dev/null |
| 25 | } |
24 | } |
| 26 | |
25 | |
| 27 | sgml-catalog_cat_doremove() { |
26 | sgml-catalog_cat_doremove() { |
| 28 | debug-print function $FUNCNAME $* |
27 | debug-print function $FUNCNAME $* |
| 29 | /usr/bin/install-catalog --remove $1 $2 &>/dev/null |
28 | /usr/bin/install-catalog --remove $1 $2 &>/dev/null |
| 30 | } |
29 | } |
| 31 | |
30 | |
| 32 | sgml-catalog_pkg_postinst() { |
31 | sgml-catalog_pkg_postinst() { |
| 33 | debug-print function $FUNCNAME $* |
32 | debug-print function $FUNCNAME $* |
| 34 | declare -i topindex |
33 | |
| 35 | topindex="catcounter-1" |
34 | for entry in ${SGML_TOINSTALL}; do |
| 36 | for i in `seq 0 ${topindex}` |
35 | arg1=`echo ${entry} | cut -f1 -d\:` |
| 37 | do |
36 | arg2=`echo ${entry} | cut -f2 -d\:` |
| 38 | arg1=`echo ${toinstall[$i]} | cut -f1 -d\:` |
37 | if [ ! -e ${arg2} ] |
| 39 | arg2=`echo ${toinstall[$i]} | cut -f2 -d\:` |
38 | then |
| 40 | if [ ! -e $arg2 ] |
|
|
| 41 | then |
|
|
| 42 | ewarn "${arg2} doesn't appear to exist, although it ought to!" |
39 | ewarn "${arg2} doesn't appear to exist, although it ought to!" |
| 43 | continue |
40 | continue |
| 44 | fi |
41 | fi |
| 45 | einfo "Now adding $arg2 to $arg1 and /etc/sgml/catalog" |
42 | einfo "Now adding ${arg2} to ${arg1} and /etc/sgml/catalog" |
| 46 | sgml-catalog_cat_doinstall $arg1 $arg2 |
43 | sgml-catalog_cat_doinstall ${arg1} ${arg2} |
| 47 | done |
44 | done |
| 48 | sgml-catalog_cleanup |
45 | sgml-catalog_cleanup |
| 49 | } |
46 | } |
| 50 | |
47 | |
| 51 | sgml-catalog_pkg_prerm() { |
48 | sgml-catalog_pkg_prerm() { |
| 52 | sgml-catalog_cleanup |
49 | sgml-catalog_cleanup |
| 53 | } |
50 | } |
| 54 | |
51 | |
| 55 | sgml-catalog_pkg_postrm() { |
52 | sgml-catalog_pkg_postrm() { |
| 56 | debug-print function $FUNCNAME $* |
53 | debug-print function $FUNCNAME $* |
| 57 | declare -i topindex |
54 | |
| 58 | topindex="catcounter-1" |
55 | for entry in ${SGML_TOINSTALL}; do |
| 59 | for i in `seq 0 ${topindex}` |
56 | arg1=`echo ${entry} | cut -f1 -d\:` |
| 60 | do |
57 | arg2=`echo ${entry} | cut -f2 -d\:` |
| 61 | arg1=`echo ${toinstall[$i]} | cut -f1 -d\:` |
58 | if [ -e ${arg2} ] |
| 62 | arg2=`echo ${toinstall[$i]} | cut -f2 -d\:` |
59 | then |
| 63 | if [ -e $arg2 ] |
|
|
| 64 | then |
|
|
| 65 | ewarn "${arg2} still exists! Not removing from ${arg1}" |
60 | ewarn "${arg2} still exists! Not removing from ${arg1}" |
| 66 | ewarn "This is normal behavior for an upgrade ..." |
61 | ewarn "This is normal behavior for an upgrade ..." |
| 67 | continue |
62 | continue |
| 68 | fi |
63 | fi |
| 69 | einfo "Now removing $arg1 from $arg2 and /etc/sgml/catalog" |
64 | einfo "Now removing $arg1 from $arg2 and /etc/sgml/catalog" |
| 70 | sgml-catalog_cat_doremove $arg1 $arg2 |
65 | sgml-catalog_cat_doremove ${arg1} ${arg2} |
| 71 | done |
66 | done |
| 72 | } |
67 | } |
| 73 | |
68 | |
| 74 | sgml-catalog_cleanup() { |
69 | sgml-catalog_cleanup() { |
| 75 | if [ -e /usr/bin/gensgmlenv ] |
70 | if [ -e /usr/bin/gensgmlenv ] |
| 76 | then |
71 | then |
| 77 | einfo Regenerating SGML environment variables ... |
72 | einfo Regenerating SGML environment variables ... |
| 78 | gensgmlenv |
73 | gensgmlenv |
| 79 | grep -v export /etc/sgml/sgml.env > /etc/env.d/93sgmltools-lite |
74 | grep -v export /etc/sgml/sgml.env > /etc/env.d/93sgmltools-lite |
| 80 | fi |
75 | fi |
| 81 | } |
76 | } |
| 82 | |
77 | |
| 83 | sgml-catalog_src_compile() { |
78 | sgml-catalog_src_compile() { |
| 84 | return |
79 | return |
| 85 | } |
80 | } |
| 86 | |
81 | |
| 87 | EXPORT_FUNCTIONS pkg_postrm pkg_postinst src_compile pkg_prerm |
82 | EXPORT_FUNCTIONS pkg_postrm pkg_postinst src_compile pkg_prerm |