commit:     46d2d482f838c9cdc94e82b97c7c5291e4257515
Author:     Jorge Manuel B. S. Vicetto (jmbsvicetto) <jmbsvicetto <AT> gentoo 
<DOT> org>
AuthorDate: Tue Nov 25 21:15:02 2014 +0000
Commit:     Jorge Manuel B. S. Vicetto <jmbsvicetto <AT> gentoo <DOT> org>
CommitDate: Tue Nov 25 21:15:02 2014 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=dev/jmbsvicetto.git;a=commit;h=46d2d482

Bump EAPI. Finally follow upstream and stop installing to /usr/share/webapps - 
so stop using webapp.
Fix file / dir permissions.

Signed-off-by: Jorge Manuel B. S. Vicetto (jmbsvicetto) <jmbsvicetto <AT> 
gentoo.org>

---
 net-analyzer/ocsng/files/ocsng        |  19 ++++
 net-analyzer/ocsng/ocsng-2.1.2.ebuild | 172 ++++++++++++++++------------------
 2 files changed, 101 insertions(+), 90 deletions(-)

diff --git a/net-analyzer/ocsng/files/ocsng b/net-analyzer/ocsng/files/ocsng
new file mode 100644
index 0000000..f3e11c2
--- /dev/null
+++ b/net-analyzer/ocsng/files/ocsng
@@ -0,0 +1,19 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+#
+# OCSNG logrotate config for Gentoo Linux
+# Contributed by Jorge Manuel B. S. Vicetto (jmbsvicetto) 
[email protected]
+# Based on the original ocsng logrotate file by Didier LIROULET
+
+/var/log/ocsng/*.log {
+       daily
+       # rotate 7
+       commpress
+       create 0660 root apache
+       notifyempty
+       missingok
+       # postrotate
+       /etc/init.d/apache2 reload > /dev/null 2>&1 || true
+       # endscript
+}

diff --git a/net-analyzer/ocsng/ocsng-2.1.2.ebuild 
b/net-analyzer/ocsng/ocsng-2.1.2.ebuild
index bfe06c7..611d7a3 100644
--- a/net-analyzer/ocsng/ocsng-2.1.2.ebuild
+++ b/net-analyzer/ocsng/ocsng-2.1.2.ebuild
@@ -2,16 +2,14 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Header: $
 
-EAPI="4"
+EAPI="5"
 
-inherit depend.php eutils versionator webapp
+inherit depend.php eutils versionator
 
 MY_PV_MAJOR="$(get_version_component_range 1-2 ${PV})"
 MY_PV="${PV//[_]/}"
 MY_P="OCSNG_UNIX_SERVER-${MY_PV}"
 MY_LPN="ocsinventory-server"
-MY_HTDOCSDIR="/usr/share/webapps/${PN}/"
-WEBAPP_MANUAL_SLOT="yes"
 
 DESCRIPTION="OCS Inventory NG Management Server"
 HOMEPAGE="http://ocsinventory.sourceforge.net/";
@@ -21,12 +19,9 @@ LICENSE="GPL-2 LGPL-2"
 KEYWORDS="~amd64"
 IUSE="+comm admin logrotate soap"
 
-# INSTALL_DIR is used by webapp.eclass when USE=-vhosts
-INSTALL_DIR="ocsng"
 S="${WORKDIR}/${MY_P}"
 
 DEPEND="
-       app-admin/webapp-config
        dev-lang/perl
        comm? ( sys-devel/make )
 "
@@ -39,21 +34,14 @@ RDEPEND="${DEPEND}
        virtual/perl-Compress-Raw-Zlib
        www-apache/mod_perl
        >=www-servers/apache-1.3
-       admin? ( dev-lang/php[mysqlnd,xml] )
+       admin? ( dev-lang/php[mysqli,xml] )
        logrotate? ( app-admin/logrotate )
        soap? (
                dev-perl/SOAP-Lite
        )
 "
-#              dev-perl/XML-Entities
 REQUIRED_USE="|| ( admin comm )"
 
-pkg_setup() {
-
-       # call default eclass pkg_setup
-       webapp_pkg_setup
-}
-
 src_compile() {
 
        if ( use comm ); then
@@ -68,17 +56,21 @@ src_compile() {
 src_install() {
 
        LOGDIR="/var/log/ocsng"
-       IPDDIR="ipd"
-       SNMPDIR="snmp"
-       PACKAGESDIR="download"
-       PLUGINS_CONFIG_DIR=""
-       PLUGINS_PERL_DIR=""
-
-       # call default eclass src_preinst
-       webapp_src_preinst
 
-       fowners root:apache "${MY_HTDOCSDIR}"
-       fperms g-w,o-rwx "${MY_HTDOCSDIR}"
+       # Communication server
+       PLUGINS_CONFIG_DIR="/usr/share/ocsng/config"
+       PLUGINS_PERL_DIR="/usr/share/ocsng/plugins"
+
+       # Administration server
+       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"
 
        if ( use comm ); then
 
@@ -88,103 +80,103 @@ src_install() {
 
                if use logrotate; then
 
-                       # create logrotate config file
-                       elog "Create logrotate config file"
-
-                       dodir /etc/logrotate.d
-                       cat <<- EOF > "${D}etc/logrotate.d/ocsng"
-                               # Copyright 1999-2014 Gentoo Foundation
-                               # Distributed under the terms of the GNU 
General Public License v2
-                               # $Header: $
-                               #
-                               # OCSNG logrotate config for Gentoo Linux
-                               # Contributed by Jorge Manuel B. S. Vicetto 
(jmbsvicetto) [email protected]
-                               # Based on the original ocsng logrotate file by 
Didier LIROULET
-
-                               /var/log/ocsng/*.log {
-                               daily
-                               # rotate 7
-                               compress
-                               create 0660 root apache
-                               notifyempty
-                               missingok
-                               # postrotate
-                               # /etc/init.d/apache2 reload > /dev/null 2>&1 
|| true
-                               # endscript
-                               }
-                       EOF
+                       insinto "/etc/logrotate.d"
+                       doins "${FILESDIR}/ocsng"
                fi
 
+               # 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
 
-               # install the communication
-               webapp_server_configfile apache 
"etc/ocsinventory/ocsinventory-server.conf"
+               dodoc "etc/ocsinventory/ocsinventory-server.conf"
+
+               # Create dirs
+               for dir in ${PLUGINS_CONFIG_DIR} ${PLUGINS_PERL_DIR} ; do
+                       dodir "${dir}" || die "Unable to create ${dir}"
+               done
 
        fi
 
-       if use admin; then
+       if ( use admin ); then
 
-               # Create dirs
-               elog "Creating 
${MY_HTDOCSDIR}/{${PACKAGESDIR},${IPDDIR},${SNMPDIR}} dirs"
-               for dir in ${PACKAGESDIR} ${IPDDIR} ${SNMPDIR} ; do
-                       dodir "${MY_HTDOCSDIR}/${dir}" || die "Unable to create 
${MY_HTDOCSDIR}/${dir}"
-                       webapp_serverowned -R "${MY_HTDOCSDIR}/${dir}"
-                       fowners -R apache:apache "${MY_HTDOCSDIR}/${dir}"
-                       fperms g+w,o-rwx "${MY_HTDOCSDIR}/${dir}"
-               done
+               # Create ocsreports dirs
+               elog "Creating ${D}/${ADM_STATIC_DIR} dir"
+               dodir "${ADM_STATIC_DIR}" || die "Unable to create 
${ADM_STATIC_DIR}"
 
                # copy ocsreports
-               insinto "${MY_HTDOCSDIR}"
-               doins -r ocsreports
+               insinto "${ADM_STATIC_DIR}"
+               doins -r ocsreports/*
 
-               # Protect the db config file and ocsreports
-               webapp_configfile "${MY_HTDOCSDIR}/ocsreports/dbconfig.inc.php"
-               webapp_serverowned -R "${MY_HTDOCSDIR}/ocsreports"
-               fowners -R root:apache "${MY_HTDOCSDIR}/ocsreports"
-               fperms -R g-w,o-rwx "${MY_HTDOCSDIR}/ocsreports"
-               if [[ -f "${MY_HTDOCSDIR}/ocsreports/dbconfig.inc.php" ]] ; then
-                       fperms g-w,o-rwx 
"${MY_HTDOCSDIR}/ocsreports/dbconfig.inc.php"
-               fi
+               # Create dirs (/var)
+               elog "Creating 
${ADM_VAR_DIR}/{${IPD_DIR},${PACKAGES_DIR},${SNMP_DIR}} dirs"
+               for dir in ${IPD_DIR} ${PACKAGES_DIR} ${SNMP_DIR} ; do
+                       dodir "${ADM_VAR_DIR}/${dir}" || die "Unable to create 
${ADM_VAR_DIR}/${dir}"
+               done
 
                # install ipdiscover-util.pl script
                elog "Install ipdiscover-util.pl script"
-               insinto "${MY_HTDOCSDIR}/ocsreports"
+               insinto "${ADM_STATIC_DIR}"
                doins binutils/ipdiscover-util.pl
 
-               fowners root:apache  
"${MY_HTDOCSDIR}/ocsreports/ipdiscover-util.pl"
-               fperms ug+x,o-rwx 
"${MY_HTDOCSDIR}/ocsreports/ipdiscover-util.pl"
+               # Configure OCS (Administration server)
+               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
 
-               # install snmp_com.txt
-               elog "Install snmp_com.txt"
-               insinto "${MY_HTDOCSDIR}/snmp"
-               doins etc/ocsinventory/snmp_com.txt
+               dodoc "etc/ocsinventory/ocsinventory-reports.conf"
 
-               fowners root:apache  "${MY_HTDOCSDIR}/snmp/snmp_com.txt"
-               fperms g+w,o-rwx "${MY_HTDOCSDIR}/snmp/snmp_com.txt"
-
-               webapp_server_configfile apache 
"etc/ocsinventory/ocsinventory-reports.conf"
        fi
 
        # create log dir
        elog "Creating log dir"
        dodir "${LOGDIR}"
-       fowners root:apache "${LOGDIR}"
-       fperms 770 "${LOGDIR}"
 
-       webapp_postinst_txt en "${FILESDIR}/postinstall-en.txt"
+       dodoc "${FILESDIR}/postinstall-en.txt"
+}
+
+pkg_preinst () {
 
-       # call default eclass src_install
-       webapp_src_install
+       # Fix dir permissions
+       if ( use comm ); then
+               for dir in ${PLUGINS_CONFIG_DIR} ${PLUGINS_PERL_DIR} ; do
+                       fowners -R root:apache "${dir}"
+                       fperms g+w,o-rwx "${dir}"
+               done
+       fi
+
+       if ( use admin ); then
+
+               # Protect the db config file and ocsreports
+               fowners -R root:apache "${ADM_STATIC_DIR}"
+               fperms -R g-w,o-rwx "${ADM_STATIC_DIR}"
+
+               if [[ -f "${ADM_STATIC_DIR}/dbconfig.inc.php" ]] ; then
+                       fperms g+w,o-rwx "${ADM_STATIC_DIR}/dbconfig.inc.php"
+               fi
+
+               for dir in ${IPD_DIR} ${PACKAGES_DIR} ${SNMP_DIR} ; do
+                       fowners -R apache:apache "${ADM_VAR_DIR}/${dir}"
+                       fperms g-w,o-rwx "${ADM_VAR_DIR}/${dir}"
+               done
+
+               fowners root:apache  "${ADM_STATIC_DIR}/ipdiscover-util.pl"
+               fperms ug+x,o-rwx "${ADM_STATIC_DIR}/ipdiscover-util.pl"
+       fi
+
+       fowners root:apache "${LOGDIR}"
+       fperms ug+rwx,o-rwx "${LOGDIR}"
 }
 
 pkg_postinst () {
 
-       elog "If you want to run ocsng in this box make sure to install"
+       elog "If you want to run ocsng in this system make sure to install"
        elog "at least mysql-4.1."
-
-       webapp_pkg_postinst
 }

Reply via email to