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 |
#
|
|
23 |
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
|
24 |
# Use is subject to license terms.
|
|
25 |
#
|
|
26 |
#ident "@(#)install-mysql-64 1.6 09/05/13 SMI"
|
|
27 |
|
|
28 |
# stop at the first error
|
|
29 |
set -o errexit
|
|
30 |
|
|
31 |
# use builtin commands (faster)
|
|
32 |
builtin cp
|
|
33 |
builtin rm
|
|
34 |
builtin mv
|
|
35 |
builtin chmod
|
|
36 |
source "${SRC}/tools/install.subr"
|
|
37 |
typeset PREFIX="${ROOT}/usr/mysql/5.0"
|
|
38 |
typeset CWD="$PWD"
|
|
39 |
|
|
40 |
# ----- Common Utility Functions -----
|
|
41 |
|
|
42 |
function fix_install
|
|
43 |
{
|
|
44 |
# exit function on error
|
|
45 |
set -o errexit
|
|
46 |
|
|
47 |
# remove the unwanted files that are installed by make install
|
|
48 |
cd "${ROOT}/usr/mysql/5.0/lib/64/mysql"
|
|
49 |
rm -f *.la libvio.a libheap.a
|
|
50 |
chmod +x *.a
|
|
51 |
rm -f *.a
|
|
52 |
|
|
53 |
return 0
|
|
54 |
}
|
|
55 |
|
|
56 |
# This function changes the perl path to the standard perl path
|
|
57 |
function fix_perl_path
|
|
58 |
{
|
|
59 |
|
|
60 |
for dirs in "$PREFIX/mysql-test" "$PREFIX/mysql-test/suite/funcs_1/lib" "$PREFIX/sql-bench" \
|
|
61 |
"$PREFIX/bin/64" "$PREFIX/mysql-test/suite/funcs_2/lib" ;do
|
|
62 |
cd $dirs
|
|
63 |
echo "Changing perl PATH for `pwd`"
|
|
64 |
grep -l '#!/usr/bin/perl' * | awk '{ print $1 }' >> /tmp/file$$.text
|
|
65 |
for file in `cat /tmp/file$$.text` ;do
|
|
66 |
echo "file is $file"
|
|
67 |
if [ $(basename $dirs) = 'lib' ]; then
|
|
68 |
perm=644
|
|
69 |
else
|
|
70 |
perm=755
|
|
71 |
fi
|
|
72 |
_install P $file "$file"_new ${perm}
|
|
73 |
mv "$file"_new $file
|
|
74 |
done
|
|
75 |
rm /tmp/file$$.text
|
|
76 |
done
|
|
77 |
|
|
78 |
return 0 ;
|
|
79 |
|
|
80 |
}
|
|
81 |
|
|
82 |
|
|
83 |
#Appropriate permissions for the directories share,bin,docs,include
|
|
84 |
|
|
85 |
function fix_permissions
|
|
86 |
{
|
|
87 |
|
|
88 |
for dirs in "$PREFIX/share/mysql" \
|
|
89 |
"$PREFIX/include/mysql" \
|
|
90 |
"$PREFIX/man/man1" \
|
|
91 |
"$PREFIX/man/man8" \
|
|
92 |
"$PREFIX/docs"
|
|
93 |
do
|
|
94 |
cd "$dirs"
|
|
95 |
find . -type f -exec chmod 444 {} \;
|
|
96 |
echo "Permissions have been fixed for $dirs......"
|
|
97 |
done
|
|
98 |
|
|
99 |
for dirs in "$PREFIX/bin" "$PREFIX/bin/64" "$PREFIX/lib/mysql" "$PREFIX/lib/64/mysql"
|
|
100 |
do
|
|
101 |
cd "$dirs"
|
|
102 |
find . -perm u=rwx,g=rx,o=rx -type f -exec chmod 555 {} \;
|
|
103 |
echo "Permissions have been fixed for $dirs......"
|
|
104 |
|
|
105 |
done
|
|
106 |
|
|
107 |
return 0;
|
|
108 |
}
|
|
109 |
|
|
110 |
|
|
111 |
# ----- START HERE - actual script processing starts here -----
|
|
112 |
|
|
113 |
# Even though this is called "install-mysql-64", it doesn't really
|
|
114 |
# install the whole thing. Much of mysql itself is installed by
|
|
115 |
# make install - we need to fix only permissions. What we install here
|
|
116 |
# are stuffs that mysql won't install as part of its normal build.
|
|
117 |
# Each install task is a function, so it's relatively easy to add new
|
|
118 |
# stuff.
|
|
119 |
#
|
|
120 |
fix_install
|
|
121 |
fix_perl_path
|
|
122 |
fix_permissions
|
|
123 |
exit 0
|