ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/mysql-deployment.spec
Revision: 1.8
Committed: Thu May 1 18:16:16 2008 UTC (17 years ago) by valya
Branch: MAIN
CVS Tags: SiteDB_300508_1, SiteDB_280508_1, WEBTOOLS-APPS_20080527_2, WEBTOOLS-APPS_20080527, WEBTOOLS-APPS_20080523, WEBTOOLS-APPS_20080522, WEBTOOLS-APPS_20080521, WEBTOOLS-APPS_20080520, WEBTOOLS-APPS_20080519, WEBTOOLS-APPS_20080511, zx20080509, pe20080508-testcvs, WEBTOOLS-APPS_20080507_1, WEBTOOLS-APPS_20080507, WEBTOOLS-APPS_20080506, WEBTOOLS-APPS_20080501
Changes since 1.7: +6 -7 lines
Log Message:
Still fighting how to build on a fly a new package and make PKGTOOLS happy

File Contents

# Content
1 ### RPM external mysql-deployment 0.0.3
2
3 Source: mysql-deployment.sh
4 Requires: mysql
5 # Let's fake the fact that we have perl (DBI) so that rpm does not complain.
6 Provides: mysql-deployment.sh
7
8 %prep
9 mkdir -p %{i}/bin
10 cat << \EOF > %{i}/bin/mysql-deployment.sh
11 #!/bin/bash
12 set -e
13
14 if [ -z ${VO_CMS_SW_DIR} ]; then
15 echo "+++ Your CMS environment is not setup, missing VO_CMS_SW_DIR environment"
16 exit 1
17 fi
18 if [ -z ${MYSQL_ROOT} ]; then
19 echo "+++ Your CMS MYSQL environment is not setup, MYSQL_ROOT environment"
20 exit 1
21 fi
22 MYSQL_PATH=$MYSQL_ROOT/mysqldb
23 if [ ! -d ${MYSQL_PATH} ]; then
24 echo "+++ Making ${MYSQL_PATH} directory ..."
25 mkdir -p ${MYSQL_PATH}
26 fi
27 MYSQL_PORT=3316
28 MYSQL_SOCK=$MYSQL_PATH/mysql.sock
29 MYSQL_PID=$MYSQL_PATH/mysqld.pid
30 MYSQL_ERR=$MYSQL_PATH/error.log
31
32 pid=`ps -u ${LOGNAME} | grep mysqld_safe | grep -v grep | tail -1 | awk '{print $1}'`
33 if [ ! -z ${pid} ]; then
34 echo "CMS MySQL server is already running ..."
35 else
36 echo "+++ Installing CMS MySQL accounts and DBs ..."
37 $MYSQL_ROOT/bin/mysql_install_db --datadir=$MYSQL_PATH --port=$MYSQL_PORT --socket=$MYSQL_SOCK
38
39 echo "+++ Start up CMS MySQL daemon on port ${MYSQL_PORT} ..."
40 $MYSQL_ROOT/bin/mysqld_safe --datadir=$MYSQL_PATH --port=$MYSQL_PORT \
41 --socket=$MYSQL_SOCK --log-error=$MYSQL_ERR --pid-file=$MYSQL_PID &
42 #--socket=$MYSQL_SOCK --log-error=$MYSQL_ERR --skip-networking --pid-file=$MYSQL_PID &
43 sleep 10
44
45 # create CMS MySQL root account
46 echo "+++ Creating MySQL default root account ..."
47 echo "+++ Account for localhost"
48 $MYSQL_ROOT/bin/mysqladmin --port=$MYSQL_PORT --socket=$MYSQL_SOCK -u root password "cms"
49 echo "+++ Account for `hostname`"
50 $MYSQL_ROOT/bin/mysqladmin --port=$MYSQL_PORT --socket=$MYSQL_SOCK -u root -h `hostname` password "cms"
51
52 # create CMS MySQL DBS account
53 echo "+++ Creating MySQL default dbs account ..."
54 $MYSQL_ROOT/bin/mysql --socket=$MYSQL_SOCK -uroot -pcms mysql -e "CREATE USER dbs@localhost IDENTIFIED BY 'cmsdbs'"
55 $MYSQL_ROOT/bin/mysql --socket=$MYSQL_SOCK -uroot -pcms mysql -e "UPDATE user set Select_priv='Y',Insert_priv='Y',Update_priv='Y',Delete_priv='Y',Create_priv='Y',Drop_priv='Y',References_priv='Y',Index_priv='Y',Alter_priv='Y',Create_tmp_table_priv='Y',Lock_tables_priv='Y',Execute_priv='Y',Create_view_priv='Y',Show_view_priv='Y',Create_routine_priv='Y',Alter_routine_priv='Y' where User='dbs';"
56 fi
57
58 EOF
59 chmod a+x %{i}/bin/mysql-deployment.sh
60
61 %build
62
63 %install
64 #cp /tmp/mysql-deployment.sh %{i}/bin
65 #cp %{i}/mysql-deployment.sh $RPM_SOURCE_DIR
66
67 %post
68 %{relocateConfig}/bin/mysql-deployment.sh
69