dracut/0005-make-udevdir-systemdutildir-systemdsystemunitdir-glo.patch

128 lines
4.8 KiB
Diff
Raw Normal View History

From d161561290909523818e5ec16271e5f88b6152de Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 6 Jun 2012 15:12:59 +0200
Subject: [PATCH] make udevdir systemdutildir systemdsystemunitdir global vars
your distribution should ship those settings in
/etc/dracut.conf.d/01-distro.conf
see dracut.conf.d/fedora.conf.example
---
dracut-functions.sh | 6 ------
dracut.conf.d/fedora.conf.example | 3 +++
dracut.sh | 20 +++++++++++++++++++-
modules.d/95udev-rules/module-setup.sh | 12 ------------
modules.d/98systemd/module-setup.sh | 11 -----------
5 files changed, 22 insertions(+), 30 deletions(-)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index 4180f03..8aba88d 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -531,12 +531,6 @@ inst_symlink() {
ln -sfn $(convert_abs_rel "${_target}" "${_realsrc}") "$initdir/$_target"
}
-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
-fi
-
# attempt to install any programs specified in a udev rule
inst_rule_programs() {
local _prog _bin
diff --git a/dracut.conf.d/fedora.conf.example b/dracut.conf.d/fedora.conf.example
index e362e73..f3f57f1 100644
--- a/dracut.conf.d/fedora.conf.example
+++ b/dracut.conf.d/fedora.conf.example
@@ -8,3 +8,6 @@ stdloglvl=3
realinitpath="/usr/lib/systemd/systemd"
install_items+=" vi /etc/virc ps grep cat rm "
prefix="/"
+systemdutildir=/usr/lib/systemd
+systemdsystemunitdir=/usr/lib/systemd/system
+udevdir=/usr/lib/udev
diff --git a/dracut.sh b/dracut.sh
index 65398a8..49ea503 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -650,13 +650,31 @@ for dev in "${host_devs[@]}"; do
done
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
+fi
+
+[[ -d $systemdutildir ]] \
+ || systemdutildir=$(pkg-config systemd --variable=systemdutildir 2>/dev/null)
+[[ -d $systemdsystemunitdir ]] \
+ || systemdsystemunitdir=$(pkg-config systemd --variable=systemdsystemunitdir 2>/dev/null)
+
+if ! [[ -d "$systemdutildir" ]]; then
+ [[ -d /lib/systemd ]] && systemdutildir=/lib/systemd
+ [[ -d /usr/lib/systemd ]] && systemdutildir=/usr/lib/systemd
+fi
+[[ -d "$systemdsystemunitdir" ]] || systemdsystemunitdir=${systemdutildir}/system
+
export initdir dracutbasedir dracutmodules drivers \
fw_dir drivers_dir debug no_kernel kernel_only \
add_drivers omit_drivers mdadmconf lvmconf filesystems \
use_fstab fstab_lines libdirs fscks nofscks \
stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \
debug host_fs_types host_devs sshkey add_fstab \
- DRACUT_VERSION
+ DRACUT_VERSION udevdir systemdutildir systemdsystemunitdir
# Create some directory structure first
[[ $prefix ]] && mkdir -m 0755 -p "${initdir}${prefix}"
diff --git a/modules.d/95udev-rules/module-setup.sh b/modules.d/95udev-rules/module-setup.sh
index ff47021..a48b0cb 100755
--- a/modules.d/95udev-rules/module-setup.sh
+++ b/modules.d/95udev-rules/module-setup.sh
@@ -5,18 +5,6 @@
install() {
local _i
- systemdutildir=$(pkg-config systemd --variable=systemdutildir 2>/dev/null)
- if ! [[ -d "$systemdutildir" ]]; then
- [[ -d /lib/systemd ]] && systemdutildir=/lib/systemd
- [[ -d /usr/lib/systemd ]] && systemdutildir=/usr/lib/systemd
- fi
-
- 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
- fi
-
# Fixme: would be nice if we didn't have to know which rules to grab....
# ultimately, /lib/initramfs/rules.d or somesuch which includes links/copies
# of the rules we want so that we just copy those in would be best
diff --git a/modules.d/98systemd/module-setup.sh b/modules.d/98systemd/module-setup.sh
index 1d8aefc..4fda2a2 100755
--- a/modules.d/98systemd/module-setup.sh
+++ b/modules.d/98systemd/module-setup.sh
@@ -16,17 +16,6 @@ depends() {
}
install() {
- local systemdutildir systemdsystemunitdir
-
- systemdutildir=$(pkg-config systemd --variable=systemdutildir)
- systemdsystemunitdir=$(pkg-config systemd --variable=systemdsystemunitdir)
-
- if ! [[ -d "$systemdutildir" ]]; then
- [[ -d /lib/systemd ]] && systemdutildir=/lib/systemd
- [[ -d /usr/lib/systemd ]] && systemdutildir=/usr/lib/systemd
- fi
- [[ -d "$systemdsystemunitdir" ]] || systemdsystemunitdir=${systemdutildir}/system
-
dracut_install -o "$i" \
$systemdutildir/systemd \
$systemdutildir/systemd-cgroups-agent \