Blame SOURCES/bz1972035-LVM-activate-fix-drop-in.patch

4e8648
From 5729c79c6ab06f3dacf1fe8dafab9403e5560e34 Mon Sep 17 00:00:00 2001
4e8648
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
4e8648
Date: Thu, 20 May 2021 10:14:49 +0200
4e8648
Subject: [PATCH] LVM-activate: fix drop-in check to avoid re-creating drop-in
4e8648
 file when it already exists
4e8648
4e8648
---
4e8648
 heartbeat/LVM-activate | 17 +++++++----------
4e8648
 1 file changed, 7 insertions(+), 10 deletions(-)
4e8648
4e8648
diff --git a/heartbeat/LVM-activate b/heartbeat/LVM-activate
4e8648
index a8e40dce4..53223367e 100755
4e8648
--- a/heartbeat/LVM-activate
4e8648
+++ b/heartbeat/LVM-activate
4e8648
@@ -820,17 +820,14 @@ lvm_start() {
4e8648
         if systemd_is_running ; then
4e8648
         	# Create drop-in to deactivate VG before stopping
4e8648
 		# storage services during shutdown/reboot.
4e8648
-		after=$(systemctl show resource-agents-deps.target.d \
4e8648
-			--property=After | cut -d'=' -f2)
4e8648
-
4e8648
-		case "$after" in
4e8648
-			*" blk-availability.service "*)
4e8648
-				;;
4e8648
-			*)
4e8648
-				systemd_drop_in "99-LVM-activate" "After" \
4e8648
+		systemctl show resource-agents-deps.target \
4e8648
+			--property=After | cut -d'=' -f2 | \
4e8648
+			grep -qE "(^|\s)blk-availability.service(\s|$)"
4e8648
+
4e8648
+		if [ "$?" -ne 0 ]; then
4e8648
+			systemd_drop_in "99-LVM-activate" "After" \
4e8648
 					"blk-availability.service"
4e8648
-				;;
4e8648
-		esac
4e8648
+		fi
4e8648
 
4e8648
 		# If blk-availability isn't started, the "After="
4e8648
 		# directive has no effect.