View difference between Paste ID: mtA7Ncxb and LjQWDb24
SHOW: | | - or go back to the newest paste.
1
#!/bin/bash
2-
source ./openstack.rc
2+
source ./myvars.rc
3
4
5
if [[ $(rpm -q mysql-server) == *"not installed"* ]]
6
then
7
  echo "mysql-server not installed, aborting..."
8
  exit
9
fi
10
11
if [[ $(/etc/init.d/mysqld) != *running* ]]
12
then
13
  echo "Starting mysql-server..."
14
  echo "$(/etc/init.d/mysqld start)"
15
else
16
  exit
17
fi
18
19
echo "Running mysql_secure_installation..."
20
21
sleep 2
22
23-
echo "$KEYSTONE_DBPASS"
23+
echo "$DBPASS"
24
25-
echo "$(export $KEYSTONE_DBPASS)"
25+
echo "$(export $DBPASS)"
26
SECURE_MYSQL=$(expect -c "
27
28
spawn mysql_secure_installation
29
30
expect \"Enter current password for root (enter for none):\"
31
send \"\r\"
32
33
expect \"Set root password?\"
34
send \"y\r\"
35
36
expect \"New password: \"
37-
send \"$KEYSTONE_DBPASS\r\"
37+
send \"$DBPASS\r\"
38
39
expect \"Re-enter new password: \"
40-
send \"$KEYSTONE_DBPASS\r\"
40+
send \"$DBPASS\r\"
41
42
expect \"Remove anonymous users?\"
43
send \"y\r\"
44
45
expect \"Disallow root login remotely?\"
46
send \"y\r\"
47
48
expect \"Remove test database and access to it?\"
49
send \"y\r\"
50
51
expect \"Reload privilege tables now?\"
52
send \"y\r\"
53
54
expect eof
55
")
56
57
echo "$SECURE_MYSQL"
58
59
echo "Replacing password in /tmp/openstack/.my.cnf file..."
60-
echo "$KEYSTONE_DBPASS"
60+
echo "$DBPASS"
61
# echo "$(sed -i "s/pass=/pass=$KEYSTONE_DBPASS/g" "/tmp/openstack/.my.cnf")"
62
# echo "Copying to ~/.my.cnf..."
63
# echo "$(/bin/cp -f /tmp/openstack/.my.cnf ~/.my.cnf)"
64
exit 1