* [PATCH 1/3] dracut: info which module is sourced; updated dracut usage
@ 2010-07-05 7:06 Amadeusz Żołnowski
2010-07-05 7:08 ` [PATCH 2/3] dracut-functions: info which udev rules are skipped Amadeusz Żołnowski
2010-07-09 13:47 ` [PATCH 1/3] dracut: info which module is sourced; updated dracut usage Harald Hoyer
0 siblings, 2 replies; 9+ messages in thread
From: Amadeusz Żołnowski @ 2010-07-05 7:06 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 1149 bytes --]
Added description for --confdir.
---
dracut | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/dracut b/dracut
index 3be4989..6b590f5 100755
--- a/dracut
+++ b/dracut
@@ -57,6 +57,8 @@ Creates initial ramdisk images for preloading modules
-v, --verbose Verbose output during the build process
-c, --conf [FILE] Specify configuration file to use.
Default: /etc/dracut.conf
+ --confdir [DIR] Specify configuration directory to use *.conf files from.
+ Default: /etc/dracut.conf.d
-l, --local Local mode. Use modules from the current working
directory instead of the system-wide installed in
/usr/share/dracut/modules.d.
@@ -243,6 +245,7 @@ check_modules
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
mod=${moddir##*/}; mod=${mod#[0-9][0-9]}
if strstr "$mods_to_load" " $mod "; then
+ dinfo "*** Sourcing module $mod"
if [[ $kernel_only = yes ]]; then
[[ -x $moddir/installkernel ]] && . "$moddir/installkernel"
else
--
1.7.1
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 2/3] dracut-functions: info which udev rules are skipped
2010-07-05 7:06 [PATCH 1/3] dracut: info which module is sourced; updated dracut usage Amadeusz Żołnowski
@ 2010-07-05 7:08 ` Amadeusz Żołnowski
2010-07-05 7:12 ` [PATCH 3/3] dracut-functions: find_rule a bit smarter Amadeusz Żołnowski
2010-07-09 13:48 ` [PATCH 2/3] dracut-functions: info which udev rules are skipped Harald Hoyer
2010-07-09 13:47 ` [PATCH 1/3] dracut: info which module is sourced; updated dracut usage Harald Hoyer
1 sibling, 2 replies; 9+ messages in thread
From: Amadeusz Żołnowski @ 2010-07-05 7:08 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 638 bytes --]
I found it useful. Maybe help others debugging.
---
dracut-functions | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/dracut-functions b/dracut-functions
index 9c2999a..0caf0d6 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -335,8 +335,9 @@ inst_rules() {
inst_dir "/lib/udev/rules.d"
inst_dir "$target"
for rule in "$@"; do
- rule=$(find_rule "$rule") && \
- inst_simple "$rule" "$target/${rule##*/}"
+ rule1=$(find_rule "$rule") && \
+ inst_simple "$rule1" "$target/${rule1##*/}" \
+ || dinfo "Skipping udev rule: $rule"
done
}
--
1.7.1
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH 3/3] dracut-functions: find_rule a bit smarter
2010-07-05 7:08 ` [PATCH 2/3] dracut-functions: info which udev rules are skipped Amadeusz Żołnowski
@ 2010-07-05 7:12 ` Amadeusz Żołnowski
2010-07-05 9:24 ` Amadeusz Żołnowski
2010-07-09 13:48 ` [PATCH 2/3] dracut-functions: info which udev rules are skipped Harald Hoyer
1 sibling, 1 reply; 9+ messages in thread
From: Amadeusz Żołnowski @ 2010-07-05 7:12 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 1949 bytes --]
btw cosmetic changes to inst_rules
---
dracut-functions | 29 +++++++++++++++++++++++------
1 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/dracut-functions b/dracut-functions
index 0caf0d6..6da36ad 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -319,11 +319,27 @@ inst_symlink() {
inst "$realsrc" && ln -s "$realsrc" "$target"
}
-# find a udev rule in the usual places.
+# find a udev rule in the usual places and try to be smart (just a bit).
+# See example:
+# find_rule default.rules
+# find_rule udev-default.rules
+# find_rule 50-udev-default.rules
+# All of them will return: /lib/udev/rules.d/50-udev-default.rules
find_rule() {
+ local rule
+
[[ -f $1 ]] && { echo "$1"; return 0; }
for r in . /lib/udev/rules.d /etc/udev/rules.d $dracutbasedir/rules.d; do
- [[ -f $r/$1 ]] && { echo "$r/$1"; return 0; }
+ if ls $r/*$1 &>/dev/null; then
+ if [[ -f $r/$1 ]]; then
+ echo "$r/$1"
+ return 0
+ else
+ rule=$(ls "$r"/??"-$1" 2>/dev/null || \
+ ls "$r"/??"-udev-$1" 2>/dev/null)
+ [[ -f $rule ]] && echo $rule && return 0
+ fi
+ fi
done
return 1
}
@@ -331,13 +347,14 @@ find_rule() {
# 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
+ local target=/etc/udev/rules.d rule found
+
inst_dir "/lib/udev/rules.d"
inst_dir "$target"
for rule in "$@"; do
- rule1=$(find_rule "$rule") && \
- inst_simple "$rule1" "$target/${rule1##*/}" \
- || dinfo "Skipping udev rule: $rule"
+ found=$(find_rule "$rule") && \
+ inst_simple "$found" "$target/${found##*/}" \
+ || dinfo "Skipping udev rule: $rule"
done
}
--
1.7.1
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH 3/3] dracut-functions: find_rule a bit smarter
2010-07-05 7:12 ` [PATCH 3/3] dracut-functions: find_rule a bit smarter Amadeusz Żołnowski
@ 2010-07-05 9:24 ` Amadeusz Żołnowski
2010-07-05 14:53 ` Victor Lowther
0 siblings, 1 reply; 9+ messages in thread
From: Amadeusz Żołnowski @ 2010-07-05 9:24 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 1507 bytes --]
Matches rules filename if it's specified without prefix number.
---
dracut-functions | 25 +++++++++++++++++++++++--
1 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/dracut-functions b/dracut-functions
index be6b2e9..1f2528e 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -319,11 +319,32 @@ inst_symlink() {
inst "$realsrc" && ln -s "$realsrc" "$target"
}
-# find a udev rule in the usual places.
+# find a udev rule in the usual places and try to be smart (just a bit).
+# See example:
+# find_rule default.rules
+# find_rule 50-default.rules
+# All of them will return: /lib/udev/rules.d/50-udev-default.rules
+# If there are few matching files, error message is printed.
find_rule() {
+ local rule t
+
[[ -f $1 ]] && { echo "$1"; return 0; }
for r in . /lib/udev/rules.d /etc/udev/rules.d $dracutbasedir/rules.d; do
- [[ -f $r/$1 ]] && { echo "$r/$1"; return 0; }
+ if ls $r/*$1 &>/dev/null; then
+ if [[ -f $r/$1 ]]; then
+ echo "$r/$1"
+ return 0
+ else
+ rule=$(ls "$r"/??"-$1" 2>/dev/null)
+ t=($rule)
+ if (( ${#t[@]} > 1 )); then
+ derror "Ambigous rules filename. Matches: ${t[@]}"
+ elif [[ -f "$rule" ]]; then
+ echo $rule
+ return 0
+ fi
+ fi
+ fi
done
return 1
}
--
1.7.1
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH 3/3] dracut-functions: find_rule a bit smarter
2010-07-05 9:24 ` Amadeusz Żołnowski
@ 2010-07-05 14:53 ` Victor Lowther
[not found] ` <1278341637.4056.17.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
0 siblings, 1 reply; 9+ messages in thread
From: Victor Lowther @ 2010-07-05 14:53 UTC (permalink / raw)
To: Amadeusz Żołnowski; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA
On Mon, 2010-07-05 at 11:24 +0200, Amadeusz Żołnowski wrote:
> Matches rules filename if it's specified without prefix number.
> ---
> dracut-functions | 25 +++++++++++++++++++++++--
> 1 files changed, 23 insertions(+), 2 deletions(-)
>
> diff --git a/dracut-functions b/dracut-functions
> index be6b2e9..1f2528e 100755
> --- a/dracut-functions
> +++ b/dracut-functions
> @@ -319,11 +319,32 @@ inst_symlink() {
> inst "$realsrc" && ln -s "$realsrc" "$target"
> }
>
> -# find a udev rule in the usual places.
> +# find a udev rule in the usual places and try to be smart (just a bit).
> +# See example:
> +# find_rule default.rules
> +# find_rule 50-default.rules
> +# All of them will return: /lib/udev/rules.d/50-udev-default.rules
> +# If there are few matching files, error message is printed.
> find_rule() {
> + local rule t
> +
> [[ -f $1 ]] && { echo "$1"; return 0; }
> for r in . /lib/udev/rules.d /etc/udev/rules.d $dracutbasedir/rules.d; do
# Parsing the output of ls can lead to strange and subtle bugs.
# Use globbing and parameter expansion instead, and go with the first
# matching file.
local f
for f in "$r/$1" "$r/${1%%-*}-udev-%{1##*-}" "$r/"*"$1"; do
[[ -f $f ]] || continue
echo "$f"
return 0
> done
> return 1
> }
--
Victor Lowther
LPIC2 UCP RHCE
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] dracut-functions: info which udev rules are skipped
2010-07-05 7:08 ` [PATCH 2/3] dracut-functions: info which udev rules are skipped Amadeusz Żołnowski
2010-07-05 7:12 ` [PATCH 3/3] dracut-functions: find_rule a bit smarter Amadeusz Żołnowski
@ 2010-07-09 13:48 ` Harald Hoyer
1 sibling, 0 replies; 9+ messages in thread
From: Harald Hoyer @ 2010-07-09 13:48 UTC (permalink / raw)
To: Amadeusz Żołnowski; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA
On 07/05/2010 09:08 AM, Amadeusz Żołnowski wrote:
> I found it useful. Maybe help others debugging.
> ---
> dracut-functions | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/dracut-functions b/dracut-functions
> index 9c2999a..0caf0d6 100755
> --- a/dracut-functions
> +++ b/dracut-functions
> @@ -335,8 +335,9 @@ inst_rules() {
> inst_dir "/lib/udev/rules.d"
> inst_dir "$target"
> for rule in "$@"; do
> - rule=$(find_rule "$rule")&& \
> - inst_simple "$rule" "$target/${rule##*/}"
> + rule1=$(find_rule "$rule")&& \
> + inst_simple "$rule1" "$target/${rule1##*/}" \
> + || dinfo "Skipping udev rule: $rule"
> done
> }
>
pushed
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] dracut: info which module is sourced; updated dracut usage
2010-07-05 7:06 [PATCH 1/3] dracut: info which module is sourced; updated dracut usage Amadeusz Żołnowski
2010-07-05 7:08 ` [PATCH 2/3] dracut-functions: info which udev rules are skipped Amadeusz Żołnowski
@ 2010-07-09 13:47 ` Harald Hoyer
1 sibling, 0 replies; 9+ messages in thread
From: Harald Hoyer @ 2010-07-09 13:47 UTC (permalink / raw)
To: Amadeusz Żołnowski; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA
On 07/05/2010 09:06 AM, Amadeusz Żołnowski wrote:
> Added description for --confdir.
> ---
> dracut | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/dracut b/dracut
> index 3be4989..6b590f5 100755
> --- a/dracut
> +++ b/dracut
> @@ -57,6 +57,8 @@ Creates initial ramdisk images for preloading modules
> -v, --verbose Verbose output during the build process
> -c, --conf [FILE] Specify configuration file to use.
> Default: /etc/dracut.conf
> + --confdir [DIR] Specify configuration directory to use *.conf files from.
> + Default: /etc/dracut.conf.d
> -l, --local Local mode. Use modules from the current working
> directory instead of the system-wide installed in
> /usr/share/dracut/modules.d.
> @@ -243,6 +245,7 @@ check_modules
> for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
> mod=${moddir##*/}; mod=${mod#[0-9][0-9]}
> if strstr "$mods_to_load" " $mod "; then
> + dinfo "*** Sourcing module $mod"
> if [[ $kernel_only = yes ]]; then
> [[ -x $moddir/installkernel ]]&& . "$moddir/installkernel"
> else
pushed
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-07-09 13:48 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-05 7:06 [PATCH 1/3] dracut: info which module is sourced; updated dracut usage Amadeusz Żołnowski
2010-07-05 7:08 ` [PATCH 2/3] dracut-functions: info which udev rules are skipped Amadeusz Żołnowski
2010-07-05 7:12 ` [PATCH 3/3] dracut-functions: find_rule a bit smarter Amadeusz Żołnowski
2010-07-05 9:24 ` Amadeusz Żołnowski
2010-07-05 14:53 ` Victor Lowther
[not found] ` <1278341637.4056.17.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-07-07 9:19 ` Amadeusz Żołnowski
2010-07-07 10:27 ` [PATCH] dracut-functions: find_rule a bit smarter; thanks to V. Lowther Amadeusz Żołnowski
2010-07-09 13:48 ` [PATCH 2/3] dracut-functions: info which udev rules are skipped Harald Hoyer
2010-07-09 13:47 ` [PATCH 1/3] dracut: info which module is sourced; updated dracut usage Harald Hoyer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox