1 |
# Copyright 1999-2002 Gentoo Technologies, Inc. |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# Author Matthew Turk <satai@gentoo.org> |
4 |
# $Header: /home/cvsroot/gentoo-x86/eclass/sgml-catalog.eclass,v 1.1 2002/12/31 04:35:01 satai Exp $ |
5 |
# |
6 |
|
7 |
inherit base |
8 |
INHERITED="$INHERITED $ECLASS" |
9 |
|
10 |
newdepend ">=sgml-common-0.6.3-r2" |
11 |
ECLASS=sgml-catalog |
12 |
|
13 |
declare -a toinstall |
14 |
declare -i catcounter |
15 |
let "catcounter=0" |
16 |
|
17 |
sgml-catalog_cat_include() { |
18 |
debug-print function $FUNCNAME $* |
19 |
toinstall["catcounter++"]="${1}:${2}" |
20 |
} |
21 |
|
22 |
sgml-catalog_cat_doinstall() { |
23 |
debug-print function $FUNCNAME $* |
24 |
/usr/bin/install-catalog --add $1 $2 &>/dev/null |
25 |
} |
26 |
|
27 |
sgml-catalog_cat_doremove() { |
28 |
debug-print function $FUNCNAME $* |
29 |
/usr/bin/install-catalog --remove $1 $2 &>/dev/null |
30 |
} |
31 |
|
32 |
sgml-catalog_pkg_postinst() { |
33 |
debug-print function $FUNCNAME $* |
34 |
declare -i topindex |
35 |
topindex="catcounter-1" |
36 |
for i in `seq 0 ${topindex}` |
37 |
do |
38 |
arg1=`echo ${toinstall[$i]} | cut -f1 -d\:` |
39 |
arg2=`echo ${toinstall[$i]} | cut -f2 -d\:` |
40 |
if [ ! -e $arg2 ] |
41 |
then |
42 |
ewarn "${arg2} doesn't appear to exist, although it ought to!" |
43 |
return |
44 |
fi |
45 |
einfo "Now adding $arg1 to $arg2 and /etc/sgml/catalog" |
46 |
sgml-catalog_cat_doinstall $arg1 $arg2 |
47 |
done |
48 |
} |
49 |
|
50 |
sgml-catalog_pkg_postrm() { |
51 |
debug-print function $FUNCNAME $* |
52 |
declare -i topindex |
53 |
topindex="catcounter-1" |
54 |
for i in `seq 0 ${topindex}` |
55 |
do |
56 |
arg1=`echo ${toinstall[$i]} | cut -f1 -d\:` |
57 |
arg2=`echo ${toinstall[$i]} | cut -f2 -d\:` |
58 |
if [ -e $arg2 ] |
59 |
then |
60 |
ewarn "${arg2} still exists! Not removing from ${arg1}" |
61 |
ewarn "This is normal behavior for an upgrade..." |
62 |
return |
63 |
fi |
64 |
einfo "Now removing $arg1 from $arg2 and /etc/sgml/catalog" |
65 |
sgml-catalog_cat_doremove $arg1 $arg2 |
66 |
done |
67 |
} |
68 |
|
69 |
sgml-catalog_src_compile() { |
70 |
return |
71 |
} |
72 |
|
73 |
EXPORT_FUNCTIONS pkg_postrm pkg_postinst src_compile |