The mysql-community-server is a compat provide, openSUSE uses
mariadb for quite some time. Make it futureproof in case
the compat provide goes away in the future. Cleanup
mysql service name to MYSQL_SERVICE_NAME and consistently
use it.
Change-Id: I2df7b8d8b798dfa7ceade90e0c127e0609524a8b
... | ... |
@@ -15,10 +15,9 @@ MYSQL_DRIVER=${MYSQL_DRIVER:-PyMySQL} |
15 | 15 |
|
16 | 16 |
register_database mysql |
17 | 17 |
|
18 |
-# Linux distros, thank you for being incredibly consistent |
|
19 |
-MYSQL=mysql |
|
18 |
+MYSQL_SERVICE_NAME=mysql |
|
20 | 19 |
if is_fedora && ! is_oraclelinux; then |
21 |
- MYSQL=mariadb |
|
20 |
+ MYSQL_SERVICE_NAME=mariadb |
|
22 | 21 |
fi |
23 | 22 |
|
24 | 23 |
# Functions |
... | ... |
@@ -34,17 +33,17 @@ function get_database_type_mysql { |
34 | 34 |
|
35 | 35 |
# Get rid of everything enough to cleanly change database backends |
36 | 36 |
function cleanup_database_mysql { |
37 |
- stop_service $MYSQL |
|
37 |
+ stop_service $MYSQL_SERVICE_NAME |
|
38 | 38 |
if is_ubuntu; then |
39 | 39 |
# Get ruthless with mysql |
40 | 40 |
apt_get purge -y mysql* mariadb* |
41 | 41 |
sudo rm -rf /var/lib/mysql |
42 | 42 |
sudo rm -rf /etc/mysql |
43 | 43 |
return |
44 |
- elif is_suse || is_oraclelinux; then |
|
44 |
+ elif is_oraclelinux; then |
|
45 | 45 |
uninstall_package mysql-community-server |
46 | 46 |
sudo rm -rf /var/lib/mysql |
47 |
- elif is_fedora; then |
|
47 |
+ elif is_suse || is_fedora; then |
|
48 | 48 |
uninstall_package mariadb-server |
49 | 49 |
sudo rm -rf /var/lib/mysql |
50 | 50 |
else |
... | ... |
@@ -64,12 +63,9 @@ function configure_database_mysql { |
64 | 64 |
|
65 | 65 |
if is_ubuntu; then |
66 | 66 |
my_conf=/etc/mysql/my.cnf |
67 |
- mysql=mysql |
|
68 | 67 |
elif is_suse || is_oraclelinux; then |
69 | 68 |
my_conf=/etc/my.cnf |
70 |
- mysql=mysql |
|
71 | 69 |
elif is_fedora; then |
72 |
- mysql=mariadb |
|
73 | 70 |
my_conf=/etc/my.cnf |
74 | 71 |
local cracklib_conf=/etc/my.cnf.d/cracklib_password_check.cnf |
75 | 72 |
if [ -f "$cracklib_conf" ]; then |
... | ... |
@@ -82,7 +78,7 @@ function configure_database_mysql { |
82 | 82 |
# Start mysql-server |
83 | 83 |
if is_fedora || is_suse; then |
84 | 84 |
# service is not started by default |
85 |
- start_service $mysql |
|
85 |
+ start_service $MYSQL_SERVICE_NAME |
|
86 | 86 |
fi |
87 | 87 |
|
88 | 88 |
# Set the root password - only works the first time. For Ubuntu, we already |
... | ... |
@@ -124,7 +120,7 @@ function configure_database_mysql { |
124 | 124 |
iniset -sudo $my_conf mysqld log-queries-not-using-indexes 1 |
125 | 125 |
fi |
126 | 126 |
|
127 |
- restart_service $mysql |
|
127 |
+ restart_service $MYSQL_SERVICE_NAME |
|
128 | 128 |
} |
129 | 129 |
|
130 | 130 |
function install_database_mysql { |
... | ... |
@@ -151,13 +147,11 @@ EOF |
151 | 151 |
chmod 0600 $HOME/.my.cnf |
152 | 152 |
fi |
153 | 153 |
# Install mysql-server |
154 |
- if is_suse || is_oraclelinux; then |
|
155 |
- if ! is_package_installed mariadb; then |
|
156 |
- install_package mysql-community-server |
|
157 |
- fi |
|
158 |
- elif is_fedora; then |
|
154 |
+ if is_oraclelinux; then |
|
155 |
+ install_package mysql-community-server |
|
156 |
+ elif is_fedora || is_suse; then |
|
159 | 157 |
install_package mariadb-server |
160 |
- sudo systemctl enable mariadb |
|
158 |
+ sudo systemctl enable $MYSQL_SERVICE_NAME |
|
161 | 159 |
elif is_ubuntu; then |
162 | 160 |
install_package mysql-server |
163 | 161 |
else |