From 6d00586adb5e072af116c377c83d97ce8d6e984a Mon Sep 17 00:00:00 2001 From: Varadinsky Date: Tue, 31 Oct 2017 10:44:12 +0100 Subject: [PATCH 1/2] Install MariaDB instead of MySQL on CentOS 7 --- Rex/Database/MySQL/__module__.pm | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Rex/Database/MySQL/__module__.pm b/Rex/Database/MySQL/__module__.pm index 75cd83c..04f8380 100644 --- a/Rex/Database/MySQL/__module__.pm +++ b/Rex/Database/MySQL/__module__.pm @@ -15,21 +15,29 @@ use Rex -base; our %package = ( Debian => "mysql-server", Ubuntu => "mysql-server", - CentOS => "mysql-server", + CentOS => ["mysql-server", "mariadb-server"], Mageia => "mysql", ); our %service_name = ( Debian => "mysql", Ubuntu => "mysql", - CentOS => "mysqld", + CentOS => ["mysql", "mariadb"], Mageia => "mysqld", ); task "setup", sub { - my $pkg = $package{get_operating_system()}; - my $service = $service_name{get_operating_system()}; + my $osname = get_operating_system(); + my $pkg = $package{$osname}; + my $service = $service_name{$osname}; + + if ($osname eq 'CentOS') { + my ($centos_release) = operating_system_release() =~ /^(\d)/; + + $pkg = $centos_release < 7 ? $pkg->[0] : $pkg->[1]; + $service = $centos_release < 7 ? $service->[0] : $service->[1]; + } # install mysql package update_package_db; From 026e91eee6fd5622156db652eb4223f74f6e7530 Mon Sep 17 00:00:00 2001 From: Varadinsky Date: Tue, 31 Oct 2017 10:50:15 +0100 Subject: [PATCH 2/2] Use mysqld for service name on CentOS --- Rex/Database/MySQL/__module__.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rex/Database/MySQL/__module__.pm b/Rex/Database/MySQL/__module__.pm index 04f8380..76cdff6 100644 --- a/Rex/Database/MySQL/__module__.pm +++ b/Rex/Database/MySQL/__module__.pm @@ -22,7 +22,7 @@ our %package = ( our %service_name = ( Debian => "mysql", Ubuntu => "mysql", - CentOS => ["mysql", "mariadb"], + CentOS => ["mysqld", "mariadb"], Mageia => "mysqld", );