Blob Blame History Raw
From 12819a579900b9691e2bfaf14e76fbb025851530 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 3 Apr 2014 08:54:27 +0200
Subject: [PATCH] lvm:module-setup.sh: check for existance of
 69-dm-lvm-metad.rules

Before modifying 69-dm-lvm-metad.rules, we should check for the
existance first. Otherwise this results in error messages on
distributions (debian), which do not ship these rules.
---
 modules.d/90lvm/module-setup.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh
index 93a452e42d..5b810b9373 100755
--- a/modules.d/90lvm/module-setup.sh
+++ b/modules.d/90lvm/module-setup.sh
@@ -80,7 +80,8 @@ install() {
     inst_rules 11-dm-lvm.rules 69-dm-lvm-metad.rules
 
     # Do not run lvmetad update via pvscan in udev rule  - lvmetad is not running yet in dracut!
-    if grep -q SYSTEMD_WANTS ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules; then
+    if [[ -f ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules ]] && \
+        grep -q SYSTEMD_WANTS ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules; then
         sed -i -e 's/^ENV{SYSTEMD_ALIAS}=.*/# No LVM pvscan in dracut - lvmetad is not running yet/' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
         sed -i -e 's/^ENV{ID_MODEL}=.*//' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
         sed -i -e 's/^ENV{SYSTEMD_WANTS}=.*//' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
-- 
1.9.3