1
by brian
clean slate |
1 |
#!/bin/sh
|
2 |
# Copyright (C) 1997-2006 MySQL AB
|
|
3 |
#
|
|
4 |
# This program is free software; you can redistribute it and/or modify
|
|
5 |
# it under the terms of the GNU General Public License as published by
|
|
6 |
# the Free Software Foundation; version 2 of the License.
|
|
7 |
#
|
|
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU General Public License
|
|
14 |
# along with this program; if not, write to the Free Software
|
|
15 |
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
16 |
||
17 |
# This scripts creates the privilege tables db, host, user, tables_priv,
|
|
18 |
# columns_priv in the mysql database, as well as the func table.
|
|
19 |
||
20 |
if [ x$1 = x"--bin" ]; then |
|
21 |
shift 1 |
|
22 |
BINARY_DIST=1 |
|
23 |
||
24 |
bindir=../bin |
|
25 |
scriptdir=bin |
|
26 |
libexecdir=../libexec |
|
27 |
||
28 |
# Check if it's a binary distribution or a 'make install'
|
|
29 |
if test -x ../libexec/mysqld |
|
30 |
then
|
|
31 |
execdir=../libexec |
|
32 |
elif test -x ../../sbin/mysqld # RPM installation |
|
33 |
then
|
|
34 |
execdir=../../sbin |
|
35 |
bindir=../../bin |
|
36 |
scriptdir=../bin |
|
37 |
libexecdir=../../libexec |
|
38 |
else
|
|
39 |
execdir=../bin |
|
40 |
fi
|
|
41 |
fix_bin=mysql-test |
|
42 |
else
|
|
43 |
execdir=../sql |
|
44 |
bindir=../client |
|
45 |
fix_bin=. |
|
46 |
scriptdir=scripts |
|
47 |
libexecdir=../libexec |
|
48 |
fi
|
|
49 |
||
50 |
vardir=var |
|
51 |
logdir=$vardir/log |
|
52 |
if [ x$1 = x"-slave" ] |
|
53 |
then
|
|
54 |
shift 1 |
|
55 |
data=var/slave-data |
|
56 |
else
|
|
57 |
if [ x$1 = x"-1" ] |
|
58 |
then
|
|
59 |
data=var/master-data1 |
|
60 |
else
|
|
61 |
data=var/master-data |
|
62 |
fi
|
|
63 |
fi
|
|
64 |
ldata=$fix_bin/$data |
|
65 |
||
66 |
mdata=$data/mysql |
|
67 |
EXTRA_ARG="" |
|
68 |
||
69 |
mysqld= |
|
70 |
if test -x $execdir/mysqld |
|
71 |
then
|
|
72 |
mysqld=$execdir/mysqld |
|
73 |
else
|
|
74 |
if test ! -x $libexecdir/mysqld |
|
75 |
then
|
|
76 |
echo "mysqld is missing - looked in $execdir and in $libexecdir" |
|
77 |
exit 1 |
|
78 |
else
|
|
79 |
mysqld=$libexecdir/mysqld |
|
80 |
fi
|
|
81 |
fi
|
|
82 |
||
83 |
# On IRIX hostname is in /usr/bsd so add this to the path
|
|
84 |
PATH=$PATH:/usr/bsd |
|
85 |
hostname=`hostname` # Install this too in the user table |
|
86 |
hostname="$hostname%" # Fix if not fully qualified hostname |
|
87 |
||
88 |
||
89 |
#create the directories
|
|
90 |
[ -d $vardir ] || mkdir $vardir |
|
91 |
[ -d $logdir ] || mkdir $logdir |
|
92 |
||
93 |
# Create database directories mysql & test
|
|
94 |
if [ -d $data ] ; then rm -rf $data ; fi |
|
95 |
mkdir $data $data/mysql $data/test |
|
96 |
||
97 |
#for error messages
|
|
98 |
if [ x$BINARY_DIST = x1 ] ; then |
|
99 |
basedir=.. |
|
100 |
else
|
|
101 |
basedir=. |
|
102 |
EXTRA_ARG="--windows" |
|
103 |
fi
|
|
104 |
||
105 |
INSTALL_CMD="$scriptdir/mysql_install_db --no-defaults $EXTRA_ARG --basedir=$basedir --datadir=mysql-test/$ldata --srcdir=." |
|
106 |
echo "running $INSTALL_CMD" |
|
107 |
||
108 |
cd ..
|
|
109 |
if $INSTALL_CMD |
|
110 |
then
|
|
111 |
exit 0 |
|
112 |
else
|
|
113 |
echo "Error executing mysqld --bootstrap" |
|
114 |
exit 1 |
|
115 |
fi
|