# Copyright 1999-2005 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/dev-db/maxdb-src/maxdb-src-7.6.0.16.ebuild,v 1.0 2006/01/01 21:45:00 hmun Exp $ inherit eutils DESCRIPTION="MaxDB - a enterpise grade, database server. This ebuild will compile maxdb from sources. It will take some time !" HOMEPAGE="http://www.mysql.com/products/maxdb" SRC_URI="mirror://mysql/Downloads/MaxDB/7.6.00/maxdb-source-7_6_00_16.tgz" KEYWORDS="~x86" LICENSE="GPL-2" SLOT="0" IUSE="" DEPEND="gcc ( >=sys-devel/gcc-3.4.4 ) bison ( sys-devel/bison ) python ( >=dev-lang/python-2.4.2 ) perl ( >=dev-lang/perl-5.8.6 ) doxygen ( >=app-doc/doxygen-1.4.4 ) maxdb-devtools-src ( =maxdb-devtools-src-562049-r1 )" warning() { ewarn ewarn "!!! No update process supported (yet)" ewarn "!!! BE SURE THAT YOUR DATA FROM PREVIOUS" ewarn "!!! INSTALLATIONS HAS BEEN SAVED" einfo einfo "You can specify the root directory for the installation" einfo "by setting the environment variable MAXDBROOT" einfo "(without the leading / please. i.e. opt/sdb" einfo einfo "MaxDB will be installed to:" einfo ${MAXDBROOT} einfo einfo "You can specify the directory where the needed DevTools are" einfo "by setting the environment variable DEVTOOLS" einfo einfo "DevTools should be in:" einfo ${DEVTOOLS} einfo einfo "Be shure that you did run ${DEVTOOLS}/bin/prepare_inst.pl as root" einfo "to create the global SAP DB registry," einfo "(or export NOREG=1 to build without registration)" einfo einfo "Workdir is:" einfo ${WORKDIR} einfo D is: einfo ${D} einfo ROOT is: einfo ${ROOT} einfo DISTDIR is: einfo ${DISTDIR} sleep 10 } pkg_setup() { sleep 10 if [ -z "${MAXDBROOT}" ]; then MAXDBROOT=opt/sdb fi if [ -z "${DEVTOOLS}" ]; then DEVTOOLS=${ROOT}${MAXDBROOT}/devtools fi warning INSTDATA_TMP=${WORKDIR}/V76_00_16/MaxDB_ORG/data INSTDATA_FIN=${D}${MAXDBROOT}/data INSTROOT_TMP=${WORKDIR}/V76_00_16/MaxDB_ORG/usr INSTROOT_FIN=${D}${MAXDBROOT}/programs } src_unpack() { unpack ${A} || die addwrite /etc/opt addwrite /usr/spool/sql/ini # Add the ini file for the Web-Administration if [ -f /usr/spool/sql/ini/WebAgent76.ini ] then mv -f /usr/spool/sql/ini/WebAgent76.ini /usr/spool/sql/ini/WebAgent76.ini.bak fi EPATCH_OPTS="-p0 -d ${WORKDIR}" \ epatch ${FILESDIR}/maxdb-source-7_6_0_16_ini.patch # Patch the sources EPATCH_OPTS="-p0 -d ${WORKDIR}" \ epatch ${FILESDIR}/maxdb-source-7_6_0_16-r1_all.patch } src_compile() { # create the sandbox directories mkdir ${INSTDATA_TMP} mkdir ${INSTDATA_TMP}/wrk mkdir ${INSTDATA_TMP}/fifo # we need write permission in the DevTools addwrite ${DEVTOOLS} cd ${WORKDIR} python ${DEVTOOLS}/bin/newMaxdbSrc.py V76_00_16/MaxDB_ORG # Setup the config file /etc/opt/sdb if [ ! -d /etc/opt ] then addwrite /etc/opt mkdir /etc/opt fi addwrite /etc/opt/sdb if [ -f /etc/opt/sdb ] then mv -f /etc/opt/sdb /etc/opt/sdb.bak fi echo [Globals] > /etc/opt/sdb echo IndepData=${INSTDATA_TMP} >> /etc/opt/sdb echo IndepPrograms=${INSTROOT} >> /etc/opt/sdb echo SdbOwner=sdb >> /etc/opt/sdb echo SdbGroup=sdba >> /etc/opt/sdb # Build the targets (you have to build target all) einfo "Building target: all" . devmaxdb imf all || die } src_install() { # create the directories and copy the files dodir ${MAXDBROOT}/programs dodir ${MAXDBROOT}/data dodir ${MAXDBROOT}/data/wrk dodir ${MAXDBROOT}/data/fifo dodir /usr/spool/sql/ini dodir /usr/spool/sql/pid dodir /usr/spool/sql/pid/serverpids einfo "INSTROOT_TMP: ${INSTROOT_TMP}" einfo "INSTROOT_FIN: ${INSTROOT_FIN}" einfo "INSTDATA_TMP: ${INSTDATA_TMP}" einfo "INSTDATA_FIN: ${INSTDATA_FIN}" einfo "copy files from: ${INSTROOT_TMP} to: ${INSTROOT_FIN}" (cd ${INSTROOT_TMP} > /dev/null; tar cf - .) | (cd ${INSTROOT_FIN} >/dev/null; tar xf -) einfo "copy files from: ${INSTDATA_TMP} to: ${INSTDATA_FIN}" (cd ${INSTDATA_TMP} > /dev/null; tar cf - .) | (cd ${INSTDATA_FIN} >/dev/null; tar xf -) } pkg_preinst() { if ! groupmod sdba; then groupadd sdba || die "problem adding group sdba" fi if ! id sdb; then useradd -g sdba -s /dev/null -d /opt/maxdb -c "sdb" sdb assert "problem adding user sdb" fi } pkg_postinst() { install -d -m0755 -o sdb -g sdba ${ROOT}${MAXDBROOT}/programs install -d -m0755 -o sdb -g sdba ${ROOT}${MAXDBROOT}/data install -d -m0755 -o root -g root usr/spool/sql/pid/serverpids # create the fifo directory if [ ! -d ${ROOT}${MAXDBROOT}/data/fifo ] then addwrite ${ROOT}${MAXDBROOT}/data mkdir ${ROOT}${MAXDBROOT}/data/fifo fi # create the fifo directory if [ ! -d ${ROOT}${MAXDBROOT}/data/wrk ] then addwrite ${ROOT}${MAXDBROOT}/data mkdir ${ROOT}${MAXDBROOT}/data/wrk fi # changing some permissions to run dbmcli as user sdb chown -R sdb:sdba ${ROOT}${MAXDBROOT}/programs chown -R sdb:sdba ${ROOT}${MAXDBROOT}/data chmod 555 ${ROOT}${MAXDBROOT}/programs/pgm/dbmsrv chmod 4510 ${ROOT}${MAXDBROOT}/programs/pgm/starter/sdbstarter chown root:sdba ${ROOT}${MAXDBROOT}/programs/pgm/starter/sdbstarter # Change the config file /etc/opt/sdb to the real values echo [Globals] > /etc/opt/sdb echo IndepData=${ROOT}${MAXDBROOT}/data >> /etc/opt/sdb echo IndepPrograms=${ROOT}${MAXDBROOT}/programs >> /etc/opt/sdb echo SdbOwner=sdb >> /etc/opt/sdb echo SdbGroup=sdba >> /etc/opt/sdb # Register the installation if [ -f ${ROOT}${MAXDBROOT}/data/Installations.ini ] then mv ${ROOT}${MAXDBROOT}/data/Installations.ini ${ROOT}${MAXDBROOT}/data/Installations.ini.bak fi if [ -f ${ROOT}${MAXDBROOT}/programs/bin/dbmcli ] then ${ROOT}${MAXDBROOT}/programs/bin/dbmcli -R ${ROOT}${MAXDBROOT}/programs inst_reg -k ${ROOT}${MAXDBROOT}/programs fi #your friendly public service announcement... einfo "MaxDb has been installed to" einfo ${MAXDBROOT} einfo ewarn "Check the file ${ROOT}${MAXDBROOT}/data/config/Installations.ini if your" ewarn "Installation to ${ROOT}${MAXDBROOT}/programs has been registered !" ewarn ewarn "If not you may want to run:" ewarn "${ROOT}${MAXDBROOT}/dbmcli -R ${ROOT}${MAXDBROOT}/programs inst_reg -k ${ROOT}${MAXDBROOT}/programs" ewarn "now to register the installation!" ewarn ewarn "And you should add ${MAXDBROOT}/programs/bin to your PATH" }