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