| 1 |
# Copyright 1999-2012 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/app-office/openerp-server/openerp-server-5.0.6.ebuild,v 1.2 2011/04/06 16:59:15 arfrever Exp $ |
| 4 |
|
| 5 |
EAPI="3" |
| 6 |
PYTHON_DEPEND="2" |
| 7 |
|
| 8 |
inherit distutils user |
| 9 |
|
| 10 |
DESCRIPTION="Open Source ERP & CRM" |
| 11 |
HOMEPAGE="http://www.openerp.com/" |
| 12 |
SRC_URI="http://www.openerp.com/download/stable/source/${P}.tar.gz" |
| 13 |
|
| 14 |
LICENSE="GPL-2" |
| 15 |
SLOT="0" |
| 16 |
KEYWORDS="~amd64 ~x86" |
| 17 |
IUSE="" |
| 18 |
|
| 19 |
CDEPEND="dev-db/postgresql-server |
| 20 |
dev-python/lxml |
| 21 |
dev-python/psycopg |
| 22 |
dev-python/pychart |
| 23 |
dev-python/pytz |
| 24 |
dev-python/pyxml |
| 25 |
dev-python/pyopenssl |
| 26 |
dev-python/reportlab |
| 27 |
media-gfx/pydot" |
| 28 |
|
| 29 |
RDEPEND="${CDEPEND}" |
| 30 |
DEPEND="${CDEPEND}" |
| 31 |
|
| 32 |
OPENERP_USER="openerp" |
| 33 |
OPENERP_GROUP="openerp" |
| 34 |
|
| 35 |
pkg_setup() { |
| 36 |
python_set_active_version 2 |
| 37 |
python_pkg_setup |
| 38 |
} |
| 39 |
|
| 40 |
src_install() { |
| 41 |
distutils_src_install |
| 42 |
|
| 43 |
doinitd "${FILESDIR}/${PN}" |
| 44 |
newconfd "${FILESDIR}/openerp-server-confd" "${PN}" |
| 45 |
keepdir /var/run/openerp |
| 46 |
keepdir /var/log/openerp |
| 47 |
|
| 48 |
rm "${D}/usr/bin/openerp-server" |
| 49 |
} |
| 50 |
|
| 51 |
pkg_preinst() { |
| 52 |
enewgroup ${OPENERP_GROUP} |
| 53 |
enewuser ${OPENERP_USER} -1 -1 -1 ${OPENERP_GROUP} |
| 54 |
|
| 55 |
fowners ${OPENERP_USER}:${OPENERP_GROUP} /var/run/openerp |
| 56 |
fowners ${OPENERP_USER}:${OPENERP_GROUP} /var/log/openerp |
| 57 |
} |
| 58 |
|
| 59 |
pkg_postinst() { |
| 60 |
elog "In order to setup the initial database, run:" |
| 61 |
elog " emerge --config =${CATEGORY}/${PF}" |
| 62 |
elog "Be sure the database is started before" |
| 63 |
} |
| 64 |
|
| 65 |
pquery() { |
| 66 |
psql -q -At -U postgres -d template1 -c "$@" |
| 67 |
} |
| 68 |
|
| 69 |
pkg_config() { |
| 70 |
einfo "In the following, the 'postgres' user will be used." |
| 71 |
if ! pquery "SELECT usename FROM pg_user WHERE usename = '${OPENERP_USER}'" | grep -q ${OPENERP_USER}; then |
| 72 |
ebegin "Creating database user ${OPENERP_USER}" |
| 73 |
createuser --quiet --username=postgres --createdb --no-adduser ${OPENERP_USER} |
| 74 |
eend $? || die "Failed to create database user" |
| 75 |
fi |
| 76 |
} |