|
Harald Hoyer |
3957aa |
From 62073c30484f3fc4b657d6939bec9ac5a4ecf8c5 Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
3957aa |
From: Colin Guthrie <colin@mageia.org>
|
|
Harald Hoyer |
3957aa |
Date: Sat, 17 Dec 2011 00:35:08 +0000
|
|
Harald Hoyer |
3957aa |
Subject: [PATCH] udev: Attempt to install any programs used by udev rules.
|
|
Harald Hoyer |
3957aa |
|
|
Harald Hoyer |
3957aa |
---
|
|
Harald Hoyer |
3957aa |
dracut-functions | 23 +++++++++++++++++++++++
|
|
Harald Hoyer |
3957aa |
1 files changed, 23 insertions(+), 0 deletions(-)
|
|
Harald Hoyer |
3957aa |
|
|
Harald Hoyer |
3957aa |
diff --git a/dracut-functions b/dracut-functions
|
|
Harald Hoyer |
3957aa |
index d95df14..8944430 100755
|
|
Harald Hoyer |
3957aa |
--- a/dracut-functions
|
|
Harald Hoyer |
3957aa |
+++ b/dracut-functions
|
|
Harald Hoyer |
3957aa |
@@ -516,6 +516,27 @@ inst_symlink() {
|
|
Harald Hoyer |
3957aa |
fi
|
|
Harald Hoyer |
3957aa |
}
|
|
Harald Hoyer |
3957aa |
|
|
Harald Hoyer |
3957aa |
+# attempt to install any programs specified in a udev rule
|
|
Harald Hoyer |
3957aa |
+inst_rule_programs() {
|
|
Harald Hoyer |
3957aa |
+ local _prog _bin
|
|
Harald Hoyer |
3957aa |
+
|
|
Harald Hoyer |
3957aa |
+ if grep -qE 'PROGRAM==?"[^ "]+' "$1"; then
|
|
Harald Hoyer |
3957aa |
+ for _prog in $(grep -E 'PROGRAM==?"[^ "]+' "$1" | sed -r 's/.*PROGRAM==?"([^ "]+).*/\1/'); do
|
|
Harald Hoyer |
3957aa |
+ if [ -x /lib/udev/$_prog ]; then
|
|
Harald Hoyer |
3957aa |
+ _bin=/lib/udev/$_prog
|
|
Harald Hoyer |
3957aa |
+ else
|
|
Harald Hoyer |
3957aa |
+ _bin=$(find_binary "$_prog") || {
|
|
Harald Hoyer |
3957aa |
+ dinfo "Skipping program $_prog using in udev rule $(basename $1) as it cannot be found"
|
|
Harald Hoyer |
3957aa |
+ continue;
|
|
Harald Hoyer |
3957aa |
+ }
|
|
Harald Hoyer |
3957aa |
+ fi
|
|
Harald Hoyer |
3957aa |
+
|
|
Harald Hoyer |
3957aa |
+ #dinfo "Installing $_bin due to it's use in the udev rule $(basename $1)"
|
|
Harald Hoyer |
3957aa |
+ dracut_install "$_bin"
|
|
Harald Hoyer |
3957aa |
+ done
|
|
Harald Hoyer |
3957aa |
+ fi
|
|
Harald Hoyer |
3957aa |
+}
|
|
Harald Hoyer |
3957aa |
+
|
|
Harald Hoyer |
3957aa |
# udev rules always get installed in the same place, so
|
|
Harald Hoyer |
3957aa |
# create a function to install them to make life simpler.
|
|
Harald Hoyer |
3957aa |
inst_rules() {
|
|
Harald Hoyer |
3957aa |
@@ -529,6 +550,7 @@ inst_rules() {
|
|
Harald Hoyer |
3957aa |
if [[ -f $r/$_rule ]]; then
|
|
Harald Hoyer |
3957aa |
_found="$r/$_rule"
|
|
Harald Hoyer |
3957aa |
inst_simple "$_found"
|
|
Harald Hoyer |
3957aa |
+ inst_rule_programs "$_found"
|
|
Harald Hoyer |
3957aa |
fi
|
|
Harald Hoyer |
3957aa |
done
|
|
Harald Hoyer |
3957aa |
fi
|
|
Harald Hoyer |
3957aa |
@@ -536,6 +558,7 @@ inst_rules() {
|
|
Harald Hoyer |
3957aa |
if [[ -f ${r}$_rule ]]; then
|
|
Harald Hoyer |
3957aa |
_found="${r}$_rule"
|
|
Harald Hoyer |
3957aa |
inst_simple "$_found" "$_target/${_found##*/}"
|
|
Harald Hoyer |
3957aa |
+ inst_rule_programs "$_found"
|
|
Harald Hoyer |
3957aa |
fi
|
|
Harald Hoyer |
3957aa |
done
|
|
Harald Hoyer |
3957aa |
[[ $_found ]] || dinfo "Skipping udev rule: $_rule"
|