Blame SOURCES/bz1666691-tomcat-use-systemd-when-catalina.sh-unavailable.patch

b4b3ce
From b42ef7555de86cc29d165ae17682c223bfb23b6e Mon Sep 17 00:00:00 2001
b4b3ce
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
b4b3ce
Date: Mon, 5 Nov 2018 16:38:01 +0100
b4b3ce
Subject: [PATCH 1/2] tomcat: use systemd on RHEL when catalina.sh is
b4b3ce
 unavailable
b4b3ce
b4b3ce
---
b4b3ce
 heartbeat/tomcat | 8 +++++++-
b4b3ce
 1 file changed, 7 insertions(+), 1 deletion(-)
b4b3ce
b4b3ce
diff --git a/heartbeat/tomcat b/heartbeat/tomcat
b4b3ce
index 4812a0133..833870038 100755
b4b3ce
--- a/heartbeat/tomcat
b4b3ce
+++ b/heartbeat/tomcat
b4b3ce
@@ -613,7 +613,6 @@ TOMCAT_NAME="${OCF_RESKEY_tomcat_name-tomcat}"
b4b3ce
 TOMCAT_CONSOLE="${OCF_RESKEY_script_log-/var/log/$TOMCAT_NAME.log}"
b4b3ce
 RESOURCE_TOMCAT_USER="${OCF_RESKEY_tomcat_user-root}"
b4b3ce
 RESOURCE_STATUSURL="${OCF_RESKEY_statusurl-http://127.0.0.1:8080}"
b4b3ce
-OCF_RESKEY_force_systemd_default=0
b4b3ce
 
b4b3ce
 JAVA_HOME="${OCF_RESKEY_java_home}"
b4b3ce
 JAVA_OPTS="${OCF_RESKEY_java_opts}"
b4b3ce
@@ -630,6 +629,13 @@ if [ -z "$CATALINA_PID" ]; then
b4b3ce
 	CATALINA_PID="${HA_RSCTMP}/${TOMCAT_NAME}_tomcatstate/catalina.pid"
b4b3ce
 fi
b4b3ce
 
b4b3ce
+# Only default to true for RedHat systems without catalina.sh
b4b3ce
+if [ -e "$CATALINA_HOME/bin/catalina.sh" ] || ! is_redhat_based; then
b4b3ce
+	OCF_RESKEY_force_systemd_default=0
b4b3ce
+else
b4b3ce
+	OCF_RESKEY_force_systemd_default=1
b4b3ce
+fi
b4b3ce
+
b4b3ce
 MAX_STOP_TIME="${OCF_RESKEY_max_stop_time}"
b4b3ce
 
b4b3ce
 : ${OCF_RESKEY_force_systemd=${OCF_RESKEY_force_systemd_default}}
b4b3ce
b4b3ce
From 9cb2b142a9ecb3a2d5a51cdd51b4005f08b9a97b Mon Sep 17 00:00:00 2001
b4b3ce
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
b4b3ce
Date: Mon, 5 Nov 2018 17:09:43 +0100
b4b3ce
Subject: [PATCH 2/2] ocf-distro: add regex for RedHat version
b4b3ce
b4b3ce
---
b4b3ce
 heartbeat/ocf-distro | 2 +-
b4b3ce
 1 file changed, 1 insertion(+), 1 deletion(-)
b4b3ce
b4b3ce
diff --git a/heartbeat/ocf-distro b/heartbeat/ocf-distro
b4b3ce
index 530ee57ed..f69910c98 100644
b4b3ce
--- a/heartbeat/ocf-distro
b4b3ce
+++ b/heartbeat/ocf-distro
b4b3ce
@@ -39,7 +39,7 @@ get_os_ver() {
b4b3ce
 		VER=$(cat $_DEBIAN_VERSION_FILE)
b4b3ce
 	elif [ -f $_REDHAT_RELEASE_FILE ]; then
b4b3ce
 		OS=RedHat  # redhat or similar
b4b3ce
-		VER= # here some complex sed script
b4b3ce
+		VER=$(sed "s/.* release \([^ ]\+\).*/\1/" $_REDHAT_RELEASE_FILE)
b4b3ce
 	else
b4b3ce
 		OS=$(uname -s)
b4b3ce
 		VER=$(uname -r)