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

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