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

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