Blame 0005-make-udevdir-systemdutildir-systemdsystemunitdir-glo.patch

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