0
|
1 |
#!/usr/bin/ksh93
|
|
2 |
#
|
|
3 |
# CDDL HEADER START
|
|
4 |
#
|
|
5 |
# The contents of this file are subject to the terms of the
|
|
6 |
# Common Development and Distribution License (the "License").
|
|
7 |
# You may not use this file except in compliance with the License.
|
|
8 |
#
|
|
9 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
|
10 |
# or http://www.opensolaris.org/os/licensing.
|
|
11 |
# See the License for the specific language governing permissions
|
|
12 |
# and limitations under the License.
|
|
13 |
#
|
|
14 |
# When distributing Covered Code, include this CDDL HEADER in each
|
|
15 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
|
16 |
# If applicable, add the following below this CDDL HEADER, with the
|
|
17 |
# fields enclosed by brackets "[]" replaced with your own identifying
|
|
18 |
# information: Portions Copyright [yyyy] [name of copyright owner]
|
|
19 |
#
|
|
20 |
# CDDL HEADER END
|
|
21 |
#
|
|
22 |
#
|
14
|
23 |
# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
|
0
|
24 |
#
|
14
|
25 |
#ident "@(#)install-mysql 1.7 10/04/22 SMI"
|
0
|
26 |
|
|
27 |
# stop at the first error
|
|
28 |
set -o errexit
|
|
29 |
|
|
30 |
# use builtin commands (faster)
|
|
31 |
builtin cp
|
|
32 |
builtin rm
|
|
33 |
builtin mv
|
|
34 |
builtin chmod
|
|
35 |
|
|
36 |
source "${SRC}/tools/install.subr"
|
|
37 |
echo "The source directory is MYSQL_DIR=${MYSQL_DIR}"
|
|
38 |
typeset CONFDIR="${ROOT}/etc/mysql/5.0"
|
|
39 |
typeset DATADIR="${ROOT}/var/mysql"
|
|
40 |
typeset TESTDIR="${ROOT}/usr/mysql/5.0/mysql-test"
|
|
41 |
typeset PREFIX="${ROOT}/usr/mysql/5.0"
|
|
42 |
typeset SYSMAN1DIR="${ROOT}/usr/share/man/man1"
|
|
43 |
typeset CWD="$PWD"
|
|
44 |
typeset MYSQLSRCDIR=$CWD/${MYSQL_DIR}
|
|
45 |
typeset MAN1DIR=${PREFIX}/man/man1
|
|
46 |
typeset MAN8DIR=${PREFIX}/man/man8
|
|
47 |
typeset DOCDIR="${CWD}/${MYSQL_DIR}/Docs"
|
14
|
48 |
typeset MANIFESTDIR="${ROOT}/lib/svc/manifest/application/database"
|
0
|
49 |
typeset METHODDIR="${ROOT}/lib/svc/method"
|
|
50 |
typeset MANSCRIPT=sunman-stability
|
|
51 |
|
|
52 |
# ----- Common Utility Functions -----
|
|
53 |
|
|
54 |
function install_dir
|
|
55 |
{
|
|
56 |
# exit function on error
|
|
57 |
set -o errexit
|
|
58 |
|
|
59 |
typeset dstdir="$1"
|
|
60 |
typeset mode="$2"
|
|
61 |
|
|
62 |
mkdir -p "$dstdir"
|
|
63 |
chmod "$mode" "$dstdir"
|
|
64 |
|
|
65 |
return 0
|
|
66 |
}
|
|
67 |
|
|
68 |
# Copy the install files to $CONFDIR
|
|
69 |
|
|
70 |
function fix_install
|
|
71 |
{
|
|
72 |
# exit function on error
|
|
73 |
set -o errexit
|
|
74 |
|
|
75 |
# Ship a default my.cnf to simplify ease of use.
|
|
76 |
cd "${CWD}/${MYSQL_DIR}/support-files"
|
|
77 |
_install N my-small.cnf "${CONFDIR}/my.cnf" 644
|
|
78 |
|
|
79 |
# ship the standard my.cnf files
|
|
80 |
|
|
81 |
_install N my-small.cnf "${CONFDIR}/my-small-cnf.cnf" 644
|
|
82 |
_install N my-huge.cnf "${CONFDIR}/my-huge.cnf" 644
|
|
83 |
_install N my-large.cnf "${CONFDIR}/my-large.cnf" 644
|
|
84 |
_install N my-medium.cnf "${CONFDIR}/my-medium.cnf" 644
|
|
85 |
_install N my-innodb-heavy-4G.cnf "${CONFDIR}/my.innodb-heavy-4G.cnf" 644
|
|
86 |
|
|
87 |
|
|
88 |
# remove the unwanted files that are installed by make install
|
|
89 |
cd "${ROOT}/usr/mysql/5.0/lib/mysql"
|
|
90 |
rm -f *.la libvio.a libheap.a
|
|
91 |
chmod +x *.a
|
|
92 |
rm -f *.a
|
|
93 |
|
|
94 |
# set the correct permission for data directory
|
|
95 |
install_dir "${DATADIR}" 700
|
|
96 |
install_dir "${DATADIR}/5.0" 700
|
|
97 |
install_dir "${DATADIR}/5.0/data" 700
|
|
98 |
|
|
99 |
|
|
100 |
return 0
|
|
101 |
}
|
|
102 |
|
|
103 |
|
|
104 |
# Copy the MySQL SMF files from build area to $MANIFESTDIR
|
|
105 |
|
|
106 |
function install_smf_files
|
|
107 |
{
|
|
108 |
# exit function on error
|
|
109 |
set -o errexit
|
|
110 |
|
|
111 |
cp -f Solaris/mysql.xml "${MANIFESTDIR}"
|
|
112 |
chmod 444 "${MANIFESTDIR}/mysql.xml"
|
|
113 |
|
|
114 |
cp -f Solaris/mysql "${METHODDIR}"
|
|
115 |
chmod 555 "${METHODDIR}/mysql"
|
|
116 |
|
|
117 |
return 0
|
|
118 |
}
|
|
119 |
|
|
120 |
# doc related
|
|
121 |
# Copy the docs to $SYSMAN1DIR and give it appropriate permission
|
|
122 |
function install_docs
|
|
123 |
{
|
|
124 |
set -o errexit
|
|
125 |
|
|
126 |
cd "${CWD}"
|
|
127 |
cp -f Solaris/mysql.1.sunman "${SYSMAN1DIR}/mysql.1"
|
|
128 |
chmod 444 "${SYSMAN1DIR}/mysql.1"
|
|
129 |
|
|
130 |
return 0
|
|
131 |
}
|
|
132 |
|
|
133 |
# add sunman availability info to all the man pages
|
|
134 |
function fix_manpages
|
|
135 |
{
|
|
136 |
|
|
137 |
for file in \
|
|
138 |
comp_err.1 \
|
|
139 |
innochecksum.1 \
|
|
140 |
make_win_bin_dist.1 \
|
|
141 |
make_win_src_distribution.1 \
|
|
142 |
msql2mysql.1 \
|
|
143 |
my_print_defaults.1 \
|
|
144 |
myisam_ftdump.1 \
|
|
145 |
myisamchk.1 \
|
|
146 |
myisamlog.1 \
|
|
147 |
myisampack.1 \
|
|
148 |
mysql-stress-test.pl.1 \
|
|
149 |
mysql-test-run.pl.1 \
|
|
150 |
mysql.1 \
|
|
151 |
mysql.server.1 \
|
|
152 |
mysql_client_test.1 \
|
|
153 |
mysql_config.1 \
|
|
154 |
mysql_convert_table_format.1 \
|
|
155 |
mysql_explain_log.1 \
|
|
156 |
mysql_find_rows.1 \
|
|
157 |
mysql_fix_extensions.1 \
|
|
158 |
mysql_fix_privilege_tables.1 \
|
|
159 |
mysql_install_db.1 \
|
|
160 |
mysql_secure_installation.1 \
|
|
161 |
mysql_setpermission.1 \
|
|
162 |
mysql_tableinfo.1 \
|
|
163 |
mysql_tzinfo_to_sql.1 \
|
|
164 |
mysql_upgrade.1 \
|
|
165 |
mysql_waitpid.1 \
|
|
166 |
mysql_zap.1 \
|
|
167 |
mysqlaccess.1 \
|
|
168 |
mysqladmin.1 \
|
|
169 |
mysqlbinlog.1 \
|
|
170 |
mysqlcheck.1 \
|
|
171 |
mysqld_multi.1 \
|
|
172 |
mysqld_safe.1 \
|
|
173 |
mysqldump.1 \
|
|
174 |
mysqlhotcopy.1 \
|
|
175 |
mysqlimport.1 \
|
|
176 |
mysqlman.1 \
|
|
177 |
mysqlmanager-pwgen.1 \
|
|
178 |
mysqlmanagerc.1 \
|
|
179 |
mysqlshow.1 \
|
|
180 |
mysqltest.1 \
|
|
181 |
ndb_config.1 \
|
|
182 |
ndb_cpcd.1 \
|
|
183 |
ndb_delete_all.1 \
|
|
184 |
ndb_desc.1 \
|
|
185 |
ndb_drop_index.1 \
|
|
186 |
ndb_drop_table.1 \
|
|
187 |
ndb_error_reporter.1 \
|
|
188 |
ndb_mgm.1 \
|
|
189 |
ndb_print_backup_file.1 \
|
|
190 |
ndb_print_schema_file.1 \
|
|
191 |
ndb_print_sys_file.1 \
|
|
192 |
ndb_restore.1 \
|
|
193 |
ndb_select_all.1 \
|
|
194 |
ndb_select_count.1 \
|
|
195 |
ndb_show_tables.1 \
|
|
196 |
ndb_size.pl.1 \
|
|
197 |
ndb_waiter.1 \
|
|
198 |
perror.1 \
|
|
199 |
replace.1 \
|
|
200 |
resolve_stack_dump.1 \
|
|
201 |
resolveip.1 \
|
|
202 |
safe_mysqld.1
|
|
203 |
do
|
|
204 |
_install M ${MYSQLSRCDIR}/man/${file} ${MAN1DIR}/${file} 444
|
|
205 |
done
|
|
206 |
|
|
207 |
|
|
208 |
for file in mysqld.8 mysqlmanager.8 ndb_mgmd.8 ndbd.8 ;do
|
|
209 |
_install M ${MYSQLSRCDIR}/man/${file} ${MAN8DIR}/${file} 444
|
|
210 |
done
|
|
211 |
|
|
212 |
|
|
213 |
return 0 ;
|
|
214 |
}
|
|
215 |
|
|
216 |
|
|
217 |
|
|
218 |
# This function changes the perl path to the standard perl path
|
|
219 |
function fix_perl_path
|
|
220 |
{
|
|
221 |
|
|
222 |
for dirs in "$PREFIX/mysql-test" "$PREFIX/mysql-test/suite/funcs_1/lib" "$PREFIX/sql-bench" "$PREFIX/bin" \
|
|
223 |
"$PREFIX/mysql-test/suite/funcs_2/lib" ;do
|
|
224 |
cd $dirs
|
|
225 |
echo "Changing perl PATH for `pwd`"
|
|
226 |
grep -l '#!/usr/bin/perl' * | awk '{ print $1 }' >> /tmp/file$$.text
|
|
227 |
for file in `cat /tmp/file$$.text` ;do
|
|
228 |
echo "file is $file"
|
|
229 |
if [ $(basename $dirs) = 'lib' ]; then
|
|
230 |
perm=644
|
|
231 |
else
|
|
232 |
perm=755
|
|
233 |
fi
|
|
234 |
_install P $file "$file"_new ${perm}
|
|
235 |
mv "$file"_new $file
|
|
236 |
done
|
|
237 |
rm /tmp/file$$.text
|
|
238 |
done
|
|
239 |
|
|
240 |
return 0 ;
|
|
241 |
|
|
242 |
}
|
|
243 |
# This function changes the internal path names to the standard PATHS
|
|
244 |
|
|
245 |
function fix_ldpath
|
|
246 |
|
|
247 |
{
|
|
248 |
cd "$PREFIX/bin"
|
|
249 |
cp mysql_config mysql_config.new
|
|
250 |
(echo "/^ldflags=/s/..*/"ldflags="'-L\/opt\/SUNWspro\/lib -lCrun -lrt'""/"; echo "w"; echo "q") | ed mysql_config.new
|
|
251 |
mv mysql_config.new mysql_config
|
|
252 |
|
|
253 |
return 0 ;
|
|
254 |
|
|
255 |
}
|
|
256 |
|
|
257 |
#Appropriate permissions for the directories share,bin,docs,include
|
|
258 |
|
|
259 |
function fix_permissions
|
|
260 |
{
|
|
261 |
|
|
262 |
for dirs in "$PREFIX/share/mysql" \
|
|
263 |
"$PREFIX/include/mysql" \
|
|
264 |
"$PREFIX/man/man1" \
|
|
265 |
"$PREFIX/man/man8" \
|
|
266 |
"$PREFIX/docs"
|
|
267 |
do
|
|
268 |
cd "$dirs"
|
|
269 |
find . -type f -exec chmod 444 {} \;
|
|
270 |
echo "Permissions have been fixed for $dirs......"
|
|
271 |
done
|
|
272 |
|
|
273 |
for dirs in "$PREFIX/bin" "$PREFIX/lib/mysql"
|
|
274 |
do
|
|
275 |
cd "$dirs"
|
|
276 |
find . -type f -exec chmod 555 {} \;
|
|
277 |
echo "Permissions have been fixed for $dirs......"
|
|
278 |
|
|
279 |
done
|
|
280 |
|
|
281 |
return 0;
|
|
282 |
}
|
|
283 |
|
9
|
284 |
function install_rbac_files
|
|
285 |
{
|
|
286 |
cd ${CWD}
|
|
287 |
_install N auth_attr ${ROOT}/etc/security/auth_attr.d/mysql-50 444
|
|
288 |
_install N prof_attr ${ROOT}/etc/security/prof_attr.d/mysql-50 444
|
|
289 |
}
|
|
290 |
|
0
|
291 |
|
|
292 |
# ----- START HERE - actual script processing starts here -----
|
|
293 |
|
|
294 |
# Even though this is called "install-mysql", it doesn't really
|
|
295 |
# install the whole thing. Much of mysql itself is installed by
|
|
296 |
# make install - we need to fix only permissions. What we install here
|
|
297 |
# are stuffs that mysql won't install as part of its normal build.
|
|
298 |
# Each install task is a function, so it's relatively easy to add new
|
|
299 |
# stuff.
|
|
300 |
#
|
|
301 |
|
|
302 |
fix_manpages
|
|
303 |
fix_install
|
|
304 |
install_docs
|
|
305 |
install_smf_files
|
9
|
306 |
install_rbac_files
|
0
|
307 |
fix_perl_path
|
|
308 |
fix_ldpath
|
|
309 |
fix_permissions
|
|
310 |
exit 0
|