blob: ce6aeb7ffb209d8b47b6bfd14d740f986d82ee56 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
|
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
inherit eutils rpm
IUSE="hardened latin1"
MY_PV="${PV/_p/-}.0"
MY_P="${PN}-univ-${MY_PV}.i386"
DESCRIPTION="Oracle 10g Express Edition for Linux"
HOMEPAGE="http://www.oracle.com/technology/products/database/xe/index.html"
SRC_URI="latin1? ( ${MY_P/-univ/}.rpm )
!latin1? ( ${MY_P}.rpm )"
LICENSE="OTN"
SLOT="0"
KEYWORDS="~x86"
RESTRICT="fetch"
S="${WORKDIR}"
RDEPEND=">=dev-libs/libaio-0.3.96
sys-devel/bc
!dev-db/oracle-instantclient-basic
!dev-db/oracle-instantclient-jdbc
!dev-db/oracle-instantclient-sqlplus"
DEPEND="${RDEPEND}"
ORACLEHOME="/usr/lib/oracle/xe/app/oracle/product/10.2.0/server"
ORACLE_OWNER="oraclexe"
ORACLE_GROUP="dba"
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 " ${MY_P_LATIN1} ... ${MY_P_UNICODE}"
eerror "after downloading it."
}
src_unpack() {
rpm_src_unpack
}
pkg_setup() {
if use hardened; then
ewarn
ewarn "Oracle-xe and hardened do not mix very well, USE AT YOUR OWN RISK!"
ewarn
ebeep
fi
einfo "checking for ${ORACLE_GROUP} group..."
enewgroup ${ORACLE_GROUP}
einfo "checking for ${ORACLE_OWNER} user..."
enewuser ${ORACLE_OWNER} -1 /bin/bash /usr/lib/oracle/xe ${ORACLE_GROUP}
}
src_install() {
mv "${WORKDIR}/usr" "${D}"
exeinto ${ORACLEHOME}/bin
doexe "${FILESDIR}/oracle_configure.sh"
doinitd "${FILESDIR}/oracle-xe"
doenvd "${FILESDIR}/99oracle"
dosed "s:%ORACLE_HOME%:${ORACLEHOME}:g" /etc/env.d/99oracle
dosed "s:%ORACLE_SID%:${ORACLE_SID}:g" /etc/env.d/99oracle
dosed "s:%ORACLE_OWNER%:${ORACLE_OWNER}:g" /etc/env.d/99oracle
# snafu... (remove; sparc binaries on a x86 are pretty useless)
[[ -n "$(file "${D}${ORACLEHOME}/lib/hsdb_ora.so" 2>/dev/null | grep SPARC)" ]] && \
rm -f "${D}${ORACLEHOME}/lib/hsdb_ora.so" 2>/dev/null
# fix NULL DT_RPATH
einfo "Fixing DT_RPATH issues..."
TMPDIR="/ade" scanelf -XrR "${D}${ORACLEHOME}/lib" &>/dev/null
}
pkg_postinst() {
einfo
einfo "The Oracle 10g Express Edition Database has been installed."
einfo
einfo "You have to run"
einfo " ebuild /var/db/pkg/${CATEGORY}/${PF}/${PF}.ebuild config"
einfo "to adjust kernel parameters and"
einfo " ${ORACLEHOME}/bin/oracle_configure.sh"
einfo "to configure oracle-xe before first use!"
einfo
}
pkg_config() {
einfo "Checking kernel parameters..."
einfo
# 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
einfo "kernel.sem="$semmsl $semmns $semopm $semmni""
fi
if [ $shmmax -lt 536870912 ]; then
einfo "kernel.shmmax="536870912""
change=yes
fi
if [ $shmmni -lt 4096 ]; then
einfo "kernel.shmmni="4096""
change=yes
fi
if [ $shmall -lt 2097152 ]; then
einfo "kernel.shmall="2097152""
change=yes
fi
if [ $filemax -lt 65536 ]; then
einfo "fs.file-max="65536""
change=yes
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
einfo "net.ipv4.ip_local_port_range="$ip_local_port_range_lb $ip_local_port_range_ub""
fi
if [ "$change" != "no" ] || [ "$changeport" != "no" ]; then
einfo
einfo "It is recommended to add the above kernel parameters to /etc/sysctl.conf:"
einfo "After setting kernel parameters activate them using '/sbin/sysctl -p'"
else
einfo "Kernel parameters set, configure oracle-xe using"
einfo " ${ORACLEHOME}/bin/oracle_configure.sh"
fi
}
|