ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/mysql-deployment.spec
Revision: 1.11
Committed: Fri Feb 20 21:30:16 2009 UTC (16 years, 2 months ago) by valya
Branch: MAIN
CVS Tags: DAS_20091202, pe20091117a-fromDAS_20090709, pe20091116b-fromDAS_20090709, pe20091116a-fromDAS_20090709, DAS_20091104, DAS_20091016, DAS_20091014, pe20090910-fromDAS_20090709, DAS_20090709, DAS_20090607, DBS-WEB_20090618, DBS-APPS_20090619, DBS-APPS_20090608, DBS-APPS_20090604_1, DAS_20090604, DBS-APPS_20090604, DAS_20090603, DBS-APPS_20090603, DBS-APPS_20090528, ap20090520-osx105, ap20090519-osx105, DBS_APPS_20090518, DAS_20090514_3, DAS_20090514_2, DAS_20090514_1, DAS_20090514, DBS-WEB_20090512, DBS-WEB_20090507, DBS_APPS_20090504, DBS_APPS_20090501, DBS-APPS_20090429_2, DBS-WEB_20090429, DBS-APPS_20090429, DBS-WEB_20090428, DBS-WEB_20090422, DBS-WEB_20090420, DBS-APPS_20090417, DBS-APPS_20090415, DBS-APPS_20090410, DAS_20090408, DBS-APPS_20090406, DAS_20090330, DBS-APPS_20090326, DAS_20090319_1, DAS_20090319, DBS-APPS_20090318, DBS-APPS_20090316, DAS_20090316, DAS_20090313, COUCHDB_20090313, DBS-APPS_20090310, WEBTOOLS-APPS_20090310_1, WEBTOOLS-APPS_20090310, WEBTOOLS-APPS_20090309, DBS-APPS_20090306, DBS-APPS_20090304_1, DBS-APPS_20090304, DBS-APPS_20090303_1, DBS-APPS_20090303, DBS-APPS_20090302, DBS-APPS_20090220_1, DBS-APPS_20090220
Changes since 1.10: +1 -1 lines
Log Message:
Check for DBS mysql process, via port number

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 -w -w -f -u ${LOGNAME} | grep mysqld_safe | grep $MYSQL_PORT | grep -v grep | tail -1 | awk '{print $1}'`
33 if [ ! -z ${pid} ]; then
34 echo "CMS MySQL server is already running ..."
35 else
36 # may use --skip-networking for pure local MySQL
37
38 if [ ! -d $MYSQL_ROOT/mysqldb/mysql ]; then
39 echo "+++ Installing CMS MySQL accounts and DBs ..."
40 $MYSQL_ROOT/bin/mysql_install_db --datadir=$MYSQL_PATH --port=$MYSQL_PORT --socket=$MYSQL_SOCK
41
42 echo "+++ Start up CMS MySQL daemon on port ${MYSQL_PORT} ..."
43 $MYSQL_ROOT/bin/mysqld_safe --datadir=$MYSQL_PATH --port=$MYSQL_PORT \
44 --socket=$MYSQL_SOCK --log-error=$MYSQL_ERR --pid-file=$MYSQL_PID &
45
46 sleep 10
47 # create CMS MySQL root account
48 echo "+++ Creating MySQL default root account ..."
49 echo "+++ Account for localhost"
50 $MYSQL_ROOT/bin/mysqladmin --port=$MYSQL_PORT --socket=$MYSQL_SOCK -u root password "cms"
51 echo "+++ Account for `hostname`"
52 $MYSQL_ROOT/bin/mysqladmin --port=$MYSQL_PORT --socket=$MYSQL_SOCK -u root -h `hostname` password "cms"
53
54 # create CMS MySQL DBS account
55 echo "+++ Creating MySQL default dbs account ..."
56 $MYSQL_ROOT/bin/mysql --socket=$MYSQL_SOCK -uroot -pcms mysql -e "CREATE USER dbs@localhost IDENTIFIED BY 'cmsdbs';"
57 $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';"
58 else
59 echo "+++ Start up CMS MySQL daemon on port ${MYSQL_PORT} ..."
60 $MYSQL_ROOT/bin/mysqld_safe --datadir=$MYSQL_PATH --port=$MYSQL_PORT \
61 --socket=$MYSQL_SOCK --log-error=$MYSQL_ERR --pid-file=$MYSQL_PID &
62 sleep 10
63 fi
64 fi
65
66 EOF
67 chmod a+x %{i}/bin/mysql-deployment.sh
68
69 %build
70
71 %install
72 #cp /tmp/mysql-deployment.sh %{i}/bin
73 #cp %{i}/mysql-deployment.sh $RPM_SOURCE_DIR
74
75 %post
76 %{relocateConfig}/bin/mysql-deployment.sh
77