blob: df6d3b55a3adad104ab168d0ddad0828ecfeeeea (
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit eutils versionator
MY_PV_MAJOR="$(get_version_component_range 1-2 ${PV})"
MY_PV="${PV//[_]/}"
MY_PV="${MY_PV//rc/RC}"
MY_P="${PN}-${MY_PV}"
MY_PN="OCSInventory-NG"
MY_LPN="ocsinventory-server"
DESCRIPTION="OCS Inventory NG Management Server"
HOMEPAGE="http://www.ocsinventory-ng.org/"
SRC_URI="https://github.com/${MY_PN}/${PN}/archive/${MY_PV}/${PV}.tar.gz -> ${P}.tar.gz"
SLOT="0"
LICENSE="GPL-2 LGPL-2"
KEYWORDS="~amd64"
IUSE="soap"
S="${WORKDIR}/${MY_P}"
DEPEND="
dev-lang/perl
sys-devel/make
"
RDEPEND="${DEPEND}
!net-analyzer/ocsng[comm]
app-admin/logrotate
dev-perl/Apache-DBI
dev-perl/Archive-Zip
dev-perl/DBI
dev-perl/DBD-mysql
dev-perl/Net-IP
dev-perl/XML-Simple
virtual/perl-Compress-Raw-Zlib
www-apache/mod_perl
www-servers/apache
soap? (
dev-perl/SOAP-Lite
)
"
src_compile() {
pushd "Apache"
perl Makefile.PL || die "perl Makefile.PL failed"
emake || die "emake failed"
popd
}
src_install() {
LOGDIR="/var/log/ocsng"
# Communication server
PLUGINS_CONFIG_DIR="/usr/share/ocsng/config"
PLUGINS_PERL_DIR="/usr/share/ocsng/plugins"
pushd "Apache"
emake DESTDIR="${D}" install || die "Install failed"
popd
insinto "/etc/logrotate.d"
doins "${FILESDIR}/ocsng"
# Configure OCS (communication server)
# set mod_perl version > 1.999_21
sed -i -e "s/VERSION_MP/2/" etc/ocsinventory/ocsinventory-server.conf
sed -i -e "s:PATH_TO_LOG_DIRECTORY:${LOGDIR}:" etc/ocsinventory/ocsinventory-server.conf
sed -i -e "s:PATH_TO_PLUGINS_CONFIG_DIRECTORY:${PLUGINS_CONFIG_DIR}:" etc/ocsinventory/ocsinventory-server.conf
sed -i -e "s:PATH_TO_PLUGINS_PERL_DIRECTORY:${PLUGINS_PERL_DIR}:" etc/ocsinventory/ocsinventory-server.conf
dodoc "etc/ocsinventory/ocsinventory-server.conf"
ADM_STATIC_DIR="/usr/share/ocsng/reports"
ADM_REPORTS_ALIAS="/ocsreports"
ADM_VAR_DIR="/var/lib/ocsng"
IPD_DIR="ipd"
IPD_ALIAS="/ipd"
PACKAGES_DIR="download"
PACKAGES_ALIAS="/download"
SNMP_DIR="snmp"
SNMP_ALIAS="/snmp"
# OCSREPORTS example config
sed -i -e "s:OCSREPORTS_ALIAS:${ADM_REPORTS_ALIAS}:" etc/ocsinventory/ocsinventory-reports.conf
sed -i -e "s:PATH_TO_OCSREPORTS_DIR:${ADM_STATIC_DIR}:" etc/ocsinventory/ocsinventory-reports.conf
sed -i -e "s:IPD_ALIAS:${IPD_ALIAS}:" etc/ocsinventory/ocsinventory-reports.conf
sed -i -e "s:PATH_TO_IPD_DIR:${IPD_DIR}:" etc/ocsinventory/ocsinventory-reports.conf
sed -i -e "s:PACKAGES_ALIAS:${PACKAGES_ALIAS}:" etc/ocsinventory/ocsinventory-reports.conf
sed -i -e "s:PATH_TO_PACKAGES_DIR:${PACKAGES_DIR}:" etc/ocsinventory/ocsinventory-reports.conf
sed -i -e "s:SNMP_ALIAS:${SNMP_ALIAS}:" etc/ocsinventory/ocsinventory-reports.conf
sed -i -e "s:PATH_TO_SNMP_DIR:${SNMP_DIR}:" etc/ocsinventory/ocsinventory-reports.conf
dodoc "etc/ocsinventory/ocsinventory-reports.conf"
# Create dirs
for dir in ${PLUGINS_CONFIG_DIR} ${PLUGINS_PERL_DIR} ; do
dodir "${dir}" || die "Unable to create ${dir}"
done
# create log dir
elog "Creating log dir"
dodir "${LOGDIR}"
dodoc "${FILESDIR}/postinstall-en.txt"
}
pkg_preinst () {
# Fix dir permissions
for dir in ${PLUGINS_CONFIG_DIR} ${PLUGINS_PERL_DIR} ; do
fowners -R root:apache "${dir}"
fperms g+w,o-rwx "${dir}"
done
fowners root:apache "${LOGDIR}"
fperms ug+rwx,o-rwx "${LOGDIR}"
}
pkg_postinst () {
elog "If you want to run ocsng in this system make sure to install a compatible MySQL DB."
}
|