ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/mysql-deployment.spec
Revision: 1.10
Committed: Fri Jun 27 19:32:28 2008 UTC (16 years, 10 months ago) by valya
Branch: MAIN
CVS Tags: MotT0_1_0_2, MotT0_1_0_1, MotT0_1_0_0, MotT0_100531_1, MotT0_100528_1, T0Mon_100518_1, T0Mon_100503_1, T0Mon_100316_1, T0Mon_100308_2, T0Mon_100308_1, T0Mon_100216_1, T0Mon_100210_1, T0Mon_100204_4, T0Mon_100204_3, T0Mon_100204_1, T0Mon_100127_1, T0Mon_091111_1, T0Mon_090828_1, T0Mon_090822_1, T0Mon_090715_1, T0Mon_090612_1, T0Mon_090611_1, T0Mon_090610_1, T0Mon_090601_1, T0Mon_090527_2, T0Mon_090527_1, condcore306, T0Mon_090522_1, T0Mon_090519_2, T0Mon_090519_1, T0Mon_090517_1, T0Mon_090516_1, T0Mon_090515_4, T0Mon_090515_3, T0Mon_090515_2, T0Mon_090515_1, T0Mon_090510_1, T0Mon_090406_1, T0Mon_090326_1, T0Mon_090325_1, T0Mon_090318_1, T0Mon_090315_1, T0Mon_090303_1, T0M_0_0_5, MEMCACHED_20090219_1, MEMCACHED_20090219, WEBTOOLS-APPS_20090217_1, WEBTOOLS-APPS_20090217, WEBTOOLS-APPS_20090216, condcore305, WEBTOOLS-APPS_20090212, WEBTOOLS-APPS_20090209_64bit, zx20090209, WEBTOOLS-APPS_20090206, T0M_0_0_4, T0M_0_0_3, WEBTOOLS-APPS_20090203_1, WEBTOOLS-APPS_20090203, T0M_0_0_2, zx20090201, WEBTOOLS-APPS_20090130, WEBTOOLS-APPS_20090129, PRODAGENT_0_12_10_pre3, PRODAGENT_0_12_10_pre2_20090127_V2, PRODAGENT_0_12_10_20090122, PRODAGENT_0_12_10_pre1_MISC, sw_20090115a, sw_20090115, zx20090115, WEBTOOLS-APPS_20090113, DBS-APPS_20090109, DBS-APPS_20090108, WEBTOOLS-APPS_20090108, DBS-APPS_20090106, DBS-APPS_20090105, FMWS_20090103, FMWS_20081224_1, FMWS_20081224, FMWS_20081222_3, FMWS_20081222_2, FMWS_20081222, DBS-APPS_20081218, FMWS_20081212_1, FMWS_20081212, FMWS_20081211, DBS-APPS_20081211, DBS-APPS_20081210, DBS-APPS_20081209, WEBTOOLS-APPS_20081208, DBS-APPS_20081205, DBS-APPS_20081204, DBS-APPS_200811204, DBS-APPS_20081126_1, DBS-APPS_20081126, DBS-APPS_20081125, testofc, DBS-APPS_20081119, DBS-APPS_20081118, DBS-APPS_20081117, DBS-APPS_20081114_1, DBS-APPS_20081114, DBS-APPS_20081112, DBS-APPS_20081111_1, DBS-APPS_20081110_2, DBS-APPS_20081110_1, WEBTOOLS-APPS_20081110, DBS-APPS_20081110, WEBTOOLS-APPS_20081107_1, WEBTOOLS-APPS_20081107, DBS-APPS_20081107, T0Mon_081107_1, DBS-APPS_20081105, T0Mon_081105_1, DBS-APPS_20081104, WEBTOOLS-APPS_20081031_2, DBS-APPS_20081031_2, DBS-APPS_20081031_1, WEBTOOLS-APPS_20081031_1, WEBTOOLS-APPS_20081031, DBS-APPS_20081024, WEBTOOLS-APPS_20081020_1, WEBTOOLS-APPS_20081020, WEBTOOLS-APPS_20081016_2, WEBTOOLS-APPS_20081016_1, WEBTOOLS-APPS_20081016, WEBTOOLS-APPS_20081015, WEBTOOLS-APPS_20081013_1, WEBTOOLS-APPS_20081013, WEBTOOLS-APPS_20081009, WEBTOOLS-APPS_20081008_1, WEBTOOLS-APPS_20081008, PRODAGENT_0_12_2, T0Mon_080926_1, WEBTOOLS-APPS_20080922, T0Mon_080920_2, T0Mon_080920_1, T0Mon_080916_2, WEBTOOLS-APPS_20080917, WEBTOOLS-APPS_20080916, WEBTOOLS-APPS_20080915, DBS-APPS_20080910_1, WEBTOOLS-APPS_20080910_1, WEBTOOLS-APPS_20080910, DBS-APPS_20080910, WEBTOOLS-APPS_20080909, DBS-APPS_20080908, T0Mon_080905_1, T0Mon_080905_01, WEBTOOLS-APPS_20080903, T0Mon_080902_2, T0Mon_080902_1, WEBTOOLS-APPS_20080826, T0Mon_080824_1, T0Mon_080823_1, WEBTOOLS-APPS_20080822, WEBTOOLS-APPS_20080821, WEBTOOLS-APPS_20080818_1, WEBTOOLS-APPS_20080818, buildset_V2_8, WEBTOOLS-APPS_20080725, WEBTOOLS-APPS_20080724, WEBTOOLS-APPS_20080717, WEBTOOLS-APPS_20080716, WEBTOOLS-APPS_20080715_2, WEBTOOLS-APPS_20080715_1, WEBTOOLS-APPS_20080715, nr080714_forCRAB, WEBTOOLS-APPS_20080713
Changes since 1.9: +1 -1 lines
Log Message:
Added semicolon to fix creation of dbs account

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 # 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