From ec47bc1d720852ca07f1af2143c2a6c1353e9306 Mon Sep 17 00:00:00 2001 From: Wiekus Beukes Date: Thu, 19 Mar 2015 08:20:38 -0700 Subject: [PATCH] Add support for Oracle Linux 7 and later. Most of the changes revolves around using MySQL rather than MariaDB, plus enabling the addon repos on public-yum.oracle.com. The patch just touch the areas where there is a divergence between the Fedora and Oracle distributions and in all other cases the is_fedora will result in the correct decision to be made and left as is. Collapsed the is_suse and is_oraclelinux into a single check in configure_database_mysql and cleanup_database_mysql Added Oracle Linux to MAINTAINERS.rst Rather than duplicating most of the Redhat version check code, added a check in the block to do the determination if it is Oracle Linux Change-Id: I5f1f15106329eec67aa008b17847fa44863f243f --- MAINTAINERS.rst | 4 ++++ functions-common | 19 +++++++++++++++++-- lib/databases/mysql | 24 ++++++++++++------------ stack.sh | 4 ++++ 4 files changed, 37 insertions(+), 14 deletions(-) diff --git a/MAINTAINERS.rst b/MAINTAINERS.rst index a376eb0428..20e8655d69 100644 --- a/MAINTAINERS.rst +++ b/MAINTAINERS.rst @@ -90,3 +90,7 @@ Zaqar (Marconi) * Flavio Percoco * Malini Kamalambal + +Oracle Linux +~~~~~~~~~~~~ +* Wiekus Beukes diff --git a/functions-common b/functions-common index 3dae8147b5..d00d4a7c6f 100644 --- a/functions-common +++ b/functions-common @@ -246,6 +246,7 @@ function GetOSVersion { # CentOS Linux release 6.0 (Final) # Fedora release 16 (Verne) # XenServer release 6.2.0-70446c (xenenterprise) + # Oracle Linux release 7 os_CODENAME="" for r in "Red Hat" CentOS Fedora XenServer; do os_VENDOR=$r @@ -259,6 +260,9 @@ function GetOSVersion { fi os_VENDOR="" done + if [ "$os_VENDOR" = "Red Hat" ] && [[ -r /etc/oracle-release ]]; then + os_VENDOR=OracleLinux + fi os_PACKAGE="rpm" elif [[ -r /etc/SuSE-release ]]; then for r in openSUSE "SUSE Linux"; do @@ -310,7 +314,7 @@ function GetDistro { fi elif [[ "$os_VENDOR" =~ (Red Hat) || \ "$os_VENDOR" =~ (CentOS) || \ - "$os_VENDOR" =~ (OracleServer) ]]; then + "$os_VENDOR" =~ (OracleLinux) ]]; then # Drop the . release as we assume it's compatible DISTRO="rhel${os_RELEASE::1}" elif [[ "$os_VENDOR" =~ (XenServer) ]]; then @@ -328,6 +332,17 @@ function is_arch { [[ "$(uname -m)" == "$1" ]] } +# Determine if current distribution is an Oracle distribution +# is_oraclelinux +function is_oraclelinux { + if [[ -z "$os_VENDOR" ]]; then + GetOSVersion + fi + + [ "$os_VENDOR" = "OracleLinux" ] +} + + # Determine if current distribution is a Fedora-based distribution # (Fedora, RHEL, CentOS, etc). # is_fedora @@ -337,7 +352,7 @@ function is_fedora { fi [ "$os_VENDOR" = "Fedora" ] || [ "$os_VENDOR" = "Red Hat" ] || \ - [ "$os_VENDOR" = "CentOS" ] || [ "$os_VENDOR" = "OracleServer" ] + [ "$os_VENDOR" = "CentOS" ] || [ "$os_VENDOR" = "OracleLinux" ] } diff --git a/lib/databases/mysql b/lib/databases/mysql index 70073c4c6f..dabd7d05fe 100644 --- a/lib/databases/mysql +++ b/lib/databases/mysql @@ -16,7 +16,7 @@ register_database mysql # Linux distros, thank you for being incredibly consistent MYSQL=mysql -if is_fedora; then +if is_fedora && ! is_oraclelinux; then MYSQL=mariadb fi @@ -32,12 +32,12 @@ function cleanup_database_mysql { sudo rm -rf /var/lib/mysql sudo rm -rf /etc/mysql return + elif is_suse || is_oraclelinux; then + uninstall_package mysql-community-server + sudo rm -rf /var/lib/mysql elif is_fedora; then uninstall_package mariadb-server sudo rm -rf /var/lib/mysql - elif is_suse; then - uninstall_package mysql-community-server - sudo rm -rf /var/lib/mysql else return fi @@ -56,12 +56,12 @@ function configure_database_mysql { if is_ubuntu; then my_conf=/etc/mysql/my.cnf mysql=mysql + elif is_suse || is_oraclelinux; then + my_conf=/etc/my.cnf + mysql=mysql elif is_fedora; then mysql=mariadb my_conf=/etc/my.cnf - elif is_suse; then - my_conf=/etc/my.cnf - mysql=mysql else exit_distro_not_supported "mysql configuration" fi @@ -140,14 +140,14 @@ EOF chmod 0600 $HOME/.my.cnf fi # Install mysql-server - if is_fedora; then - install_package mariadb-server - elif is_ubuntu; then - install_package mysql-server - elif is_suse; then + if is_suse || is_oraclelinux; then if ! is_package_installed mariadb; then install_package mysql-community-server fi + elif is_fedora; then + install_package mariadb-server + elif is_ubuntu; then + install_package mysql-server else exit_distro_not_supported "mysql installation" fi diff --git a/stack.sh b/stack.sh index d83952accc..a475aab1b0 100755 --- a/stack.sh +++ b/stack.sh @@ -278,6 +278,10 @@ EOF die $LINENO "Error installing RDO repo, cannot continue" fi + if is_oraclelinux; then + sudo yum-config-manager --enable ol7_optional_latest ol7_addons ol7_MySQL56 + fi + fi