# Copyright 1999-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 EAPI=5 inherit versionator webapp MY_PN="OCSNG_UNIX_SERVER" MAJ_PV="$(get_version_component_range 1-2)" DESCRIPTION="OCS Inventory Server Admin panel" HOMEPAGE="http://www.ocsinventory-ng.org/" SRC_URI="https://launchpad.net/ocsinventory-server/stable-${MAJ_PV}/${PV}/+download/${MY_PN}-${PV}.tar.gz" RESTRICT="mirror" LICENSE="GPL-2" KEYWORDS="x86 amd64" IUSE="setup +ipdiscover" PHP_REQUIRED_FLAGS="mysqli,xml,zip,gd" RDEPEND="virtual/httpd-php dev-lang/php[${PHP_REQUIRED_FLAGS}] dev-db/mysql ipdiscover? ( dev-perl/Net-IP net-analyzer/nmap net-fs/samba )" S="${WORKDIR}/${MY_PN}-${PV}/ocsreports" src_prepare() { cp -f "${FILESDIR}/dbconfig.inc.php" . } pkg_setup() { webapp_pkg_setup } src_install() { webapp_src_preinst if ! use setup; then rm -f install.php || die "Cannot remove setup utility" elog "The OCS Inventory webadmin setup utility has been removed." elog "It is a regular target of various exploits. If you need it, set USE=setup." else elog "You should consider disabling the setup USE flag" elog "to exclude the setup utility if you don't use it." elog "It regularly is the target of various exploits." fi insinto "${MY_HTDOCSDIR#${EPREFIX}}" doins -r . if use ipdiscover; then doins ../binutils/ipdiscover-util.pl fi webapp_configfile "${MY_HTDOCSDIR#${EPREFIX}}"/dbconfig.inc.php webapp_serverowned "${MY_HTDOCSDIR#${EPREFIX}}"/dbconfig.inc.php webapp_src_install } pkg_postinst() { if use setup; then elog "To configure database connection:" elog "go to http://\${VHOST_HOSTNAME}/\${VHOST_APPDIR}/install.php" elog "and after this:" elog "rm -f \${MY_INSTALLDIR}/install.php" else elog "Please edit file \${MY_INSTALLDIR}/dbconfig.inc.php" elog "To setup database connection set following parameters:" elog "SERVER_READ, SERVER_WRITE - mysql database host" elog "DB_NAME - database name" elog "COMPTE_BASE - login" elog "PSWD_BASE - password" fi }