dracut-functions.sh: support for alternative udev dirs - udevaltdirs
PATCH 1/2 dracut-functions.sh: support for alternative udev dirs - udevaltdirs
It is required for Gentoo which moves udev from / to /usr and supports both /lib/udev and /usr/lib/udev for compatibility with other packages.
Credits go to Alexander Tsoy <alexander-EP/[email protected]>.
--- dracut-functions.sh | 9 +++++++++ 1 file changed, 9 insertions(+)
dracut-functions.sh +9 -0
@@ -941,6 +941,15 @@ inst_rules() { inst_dir "$_target" for _rule in "$@"; do if [ "${_rule#/}" = "$_rule" ]; then + for r in ${udevaltdirs}; do + [[ "$r" = "${udevdir}" ]] && continue + if [[ -f $r/rules.d/$_rule ]]; then + _found="$r/rules.d/$_rule" + inst_rule_programs "$_found" + inst_rule_group_owner "$_found" + inst_simple "$_found" "${udevdir}/rules.d/${_found##*/}" + fi + done for r in ${udevdir}/rules.d /etc/udev/rules.d; do if [[ -f $r/$_rule ]]; then _found="$r/$_rule"
Signature · 1 line
1.8.1.1
PATCH 2/2 gentoo.conf: let udevdir= be handled by pkg-config and use udevaltdirs
In reply to a message not in the archiveTo avoid need of rebuild after udev update/downgrade let udevdir= be set dynamically with pkg-config. Use udevaltdirs to search for rules both in old and new locations.
--- dracut.conf.d/gentoo.conf.example | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
dracut.conf.d/gentoo.conf.example +2 -1
@@ -1,7 +1,8 @@ # /etc/dracut.conf.d/gentoo.conf # dracut config file customized for Gentoo Base System release 2 -udevdir=/lib/udev +udevdir= +udevaltdirs="/lib/udev /usr/lib/udev" ro_mnt=yes #
Signature · 1 line
1.8.1.1
Re: [PATCH 2/2] gentoo.conf: let udevdir= be handled by pkg-config and use udevaltdirs
In reply to a message not in the archive'Twas brillig, and Amadeusz Żołnowski at 23/01/13 18:37 did gyre and gimble:
Quoted 12 lines
To avoid need of rebuild after udev update/downgrade let udevdir= be set dynamically with pkg-config. Use udevaltdirs to search for rules both in old and new locations.
--- dracut.conf.d/gentoo.conf.example | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)dracut.conf.d/gentoo.conf.example +0
-0
dracut.conf.d/gentoo.conf.example line 6
Quoted 7 lines
dracut.conf.d/gentoo.conf.example +2
-1@@ -1,7 +1,8 @@ # /etc/dracut.conf.d/gentoo.conf # dracut config file customized for Gentoo Base System release 2 -udevdir=/lib/udev +udevdir= +udevaltdirs="/lib/udev /usr/lib/udev" ro_mnt=yes
FWIW, I carry a couple patches downstream for this too in Mageia.
Due to their transnational nature, I figured it wasn't something that would be wanted upstream (it was only needed during a window when users had updates some packages which moved their udev rules to /usr/lib rather than /lib, but hadn't yet completed the usrmove (which isn't wise/advisable/supported, but some users did it so I didn't want to actively break initrd building, especially as this was a key part of actually performing the usrmove ;))
Attached is the patch I use for this which is much the same but doesn't require any specific config. It might not work in your case if /lib is not a symlink to /usr/lib.
I wouldn't recommend this is committed as it is purely transitional as I said.
Col
Signature · 10 lines
Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited http://www.tribalogic.net/ Open Source: Mageia Contributor http://www.mageia.org/ PulseAudio Hacker http://www.pulseaudio.org/ Trac Hacker http://trac.edgewall.org/
From a04eb301f3f1d64361886e13acc10f0d3b701c9e Mon Sep 17 00:00:00 2001
From: Colin Guthrie <[email protected]>
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(-)
dracut-functions.sh +5 -2
@@ -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"
dracut.sh +1 -1
@@ -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 ]] \
Signature · 1 line
1.8.1
Re: [PATCH 2/2] gentoo.conf: let udevdir= be handled by pkg-config and use udevaltdirs
Quoting Colin Guthrie (2013-01-23 20:45:13)
Quoted 2 lines
I wouldn't recommend this is committed as it is purely transitional as I said.
Why not support transitional scenarios, too? Who knows if somebody is not going to move udev around once again in the future? This patch isn't intrusive.
Signature · 1 line
Amadeusz Żołnowski