# Copyright 1999-2004 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.12.ebuild,v 1.0 2005/08/19 18:00: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_12.tgz" KEYWORDS="~x86" LICENSE="GPL-2" SLOT="0" IUSE="" DEPEND="gcc ( >=sys-devel/gcc-3.3.5 ) bison ( sys-devel/bison ) python ( >=dev-lang/python-2.3.5 ) perl ( >=dev-lang/perl-5.8.6 ) doxygen ( >=app-doc/doxygen-1.4.2 ) maxdb-devtools-src ( =maxdb-devtools-src-562049 )" 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_12/MaxDB_ORG/data INSTDATA_FIN=${D}${MAXDBROOT}/data INSTROOT_TMP=${WORKDIR}/V76_00_12/MaxDB_ORG/usr INSTROOT_FIN=${D}${MAXDBROOT}/programs } src_unpack() { unpack ${A} || die # Add the ini file for the Web-Administration EPATCH_OPTS="-p1 -d ${WORKDIR}" \ epatch ${FILESDIR}/maxdb-source-7_6_0_12_ini.patch addwrite /etc/opt } 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_12/MaxDB_ORG # Setup the config file /etc/opt/sdb addwrite /etc/opt/sdb 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/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}" (cd ${INSTROOT_TMP} > /dev/null; tar cf - .) | (cd ${INSTROOT_FIN} >/dev/null; tar xvf -) (cd ${INSTDATA_TMP} > /dev/null; tar cf - .) | (cd ${INSTDATA_FIN} >/dev/null; tar xvf -) (cd ${WORKDIR}/usr/spool/sql/ini > /dev/null; tar cf - .) | (cd ${D}/usr/spool/sql/ini >/dev/null; tar xvf -) } 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 sdb -g sdba ${ROOT}${MAXDBROOT}/data/fifo install -d -m0755 -o root -g root usr/spool/sql/ini/WebAgent76.ini install -d -m0755 -o root -g root usr/spool/sql/pid/serverpids chown -R sdb:sdba ${ROOT}${MAXDBROOT}/programs chown -R sdb:sdba ${ROOT}${MAXDBROOT}/data # changing some permissions to run dbmcli as user sdb 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 if [ ! -d /etc/opt ] then mkdir /etc/opt fi 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.orig 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 "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" }