summaryrefslogtreecommitdiff
blob: 672622257e9fcc9f5a0f7bfeb73ff7413114ce6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/sgml-catalog.eclass,v 1.8 2004/06/25 00:39:48 vapier Exp $
#
# Author Matthew Turk <satai@gentoo.org>

inherit base
INHERITED="$INHERITED $ECLASS"

DEPEND=">=app-text/sgml-common-0.6.3-r2"
ECLASS=sgml-catalog

declare -a toinstall
declare -i catcounter
let "catcounter=0"

sgml-catalog_cat_include() {
    debug-print function $FUNCNAME $*
    toinstall["catcounter++"]="${1}:${2}"
}

sgml-catalog_cat_doinstall() {
    debug-print function $FUNCNAME $*
    /usr/bin/install-catalog --add $1 $2 &>/dev/null
}

sgml-catalog_cat_doremove() {
    debug-print function $FUNCNAME $*
    /usr/bin/install-catalog --remove $1 $2 &>/dev/null
}

sgml-catalog_pkg_postinst() {
    debug-print function $FUNCNAME $*
    declare -i topindex
    topindex="catcounter-1"
    for i in `seq 0 ${topindex}`
    do
        arg1=`echo ${toinstall[$i]} | cut -f1 -d\:`
        arg2=`echo ${toinstall[$i]} | cut -f2 -d\:`
        if [ ! -e $arg2 ]
        then
            ewarn "${arg2} doesn't appear to exist, although it ought to!"
            continue
        fi
        einfo "Now adding $arg2 to $arg1 and /etc/sgml/catalog"
        sgml-catalog_cat_doinstall $arg1 $arg2
    done
    sgml-catalog_cleanup
}

sgml-catalog_pkg_prerm() {
    sgml-catalog_cleanup
}

sgml-catalog_pkg_postrm() {
    debug-print function $FUNCNAME $*
    declare -i topindex
    topindex="catcounter-1"
    for i in `seq 0 ${topindex}`
    do
        arg1=`echo ${toinstall[$i]} | cut -f1 -d\:`
        arg2=`echo ${toinstall[$i]} | cut -f2 -d\:`
        if [ -e $arg2 ] 
        then
            ewarn "${arg2} still exists!  Not removing from ${arg1}" 
            ewarn "This is normal behavior for an upgrade..."
            continue
        fi
        einfo "Now removing $arg1 from $arg2 and /etc/sgml/catalog"
        sgml-catalog_cat_doremove $arg1 $arg2
    done
}

sgml-catalog_cleanup() {
    if [ -e /usr/bin/gensgmlenv ]
    then
        einfo Regenerating SGML environment variables...
        gensgmlenv
        grep -v export /etc/sgml/sgml.env > /etc/env.d/93sgmltools-lite
    fi
}

sgml-catalog_src_compile() {
    return
}

EXPORT_FUNCTIONS pkg_postrm pkg_postinst src_compile pkg_prerm