Sophie

Sophie

distrib > Mageia > 3 > i586 > media > core-release-src > by-pkgid > 5c1bb304a26349fad0d8eaf2d0262d83 > files > 18

dracut-025-8.mga3.src.rpm

From a04eb301f3f1d64361886e13acc10f0d3b701c9e Mon Sep 17 00:00:00 2001
From: Colin Guthrie <colin@mageia.org>
Date: Thu, 16 Aug 2012 14:27:22 +0100
Subject: [PATCH 511/511] udev-rules: Pre usrmove systemd installs might not
 find system udev rules.

If users had switched to systemd-183+ but have not completed
the usrmove, the udevdir variable might not properly point to
where the system rules are really kept, so include another
path in the search there if needed.

If the user systemd has been half updated (e.g. some packages using the
new udev rules dir, but some olders ones not) before the usrmove is
completed then we want this patch. It's arguably one that is not needed
upstream however.
---
 dracut-functions.sh | 7 +++++--
 dracut.sh           | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/dracut-functions.sh b/dracut-functions.sh
index e23db76..b28eff5 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -935,13 +935,16 @@ inst_rule_group_owner() {
 # udev rules always get installed in the same place, so
 # create a function to install them to make life simpler.
 inst_rules() {
-    local _target=/etc/udev/rules.d _rule _found
+    local _target=/etc/udev/rules.d _rule _found _extrapath=""
 
     inst_dir "${udevdir}/rules.d"
     inst_dir "$_target"
+    if [ "${udevdir}" = "/lib/udev" -a -d "/usr/lib/udev/rules.d" ]; then
+        _extrapath="/usr/lib/udev/rules.d"
+    fi
     for _rule in "$@"; do
         if [ "${_rule#/}" = "$_rule" ]; then
-            for r in ${udevdir}/rules.d /etc/udev/rules.d; do
+            for r in ${udevdir}/rules.d ${_extrapath} /etc/udev/rules.d; do
                 if [[ -f $r/$_rule ]]; then
                     _found="$r/$_rule"
                     inst_rule_programs "$_found"
diff --git a/dracut.sh b/dracut.sh
index 9941caa..c8b1676 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -812,8 +812,8 @@ done
 [[ -d $udevdir ]] \
     || udevdir=$(pkg-config udev --variable=udevdir 2>/dev/null)
 if ! [[ -d "$udevdir" ]]; then
-    [[ -d /lib/udev ]] && udevdir=/lib/udev
     [[ -d /usr/lib/udev ]] && udevdir=/usr/lib/udev
+    [[ ! -L /lib ]] && [[ -d /lib/udev ]] && udevdir=/lib/udev
 fi
 
 [[ -d $systemdutildir ]] \
-- 
1.8.1