# Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils rpm MY_PV="10.2.0.1-1.0" MY_P="${PN}-univ-${MY_PV}.i386" S=${WORKDIR} DESCRIPTION="Oracle 10g Express Edition for Linux" HOMEPAGE="http://www.oracle.com/technology/products/database/xe/index.html" SRC_URI="${MY_P}.rpm" LICENSE="OTN" SLOT="0" KEYWORDS="~x86" RESTRICT="fetch" IUSE="" DEPEND="" RDEPEND=">=dev-libs/libaio-0.3.96 !dev-db/oracle-instantclient-sqlplus" ORACLEHOME="/usr/lib/oracle/xe/app/oracle/product/10.2.0/server" ORACLE_HOME=$ORACLEHOME ORACLE_SID="XE" pkg_nofetch() { eerror "Please go to:" eerror " ${HOMEPAGE}" eerror "and download the Oracle 10g Express Edition package. Put it in:" eerror " ${DISTDIR}" eerror "after downloading it." } src_unpack() { rpm_src_unpack } pkg_preinst() { enewgroup dba enewuser oraclexe -1 /bin/bash /usr/lib/oracle/xe dba } src_install() { mv ${WORKDIR}/usr ${D} # SGA and PGA Voodoo TM=`cat /proc/meminfo | grep '^MemTotal' | awk '{print $2}'` TM=`echo 0.40 \* $TM | bc | sed "s/\..*//"` TMSP=`echo $TM-40960 | bc` sga=`echo 0.75 \* $TMSP \* 1024 | bc | sed "s/\..*//"` pga=`echo 0.25 \* $TMSP \* 1024 | bc | sed "s/\..*//"` if [ $sga -lt 146800640 ]; then sga=146800640 fi if [ $pga -lt 16777216 ]; then pga=16777216 fi # init.ora parameters instantiation dosed "s:%sga_target%:$sga:g" ${ORACLEHOME}/config/scripts/init.ora dosed "s:%pga_aggregate_target%:$pga:g" ${ORACLEHOME}/config/scripts/init.ora dosed "s:%sga_target%:$sga:g" ${ORACLEHOME}/config/scripts/initXETemp.ora dosed "s:%pga_aggregate_target%:$pga:g" ${ORACLEHOME}/config/scripts/initXETemp.ora exeinto ${ORACLEHOME}/bin doexe ${FILESDIR}/oracle_configure.sh doinitd ${FILESDIR}/oracle-xe fperms 6751 ${ORACLEHOME}/bin/oracle chown -R oraclexe:dba ${D}/usr/lib/oracle } pkg_postinst() { einfo einfo "The Oracle 10g Express Edition has been installed." einfo einfo "You have to run" einfo " ebuild /var/db/pkg/${CATEGORY}/${PF}/${PF}.ebuild config" einfo "and" einfo " ${ORACLEHOME}/bin/oracle_configure.sh" einfo "before first use!" einfo } pkg_config() { # Check and Update Kernel parameters semmsl=`cat /proc/sys/kernel/sem | awk '{print $1}'` semmns=`cat /proc/sys/kernel/sem | awk '{print $2}'` semopm=`cat /proc/sys/kernel/sem | awk '{print $3}'` semmni=`cat /proc/sys/kernel/sem | awk '{print $4}'` shmmax=`cat /proc/sys/kernel/shmmax` shmmni=`cat /proc/sys/kernel/shmmni` shmall=`cat /proc/sys/kernel/shmall` filemax=`cat /proc/sys/fs/file-max` ip_local_port_range_lb=`cat /proc/sys/net/ipv4/ip_local_port_range | awk '{print $1}'` ip_local_port_range_ub=`cat /proc/sys/net/ipv4/ip_local_port_range | awk '{print $2}'` change=no if [ $semmsl -lt 250 ]; then semmsl=250 change=yes fi if [ $semmns -lt 32000 ]; then semmns=32000 change=yes fi if [ $semopm -lt 100 ]; then semopm=100 change=yes fi if [ $semmni -lt 128 ]; then semmni=128 change=yes fi if [ "$change" != "no" ]; then echo "###########" >> /etc/sysctl.conf echo "# Oracle XE Recommended Values" >> /etc/sysctl.conf fi if [ "$change" != "no" ]; then /sbin/sysctl -w kernel.sem="$semmsl $semmns $semopm $semmni" >> /etc/sysctl.conf fi if [ $shmmax -lt 536870912 ]; then /sbin/sysctl -w kernel.shmmax="536870912" >> /etc/sysctl.conf fi if [ $shmmni -lt 4096 ]; then /sbin/sysctl -w kernel.shmmni="4096" >> /etc/sysctl.conf fi if [ $shmall -lt 2097152 ]; then /sbin/sysctl -w kernel.shmall="2097152" >> /etc/sysctl.conf fi if [ $filemax -lt 65536 ]; then /sbin/sysctl -w fs.file-max="65536" >> /etc/sysctl.conf fi changeport=no if [ $ip_local_port_range_lb -lt 1024 ]; then changeport=yes ip_local_port_range_lb=1024 fi if [ $ip_local_port_range_ub -gt 65000 ]; then ip_local_port_range_ub=65000 changeport=yes fi if [ "$changeport" != "no" ]; then /sbin/sysctl -w net.ipv4.ip_local_port_range="$ip_local_port_range_lb $ip_local_port_range_ub" >> /etc/sysctl.conf fi if [ "$change" != "no" ]; then echo "########" >> /etc/sysctl.conf /sbin/sysctl -p > /dev/null fi }