# Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils distutils DESCRIPTION="Tiny ERP is a company ERP and CRM solution" HOMEPAGE="http://tinyerp.org/" SRC_URI="http://tinyerp.org/download/sources/${P}.tar.gz" LICENSE="GPL-2" SLOT="0" KEYWORDS="~x86" IUSE="" DEPEND=">=dev-db/postgresql-7.4 dev-python/pypgsql dev-python/reportlab dev-python/pyparsing dev-python/pydot dev-python/psycopg dev-libs/libxml2 dev-libs/libxslt" src_unpack() { unpack "${A}" epatch ${FILESDIR}/netsvc-${PV}.patch epatch ${FILESDIR}/setup-${PV}.patch } src_install() { distutils_src_install exeinto /etc/init.d newexe ${FILESDIR}/${P}.initd ${PN} insinto /etc/conf.d newins ${FILESDIR}/${P}.confd ${PN} dodir /var/run/tinyerp fperms 0755 /var/run/tinyerp } pkg_postinst() { einfo "" einfo "You should now setup the database if this is a new install." einfo "Run the command" einfo " ebuild /var/db/pkg/app-office/${PF}/${P}.ebuild config" einfo "to do this automatically with language set to english." einfo "" } pquery() { psql -q -At -U postgres -d template1 -c "$@" } pkg_config() { einfo "In the following, the 'postgres' user will be used." if ! pquery "SELECT usename FROM pg_user WHERE usename = 'terp'" | grep -q terp; then ebegin Creating database user terp createuser --quiet --username=postgres --no-createdb --no-adduser terp eend $? || die Failed to create database user fi if ! pquery "SELECT datname FROM pg_database WHERE datname = 'terp'" | grep -q terp; then ebegin Creating database terp createdb --quiet --username=postgres --owner=terp --encoding=UNICODE terp eend $? || die Failed to create database fi if ! getent passwd terp >/dev/null; then enewuser terp fi chown terp:nobody /var/run/tinyerp einfo The first time tinyerp-server is run it will initialize the database. }