diff options
Diffstat (limited to 'sys-kernel/dracut/files/024-0001-Fallback-to-external-blkid-and-path_id.patch')
-rw-r--r-- | sys-kernel/dracut/files/024-0001-Fallback-to-external-blkid-and-path_id.patch | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/sys-kernel/dracut/files/024-0001-Fallback-to-external-blkid-and-path_id.patch b/sys-kernel/dracut/files/024-0001-Fallback-to-external-blkid-and-path_id.patch new file mode 100644 index 000000000000..e42bff1e4e7e --- /dev/null +++ b/sys-kernel/dracut/files/024-0001-Fallback-to-external-blkid-and-path_id.patch @@ -0,0 +1,127 @@ +From 226fb690900d869c0f8542ea5983c1c4ec3ac9db Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Amadeusz=20=C5=BBo=C5=82nowski?= <aidecoe@aidecoe.name> +Date: Thu, 1 Nov 2012 09:31:01 +0100 +Subject: [PATCH] Fallback to external blkid and path_id in udev rules for + <udev-176. + +Starting with commit 24a38bc1cbe461c344ce61c7e10b6d51d5689c93 dracut +uses udev builtins but still depends on >=udev-166 in dracut.spec. This +patch makes dracut work with older udev again. + +All credits go to Alexander Tsoy <alexander@tsoy.me>; see + + https://bugs.gentoo.org/show_bug.cgi?id=437700 +--- + modules.d/95udev-rules/59-persistent-storage.rules | 8 +++---- + modules.d/95udev-rules/61-persistent-storage.rules | 2 +- + modules.d/95udev-rules/module-setup.sh | 2 ++ + modules.d/95udev-rules/udev-rules-prepare.sh | 25 ++++++++++++++++++++++ + modules.d/99base/init.sh | 2 +- + 5 files changed, 33 insertions(+), 6 deletions(-) + create mode 100644 modules.d/95udev-rules/udev-rules-prepare.sh + +diff --git a/modules.d/95udev-rules/59-persistent-storage.rules b/modules.d/95udev-rules/59-persistent-storage.rules +index f2756ee..c221cda 100644 +--- a/modules.d/95udev-rules/59-persistent-storage.rules ++++ b/modules.d/95udev-rules/59-persistent-storage.rules +@@ -3,8 +3,8 @@ ACTION!="add|change", GOTO="ps_end" + # Also don't process disks that are slated to be a multipath device + ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="ps_end" + +-KERNEL=="cciss[0-9]*", IMPORT{builtin}="blkid" +-KERNEL=="nbd[0-9]*", IMPORT{builtin}="blkid" ++KERNEL=="cciss[0-9]*", IMPORT BLKID ++KERNEL=="nbd[0-9]*", IMPORT BLKID + + + KERNEL!="md[0-9]*|md_d[0-9]*|md/*", KERNEL!="md*", GOTO="md_end" +@@ -21,7 +21,7 @@ ATTR{md/array_state}=="|clear|inactive", GOTO="md_end" + LABEL="md_ignore_state" + + IMPORT{program}="/sbin/mdadm --detail --export $tempnode" +-IMPORT{builtin}="blkid" ++IMPORT BLKID + OPTIONS+="link_priority=100" + OPTIONS+="watch" + LABEL="md_end" +@@ -34,7 +34,7 @@ ENV{DM_NAME}!="?*", GOTO="ps_end" + ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="ps_end" + ENV{DM_UUID}=="CRYPT-TEMP-?*", GOTO="ps_end" + ENV{DM_UUID}!="?*", ENV{DM_NAME}=="temporary-cryptsetup-?*", GOTO="ps_end" +-IMPORT{builtin}="blkid" ++IMPORT BLKID + + + LABEL="ps_end" +diff --git a/modules.d/95udev-rules/61-persistent-storage.rules b/modules.d/95udev-rules/61-persistent-storage.rules +index 7dbd151..37148b0 100644 +--- a/modules.d/95udev-rules/61-persistent-storage.rules ++++ b/modules.d/95udev-rules/61-persistent-storage.rules +@@ -12,7 +12,7 @@ GOTO="pss_end" + + LABEL="do_pss" + # by-path (parent device path) +-ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="", DEVPATH!="*/virtual/*", IMPORT{builtin}="path_id" ++ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="", DEVPATH!="*/virtual/*", IMPORT PATH_ID + ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}" + ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" + +diff --git a/modules.d/95udev-rules/module-setup.sh b/modules.d/95udev-rules/module-setup.sh +index 533dfeb..54a192e 100755 +--- a/modules.d/95udev-rules/module-setup.sh ++++ b/modules.d/95udev-rules/module-setup.sh +@@ -74,5 +74,7 @@ install() { + inst_script "$moddir/load-modules.sh" /lib/udev/load-modules.sh + + inst_libdir_file "libnss_files*" ++ ++ inst_hook pre-udev 10 "$moddir/udev-rules-prepare.sh" + } + +diff --git a/modules.d/95udev-rules/udev-rules-prepare.sh b/modules.d/95udev-rules/udev-rules-prepare.sh +new file mode 100644 +index 0000000..08263ea +--- /dev/null ++++ b/modules.d/95udev-rules/udev-rules-prepare.sh +@@ -0,0 +1,25 @@ ++#!/bin/sh ++# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- ++# ex: ts=8 sw=4 sts=4 et filetype=sh ++ ++for f in /etc/udev/rules.d/*-persistent-storage.rules; do ++ [ -e "$f" ] || continue ++ while read line; do ++ if [ "${line%%IMPORT PATH_ID}" != "$line" ]; then ++ if [ $UDEVVERSION -ge 174 ]; then ++ printf '%sIMPORT{builtin}="path_id"\n' "${line%%IMPORT PATH_ID}" ++ else ++ printf '%sIMPORT{program}="path_id %%p"\n' "${line%%IMPORT PATH_ID}" ++ fi ++ elif [ "${line%%IMPORT BLKID}" != "$line" ]; then ++ if [ $UDEVVERSION -ge 176 ]; then ++ printf '%sIMPORT{builtin}="blkid"\n' "${line%%IMPORT BLKID}" ++ else ++ printf '%sIMPORT{program}="/sbin/blkid -o udev -p $tempnode"\n' "${line%%IMPORT BLKID}" ++ fi ++ else ++ echo "$line" ++ fi ++ done < "${f}" > "${f}.new" ++ mv "${f}.new" "$f" ++done +diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh +index 16c8958..0259053 100755 +--- a/modules.d/99base/init.sh ++++ b/modules.d/99base/init.sh +@@ -83,7 +83,7 @@ trap "emergency_shell Signal caught!" 0 + + [ -d /run/initramfs ] || mkdir -p -m 0755 /run/initramfs + +-UDEVVERSION=$(udevadm --version) ++export UDEVVERSION=$(udevadm --version) + if [ $UDEVVERSION -gt 166 ]; then + # newer versions of udev use /run/udev/rules.d + export UDEVRULESD=/run/udev/rules.d +-- +1.7.12.4 + |