* [PATCH 1/3] Support old version of module-init-tools
@ 2010-06-09 8:36 Amadeusz Żołnowski
[not found] ` <20100609103605.50a6acec-YdJE6FOikKfe60hTmSeVGxfX6IwIUJvj@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: Amadeusz Żołnowski @ 2010-06-09 8:36 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 3275 bytes --]
modprobe included in version prior to 3.7 of module-init-tools doesn't
have -d | --dirname option which allows to give a prefix other than
'/' for kernel modules path. Dracut assumes existence of that
option and uses it even with default '/'. The patch passes -d option
only if it's different from default and also checks module-init-tools
version if user changes the prefix by --kmoddir Dracut option.
---
dracut | 8 +++++++-
dracut-functions | 44 ++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 49 insertions(+), 3 deletions(-)
diff --git a/dracut b/dracut
index 35be7eb..139d0e0 100755
--- a/dracut
+++ b/dracut
@@ -183,7 +183,13 @@ esac
abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile"
srcmods="/lib/modules/$kernel/"
-[[ $drivers_dir ]] && srcmods="$drivers_dir"
+[[ $drivers_dir ]] && {
+ if verlt $(modprobe --version | cut -d' ' -f3) 3.7; then
+ derror 'To use --kmoddir option module-init-tools >= 3.7 is required.'
+ exit 1
+ fi
+ srcmods="$drivers_dir"
+}
export srcmods
if [[ -f $outfile && ! $force ]]; then
diff --git a/dracut-functions b/dracut-functions
index a76cc22..fbac282 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -24,6 +24,39 @@ IF_dynamic=""
# Generic substring function. If $2 is in $1, return 0.
strstr() { [[ $1 =~ $2 ]]; }
+# Version comparision function. Returns result similar to C strcmp,
+# but instead of -1 is 2. Function assumes version scheme like does
+# Linux kernel.
+vercmp() {
+ local n1 n2 i=1
+
+ while true
+ do
+ n1=$(echo $1 | cut -d'.' -f$i)
+ n2=$(echo $2 | cut -d'.' -f$i)
+
+ [[ ! $n1 && ! $n2 ]] && return 0
+ [[ $n1 -lt $n2 ]] && return 2
+ [[ $n1 -gt $n2 ]] && return 1
+
+ ((i++))
+ done
+}
+
+# Variation of version comparision function. If $1 >= $2, return 0.
+verge() {
+ vercmp $1 $2
+
+ [[ $? = 0 || $? = 1 ]]
+}
+
+# Variation of version comparision function. If $1 < $2, return 0.
+verlt() {
+ vercmp $1 $2
+
+ [[ $? = 2 ]]
+}
+
# Log initrd creation.
if ! [[ $dracutlogfile ]]; then
[[ $dracutbasedir = /usr/share/dracut ]] && \
@@ -487,7 +520,7 @@ filter_kernel_modules () (
# install kernel modules along with all their dependencies.
instmods() {
[[ $no_kernel = yes ]] && return
- local mod mpargs modpath modname cmd
+ local mod mpargs modpath modname cmd moddirname
while (($# > 0)); do
mod=${1%.ko*}
case $mod in
@@ -519,10 +552,17 @@ instmods() {
! echo $add_drivers | grep -qe "\<${mod}\>" && {
shift; continue;
}
+
+ # We use '-d' option in modprobe only if modules prefix path
+ # differs from default '/'. This allows us to use Dracut with
+ # old version of modprobe which doesn't have '-d' option.
+ moddirname=${srcmods%%/lib/modules/*}
+ [[ -n ${moddirname} ]] && moddirname="-d ${moddirname}/"
+
# ok, load the module, all its dependencies, and any firmware
# it may require
for_each_kmod_dep install_kmod_with_fw $mod \
- --set-version $kernel -d ${srcmods%%/lib/modules/*}/
+ --set-version $kernel ${moddirname}
;;
esac
shift
--
1.7.1
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply related [flat|nested] 8+ messages in thread[parent not found: <20100609103605.50a6acec-YdJE6FOikKfe60hTmSeVGxfX6IwIUJvj@public.gmane.org>]
* [PATCH 2/3] 95uswsusp: Gentoo path for 'resume' binary [not found] ` <20100609103605.50a6acec-YdJE6FOikKfe60hTmSeVGxfX6IwIUJvj@public.gmane.org> @ 2010-06-09 8:38 ` Amadeusz Żołnowski [not found] ` <20100609103836.6d14d542-YdJE6FOikKfe60hTmSeVGxfX6IwIUJvj@public.gmane.org> 2010-06-09 10:55 ` [PATCH 1/3] Support old version of module-init-tools Victor Lowther 2010-06-09 15:39 ` Harald Hoyer 2 siblings, 1 reply; 8+ messages in thread From: Amadeusz Żołnowski @ 2010-06-09 8:38 UTC (permalink / raw) To: initramfs-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 904 bytes --] --- modules.d/95uswsusp/check | 2 +- modules.d/95uswsusp/install | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/modules.d/95uswsusp/check b/modules.d/95uswsusp/check index ba95479..4b3f8fb 100755 --- a/modules.d/95uswsusp/check +++ b/modules.d/95uswsusp/check @@ -1,2 +1,2 @@ #!/bin/sh -[ -x /usr/sbin/resume ] +[ -x /usr/sbin/resume ] || [ -x /usr/lib/suspend/resume ] diff --git a/modules.d/95uswsusp/install b/modules.d/95uswsusp/install index f8afe3a..6830763 100755 --- a/modules.d/95uswsusp/install +++ b/modules.d/95uswsusp/install @@ -1,5 +1,10 @@ #!/bin/bash -inst /usr/sbin/resume +for bin in /usr/sbin/resume /usr/lib/suspend/resume +do + [ -x "${bin}" ] && break +done + +inst "${bin}" /usr/sbin/resume [ -f /etc/suspend.conf ] && inst /etc/suspend.conf inst_hook cmdline 10 "$moddir/parse-uswsusp.sh" -- 1.7.1 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply related [flat|nested] 8+ messages in thread
[parent not found: <20100609103836.6d14d542-YdJE6FOikKfe60hTmSeVGxfX6IwIUJvj@public.gmane.org>]
* [PATCH 3/3] 90crypt: 'crypto_LUKS' identifier corrected [not found] ` <20100609103836.6d14d542-YdJE6FOikKfe60hTmSeVGxfX6IwIUJvj@public.gmane.org> @ 2010-06-09 8:40 ` Amadeusz Żołnowski [not found] ` <20100609104031.01d37912-YdJE6FOikKfe60hTmSeVGxfX6IwIUJvj@public.gmane.org> 2010-06-09 15:39 ` [PATCH 2/3] 95uswsusp: Gentoo path for 'resume' binary Harald Hoyer 1 sibling, 1 reply; 8+ messages in thread From: Amadeusz Żołnowski @ 2010-06-09 8:40 UTC (permalink / raw) To: initramfs-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 574 bytes --] --- modules.d/90crypt/check | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/modules.d/90crypt/check b/modules.d/90crypt/check index 07c53f9..7ba499a 100755 --- a/modules.d/90crypt/check +++ b/modules.d/90crypt/check @@ -19,7 +19,7 @@ is_crypt() { [[ $(get_fs_type /dev/block/$1) = crypto_LUKS ]]; } check_block_and_slaves is_crypt "$rootdev" || exit 1 else # root is not on a block device, use the shotgun approach - blkid | grep -q crypt_LUKS || exit 1 + blkid | grep -q 'crypto\?_LUKS' || exit 1 fi } -- 1.7.1 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply related [flat|nested] 8+ messages in thread
[parent not found: <20100609104031.01d37912-YdJE6FOikKfe60hTmSeVGxfX6IwIUJvj@public.gmane.org>]
* Re: [PATCH 3/3] 90crypt: 'crypto_LUKS' identifier corrected [not found] ` <20100609104031.01d37912-YdJE6FOikKfe60hTmSeVGxfX6IwIUJvj@public.gmane.org> @ 2010-06-09 9:04 ` Amadeusz Żołnowski [not found] ` <20100609110405.21e9a39a-YdJE6FOikKfe60hTmSeVGxfX6IwIUJvj@public.gmane.org> 0 siblings, 1 reply; 8+ messages in thread From: Amadeusz Żołnowski @ 2010-06-09 9:04 UTC (permalink / raw) To: initramfs-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 578 bytes --] --- modules.d/90crypt/check | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/modules.d/90crypt/check b/modules.d/90crypt/check index 07c53f9..7ba499a 100755 --- a/modules.d/90crypt/check +++ b/modules.d/90crypt/check @@ -19,7 +19,7 @@ is_crypt() { [[ $(get_fs_type /dev/block/$1) = crypto_LUKS ]]; } check_block_and_slaves is_crypt "$rootdev" || exit 1 else # root is not on a block device, use the shotgun approach - blkid | grep -q crypt_LUKS || exit 1 + blkid | grep -q 'crypto\?_LUKS' || exit 1 fi } -- 1.7.1 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply related [flat|nested] 8+ messages in thread
[parent not found: <20100609110405.21e9a39a-YdJE6FOikKfe60hTmSeVGxfX6IwIUJvj@public.gmane.org>]
* Re: [PATCH 3/3] 90crypt: 'crypto_LUKS' identifier corrected [not found] ` <20100609110405.21e9a39a-YdJE6FOikKfe60hTmSeVGxfX6IwIUJvj@public.gmane.org> @ 2010-06-09 15:40 ` Harald Hoyer 0 siblings, 0 replies; 8+ messages in thread From: Harald Hoyer @ 2010-06-09 15:40 UTC (permalink / raw) To: Amadeusz Żołnowski; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA On 06/09/2010 11:04 AM, Amadeusz Å»oÅ‚nowski wrote: > --- > modules.d/90crypt/check | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/modules.d/90crypt/check b/modules.d/90crypt/check > index 07c53f9..7ba499a 100755 > --- a/modules.d/90crypt/check > +++ b/modules.d/90crypt/check > @@ -19,7 +19,7 @@ is_crypt() { [[ $(get_fs_type /dev/block/$1) = crypto_LUKS ]]; } > check_block_and_slaves is_crypt "$rootdev" || exit 1 > else > # root is not on a block device, use the shotgun approach > - blkid | grep -q crypt_LUKS || exit 1 > + blkid | grep -q 'crypto\?_LUKS' || exit 1 > fi > } > pushed ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] 95uswsusp: Gentoo path for 'resume' binary [not found] ` <20100609103836.6d14d542-YdJE6FOikKfe60hTmSeVGxfX6IwIUJvj@public.gmane.org> 2010-06-09 8:40 ` [PATCH 3/3] 90crypt: 'crypto_LUKS' identifier corrected Amadeusz Żołnowski @ 2010-06-09 15:39 ` Harald Hoyer 1 sibling, 0 replies; 8+ messages in thread From: Harald Hoyer @ 2010-06-09 15:39 UTC (permalink / raw) To: Amadeusz Żołnowski; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA On 06/09/2010 10:38 AM, Amadeusz Żołnowski wrote: > --- > modules.d/95uswsusp/check | 2 +- > modules.d/95uswsusp/install | 7 ++++++- > 2 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/modules.d/95uswsusp/check b/modules.d/95uswsusp/check > index ba95479..4b3f8fb 100755 > --- a/modules.d/95uswsusp/check > +++ b/modules.d/95uswsusp/check > @@ -1,2 +1,2 @@ > #!/bin/sh > -[ -x /usr/sbin/resume ] > +[ -x /usr/sbin/resume ] || [ -x /usr/lib/suspend/resume ] > diff --git a/modules.d/95uswsusp/install b/modules.d/95uswsusp/install > index f8afe3a..6830763 100755 > --- a/modules.d/95uswsusp/install > +++ b/modules.d/95uswsusp/install > @@ -1,5 +1,10 @@ > #!/bin/bash > -inst /usr/sbin/resume > +for bin in /usr/sbin/resume /usr/lib/suspend/resume > +do > + [ -x "${bin}" ]&& break > +done > + > +inst "${bin}" /usr/sbin/resume > [ -f /etc/suspend.conf ]&& inst /etc/suspend.conf > > inst_hook cmdline 10 "$moddir/parse-uswsusp.sh" pushed ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] Support old version of module-init-tools [not found] ` <20100609103605.50a6acec-YdJE6FOikKfe60hTmSeVGxfX6IwIUJvj@public.gmane.org> 2010-06-09 8:38 ` [PATCH 2/3] 95uswsusp: Gentoo path for 'resume' binary Amadeusz Żołnowski @ 2010-06-09 10:55 ` Victor Lowther 2010-06-09 15:39 ` Harald Hoyer 2 siblings, 0 replies; 8+ messages in thread From: Victor Lowther @ 2010-06-09 10:55 UTC (permalink / raw) To: Amadeusz Żołnowski; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA 2010/6/9 Amadeusz Żołnowski <aidecoe-2qtfh70TtYba5EbDDlwbIw@public.gmane.org>: > modprobe included in version prior to 3.7 of module-init-tools doesn't > have -d | --dirname option which allows to give a prefix other than > '/' for kernel modules path. Dracut assumes existence of that > option and uses it even with default '/'. The patch passes -d option > only if it's different from default and also checks module-init-tools > version if user changes the prefix by --kmoddir Dracut option. > --- > dracut | 8 +++++++- > dracut-functions | 44 ++++++++++++++++++++++++++++++++++++++++++-- > 2 files changed, 49 insertions(+), 3 deletions(-) > > diff --git a/dracut b/dracut > index 35be7eb..139d0e0 100755 > --- a/dracut > +++ b/dracut > @@ -183,7 +183,13 @@ esac > abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile" > > srcmods="/lib/modules/$kernel/" > -[[ $drivers_dir ]] && srcmods="$drivers_dir" > +[[ $drivers_dir ]] && { > + if verlt $(modprobe --version | cut -d' ' -f3) 3.7; then > + derror 'To use --kmoddir option module-init-tools >= 3.7 is required.' > + exit 1 > + fi > + srcmods="$drivers_dir" > +} > export srcmods > > if [[ -f $outfile && ! $force ]]; then > diff --git a/dracut-functions b/dracut-functions > index a76cc22..fbac282 100755 > --- a/dracut-functions > +++ b/dracut-functions > @@ -24,6 +24,39 @@ IF_dynamic="" > # Generic substring function. If $2 is in $1, return 0. > strstr() { [[ $1 =~ $2 ]]; } > > +# Version comparision function. Returns result similar to C strcmp, > +# but instead of -1 is 2. Function assumes version scheme like does > +# Linux kernel. > +vercmp() { > + local n1 n2 i=1 > + > + while true > + do > + n1=$(echo $1 | cut -d'.' -f$i) > + n2=$(echo $2 | cut -d'.' -f$i) Ugh, no. We are using bash, no need for that sort of hackery. Just split the passed version strings into arrays using parameter expansion, like so: n1=(${1//./ }) n2=(${2//./ }) > + [[ ! $n1 && ! $n2 ]] && return 0 > + [[ $n1 -lt $n2 ]] && return 2 > + [[ $n1 -gt $n2 ]] && return 1 > + > + ((i++)) > + done and then do the whole thing in an arithmetic for loop: for ((i=0; ;i++)); do [[ ${n1[i]} && ! ${n2[i]} ]] && return 1 [[ ! ${n1[i]} && ${n2[i]} ]] && return 2 [[ ${n1[i]} && ${n2[i]} || return 0 ((${n1[i]} > ${n2[i]})) && return 1 ((${n1[i]} < ${n2[i]})) && return 2 done > +} > + > +# Variation of version comparision function. If $1 >= $2, return 0. > +verge() { > + vercmp $1 $2 > + > + [[ $? = 0 || $? = 1 ]] > +} > + > +# Variation of version comparision function. If $1 < $2, return 0. > +verlt() { > + vercmp $1 $2 > + > + [[ $? = 2 ]] > +} > + > # Log initrd creation. > if ! [[ $dracutlogfile ]]; then > [[ $dracutbasedir = /usr/share/dracut ]] && \ > @@ -487,7 +520,7 @@ filter_kernel_modules () ( > # install kernel modules along with all their dependencies. > instmods() { > [[ $no_kernel = yes ]] && return > - local mod mpargs modpath modname cmd > + local mod mpargs modpath modname cmd moddirname > while (($# > 0)); do > mod=${1%.ko*} > case $mod in > @@ -519,10 +552,17 @@ instmods() { > ! echo $add_drivers | grep -qe "\<${mod}\>" && { > shift; continue; > } > + > + # We use '-d' option in modprobe only if modules prefix path > + # differs from default '/'. This allows us to use Dracut with > + # old version of modprobe which doesn't have '-d' option. > + moddirname=${srcmods%%/lib/modules/*} > + [[ -n ${moddirname} ]] && moddirname="-d ${moddirname}/" > + > # ok, load the module, all its dependencies, and any firmware > # it may require > for_each_kmod_dep install_kmod_with_fw $mod \ > - --set-version $kernel -d ${srcmods%%/lib/modules/*}/ > + --set-version $kernel ${moddirname} > ;; > esac > shift > -- > 1.7.1 > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] Support old version of module-init-tools [not found] ` <20100609103605.50a6acec-YdJE6FOikKfe60hTmSeVGxfX6IwIUJvj@public.gmane.org> 2010-06-09 8:38 ` [PATCH 2/3] 95uswsusp: Gentoo path for 'resume' binary Amadeusz Żołnowski 2010-06-09 10:55 ` [PATCH 1/3] Support old version of module-init-tools Victor Lowther @ 2010-06-09 15:39 ` Harald Hoyer 2 siblings, 0 replies; 8+ messages in thread From: Harald Hoyer @ 2010-06-09 15:39 UTC (permalink / raw) To: Amadeusz Żołnowski; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA On 06/09/2010 10:36 AM, Amadeusz Å»oÅ‚nowski wrote: > modprobe included in version prior to 3.7 of module-init-tools doesn't > have -d | --dirname option which allows to give a prefix other than > '/' for kernel modules path. Dracut assumes existence of that > option and uses it even with default '/'. The patch passes -d option > only if it's different from default and also checks module-init-tools > version if user changes the prefix by --kmoddir Dracut option. > --- pushed ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-06-09 15:40 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-09 8:36 [PATCH 1/3] Support old version of module-init-tools Amadeusz Żołnowski
[not found] ` <20100609103605.50a6acec-YdJE6FOikKfe60hTmSeVGxfX6IwIUJvj@public.gmane.org>
2010-06-09 8:38 ` [PATCH 2/3] 95uswsusp: Gentoo path for 'resume' binary Amadeusz Żołnowski
[not found] ` <20100609103836.6d14d542-YdJE6FOikKfe60hTmSeVGxfX6IwIUJvj@public.gmane.org>
2010-06-09 8:40 ` [PATCH 3/3] 90crypt: 'crypto_LUKS' identifier corrected Amadeusz Żołnowski
[not found] ` <20100609104031.01d37912-YdJE6FOikKfe60hTmSeVGxfX6IwIUJvj@public.gmane.org>
2010-06-09 9:04 ` Amadeusz Żołnowski
[not found] ` <20100609110405.21e9a39a-YdJE6FOikKfe60hTmSeVGxfX6IwIUJvj@public.gmane.org>
2010-06-09 15:40 ` Harald Hoyer
2010-06-09 15:39 ` [PATCH 2/3] 95uswsusp: Gentoo path for 'resume' binary Harald Hoyer
2010-06-09 10:55 ` [PATCH 1/3] Support old version of module-init-tools Victor Lowther
2010-06-09 15:39 ` Harald Hoyer
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.