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

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