From 56da9f18b1878842f535e7f72c16cce1a326b1b3 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Sat, 23 Feb 2013 18:30:51 +0000 Subject: [PATCH] Add support for Red Hat Enterprise Server. * When using the lsb_release binary, at least RHES identified itself like `RedHatEnterpriseServer`. * Added `__camelcase_split()` to handle the above issue. * Added alias functions from `*red_hat_enterprise_linux*` to `*red_hat_enterprise_server*`. --- bootstrap-salt.sh | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 3b59fa9..b1b6254 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -376,6 +376,14 @@ __unquote_string() { echo $@ | sed "s/^\([\"']\)\(.*\)\1\$/\2/g" } +#--- FUNCTION ---------------------------------------------------------------- +# NAME: __camelcase_split +# DESCRIPTION: Convert CamelCased strings to Camel_Cased +#------------------------------------------------------------------------------- +__camelcase_split() { + echo $@ | sed -r 's/([^A-Z-])([A-Z])/\1 \2/g' +} + #--- FUNCTION ---------------------------------------------------------------- # NAME: __sort_release_files # DESCRIPTION: Custom sort function. Alphabetical or numerical sort is not @@ -429,6 +437,10 @@ __gather_linux_system_info() { rv=$(lsb_release >/dev/null 2>&1) if [ $? -eq 0 ]; then DISTRO_NAME=$(lsb_release -si) + if [ "x$(echo "$DISTRO_NAME" | grep RedHat)" != "x" ]; then + # Let's convert CamelCase to Camel Case + DISTRO_NAME=$(__camelcase_split "$DISTRO_NAME") + fi rv=$(lsb_release -sr) [ "${rv}x" != "x" ] && DISTRO_VERSION=$(__parse_version_string "$rv") elif [ -f /etc/lsb-release ]; then @@ -1201,6 +1213,14 @@ install_red_hat_enterprise_linux_git_deps() { install_red_hat_linux_git_deps } +install_red_hat_enterprise_server_stable_deps() { + install_red_hat_linux_stable_deps +} + +install_red_hat_enterprise_server_git_deps() { + install_red_hat_linux_git_deps +} + install_red_hat_linux_stable() { install_centos_stable } @@ -1217,6 +1237,14 @@ install_red_hat_enterprise_linux_git() { install_red_hat_linux_git } +install_red_hat_enterprise_server_stable() { + install_red_hat_linux_stable +} + +install_red_hat_enterprise_server_git() { + install_red_hat_linux_git +} + install_red_hat_linux_stable_post() { install_centos_stable_post } @@ -1229,7 +1257,6 @@ install_red_hat_linux_git_post() { install_centos_git_post } - install_red_hat_enterprise_linux_stable_post() { install_red_hat_linux_stable_post } @@ -1241,6 +1268,18 @@ install_red_hat_enterprise_linux_restart_daemons() { install_red_hat_enterprise_linux_git_post() { install_red_hat_linux_git_post } + +install_red_hat_enterprise_server_stable_post() { + install_red_hat_linux_stable_post +} + +install_red_hat_enterprise_server_restart_daemons() { + install_red_hat_linux_restart_daemons +} + +install_red_hat_enterprise_server_git_post() { + install_red_hat_linux_git_post +} # # Ended RedHat Install Functions #