FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux General Discussion

 
 
LinkBack Thread Tools
 
Old 09-20-2010, 12:47 AM
Dave Reisner
 
Default rc.sysinit: only call modprobe once

Use modprobe -a and a bash PE to filter the MODULES array.

Signed-off-by: Dave Reisner <d@falconindy.com>
---
rc.sysinit | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/rc.sysinit b/rc.sysinit
index 09d5e97..07180d0 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -94,11 +94,7 @@ fi
# Load modules from the MODULES array defined in rc.conf
if [[ $load_modules != off && -f /proc/modules ]]; then
stat_busy "Loading Modules"
- for mod in "${MODULES[@]}"; do
- if [[ $mod = ${mod#!} ]]; then
- /sbin/modprobe $mod
- fi
- done
+ /sbin/modprobe -a "${MODULES[@]/!*/}"
stat_done
fi

--
1.7.2.3
 
Old 09-20-2010, 01:52 AM
Dave Reisner
 
Default rc.sysinit: only call modprobe once

On Sun, Sep 19, 2010 at 08:47:03PM -0400, Dave Reisner wrote:
> Use modprobe -a and a bash PE to filter the MODULES array.
>
> Signed-off-by: Dave Reisner <d@falconindy.com>
> ---
> rc.sysinit | 6 +-----
> 1 files changed, 1 insertions(+), 5 deletions(-)
>
> diff --git a/rc.sysinit b/rc.sysinit
> index 09d5e97..07180d0 100755
> --- a/rc.sysinit
> +++ b/rc.sysinit
> @@ -94,11 +94,7 @@ fi
> # Load modules from the MODULES array defined in rc.conf
> if [[ $load_modules != off && -f /proc/modules ]]; then
> stat_busy "Loading Modules"
> - for mod in "${MODULES[@]}"; do
> - if [[ $mod = ${mod#!} ]]; then
> - /sbin/modprobe $mod
> - fi
> - done
> + /sbin/modprobe -a "${MODULES[@]/!*/}"
> stat_done
> fi
>
> --
> 1.7.2.3
>

Seems I've forgotten about the null case here. Disregard this, I'll
resend.
 
Old 09-20-2010, 01:54 AM
Dave Reisner
 
Default rc.sysinit: only call modprobe once

Use modprobe -a and a bash PE to filter the MODULES array.

Signed-off-by: Dave Reisner <d@falconindy.com>
---
rc.sysinit | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/rc.sysinit b/rc.sysinit
index 09d5e97..4b6e1e7 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -92,14 +92,10 @@ if /bin/pidof -o %PPID /sbin/udevd >/dev/null; then
fi

# Load modules from the MODULES array defined in rc.conf
-if [[ $load_modules != off && -f /proc/modules ]]; then
- stat_busy "Loading Modules"
- for mod in "${MODULES[@]}"; do
- if [[ $mod = ${mod#!} ]]; then
- /sbin/modprobe $mod
- fi
- done
- stat_done
+if [[ $load_modules != off && -f /proc/modules ]] && (( ${#MODULES[@]} > 0 )); then
+ stat_busy "Loading Modules"
+ /sbin/modprobe -a "${MODULES[@]/#!*/}"
+ stat_done
fi

# Wait for udev uevents
--
1.7.2.3
 
Old 09-20-2010, 01:57 AM
"Allan McRae"
 
Default rc.sysinit: only call modprobe once

On 20/09/10 11:54, Dave Reisner wrote:

Use modprobe -a and a bash PE to filter the MODULES array.

Signed-off-by: Dave Reisner<d@falconindy.com>
---
rc.sysinit | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/rc.sysinit b/rc.sysinit
index 09d5e97..4b6e1e7 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -92,14 +92,10 @@ if /bin/pidof -o %PPID /sbin/udevd>/dev/null; then
fi

# Load modules from the MODULES array defined in rc.conf
-if [[ $load_modules != off&& -f /proc/modules ]]; then
- stat_busy "Loading Modules"
- for mod in "${MODULES[@]}"; do
- if [[ $mod = ${mod#!} ]]; then
- /sbin/modprobe $mod
- fi
- done
- stat_done
+if [[ $load_modules != off&& -f /proc/modules ]]&& (( ${#MODULES[@]}> 0 )); then
+ stat_busy "Loading Modules"
+ /sbin/modprobe -a "${MODULES[@]/#!*/}"
+ stat_done
fi

# Wait for udev uevents


Does this still work in the "null" case where there is only modules
specified with "!" in the front?


Allan
 
Old 09-20-2010, 02:10 AM
Dave Reisner
 
Default rc.sysinit: only call modprobe once

On Mon, Sep 20, 2010 at 11:57:06AM +1000, Allan McRae wrote:
> On 20/09/10 11:54, Dave Reisner wrote:
> >Use modprobe -a and a bash PE to filter the MODULES array.
> >
> >Signed-off-by: Dave Reisner<d@falconindy.com>
> >---
> > rc.sysinit | 12 ++++--------
> > 1 files changed, 4 insertions(+), 8 deletions(-)
> >
> >diff --git a/rc.sysinit b/rc.sysinit
> >index 09d5e97..4b6e1e7 100755
> >--- a/rc.sysinit
> >+++ b/rc.sysinit
> >@@ -92,14 +92,10 @@ if /bin/pidof -o %PPID /sbin/udevd>/dev/null; then
> > fi
> >
> > # Load modules from the MODULES array defined in rc.conf
> >-if [[ $load_modules != off&& -f /proc/modules ]]; then
> >- stat_busy "Loading Modules"
> >- for mod in "${MODULES[@]}"; do
> >- if [[ $mod = ${mod#!} ]]; then
> >- /sbin/modprobe $mod
> >- fi
> >- done
> >- stat_done
> >+if [[ $load_modules != off&& -f /proc/modules ]]&& (( ${#MODULES[@]}> 0 )); then
> >+ stat_busy "Loading Modules"
> >+ /sbin/modprobe -a "${MODULES[@]/#!*/}"
> >+ stat_done
> > fi
> >
> > # Wait for udev uevents
>
> Does this still work in the "null" case where there is only modules
> specified with "!" in the front?
>
> Allan
>

Excellent observation -- it would not. Counting the size of the array
with the PE in place isn't possible (or desirable), either. Perhaps a
more graceful solution is to reassign the output of the PE to a new
array and operate based on that. Certainly still beats calling modprobe
for every element in the array, imo.

d
 
Old 09-20-2010, 03:39 PM
"Kurt J. Bosch"
 
Default rc.sysinit: only call modprobe once

2010-09-20 04:10, Dave Reisner:

On Mon, Sep 20, 2010 at 11:57:06AM +1000, Allan McRae wrote:

On 20/09/10 11:54, Dave Reisner wrote:

Use modprobe -a and a bash PE to filter the MODULES array.

Signed-off-by: Dave Reisner<d@falconindy.com>
---
rc.sysinit | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/rc.sysinit b/rc.sysinit
index 09d5e97..4b6e1e7 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -92,14 +92,10 @@ if /bin/pidof -o %PPID /sbin/udevd>/dev/null; then
fi

# Load modules from the MODULES array defined in rc.conf
-if [[ $load_modules != off&& -f /proc/modules ]]; then
- stat_busy "Loading Modules"
- for mod in "${MODULES[@]}"; do
- if [[ $mod = ${mod#!} ]]; then
- /sbin/modprobe $mod
- fi
- done
- stat_done
+if [[ $load_modules != off&& -f /proc/modules ]]&& (( ${#MODULES[@]}> 0 )); then
+ stat_busy "Loading Modules"
+ /sbin/modprobe -a "${MODULES[@]/#!*/}"
+ stat_done
fi

# Wait for udev uevents


Does this still work in the "null" case where there is only modules
specified with "!" in the front?

Allan



Excellent observation -- it would not. Counting the size of the array
with the PE in place isn't possible (or desirable), either. Perhaps a
more graceful solution is to reassign the output of the PE to a new
array and operate based on that. Certainly still beats calling modprobe
for every element in the array, imo.

d



I think it could be done like so:

From 6465c90fc851b12cfce791228415ae1c2823e050 Mon Sep 17 00:00:00 2001
From: Kurt J. Bosch <kjb-temp-2009@alpenjodel.de>
Date: Mon, 20 Sep 2010 17:31:54 +0200
Subject: [PATCH] rc.sysinit: only call modprobe once (as proposed by
Dave Reisner)


---
rc.sysinit | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/rc.sysinit b/rc.sysinit
index 09d5e97..07b3f67 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -92,13 +92,10 @@ if /bin/pidof -o %PPID /sbin/udevd >/dev/null; then
fi

# Load modules from the MODULES array defined in rc.conf
-if [[ $load_modules != off && -f /proc/modules ]]; then
+modules=$( echo ${MODULES[*]/!*/} )
+if [[ $modules && $load_modules != off && -f /proc/modules ]]; then
stat_busy "Loading Modules"
- for mod in "${MODULES[@]}"; do
- if [[ $mod = ${mod#!} ]]; then
- /sbin/modprobe $mod
- fi
- done
+ /sbin/modprobe -a $modules
stat_done
fi

--
1.7.0.3
 
Old 09-20-2010, 03:56 PM
Dave Reisner
 
Default rc.sysinit: only call modprobe once

On Mon, Sep 20, 2010 at 05:39:25PM +0200, Kurt J. Bosch wrote:
> 2010-09-20 04:10, Dave Reisner:
> >On Mon, Sep 20, 2010 at 11:57:06AM +1000, Allan McRae wrote:
> >>On 20/09/10 11:54, Dave Reisner wrote:
> >>>Use modprobe -a and a bash PE to filter the MODULES array.
> >>>
> >>>Signed-off-by: Dave Reisner<d@falconindy.com>
> >>>---
> >>> rc.sysinit | 12 ++++--------
> >>> 1 files changed, 4 insertions(+), 8 deletions(-)
> >>>
> >>>diff --git a/rc.sysinit b/rc.sysinit
> >>>index 09d5e97..4b6e1e7 100755
> >>>--- a/rc.sysinit
> >>>+++ b/rc.sysinit
> >>>@@ -92,14 +92,10 @@ if /bin/pidof -o %PPID /sbin/udevd>/dev/null; then
> >>> fi
> >>>
> >>> # Load modules from the MODULES array defined in rc.conf
> >>>-if [[ $load_modules != off&& -f /proc/modules ]]; then
> >>>- stat_busy "Loading Modules"
> >>>- for mod in "${MODULES[@]}"; do
> >>>- if [[ $mod = ${mod#!} ]]; then
> >>>- /sbin/modprobe $mod
> >>>- fi
> >>>- done
> >>>- stat_done
> >>>+if [[ $load_modules != off&& -f /proc/modules ]]&& (( ${#MODULES[@]}> 0 )); then
> >>>+ stat_busy "Loading Modules"
> >>>+ /sbin/modprobe -a "${MODULES[@]/#!*/}"
> >>>+ stat_done
> >>> fi
> >>>
> >>> # Wait for udev uevents
> >>
> >>Does this still work in the "null" case where there is only modules
> >>specified with "!" in the front?
> >>
> >>Allan
> >>
> >
> >Excellent observation -- it would not. Counting the size of the array
> >with the PE in place isn't possible (or desirable), either. Perhaps a
> >more graceful solution is to reassign the output of the PE to a new
> >array and operate based on that. Certainly still beats calling modprobe
> >for every element in the array, imo.
> >
> >d
> >
>
> I think it could be done like so:
>
> From 6465c90fc851b12cfce791228415ae1c2823e050 Mon Sep 17 00:00:00 2001
> From: Kurt J. Bosch <kjb-temp-2009@alpenjodel.de>
> Date: Mon, 20 Sep 2010 17:31:54 +0200
> Subject: [PATCH] rc.sysinit: only call modprobe once (as proposed by
> Dave Reisner)
>
> ---
> rc.sysinit | 9 +++------
> 1 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/rc.sysinit b/rc.sysinit
> index 09d5e97..07b3f67 100755
> --- a/rc.sysinit
> +++ b/rc.sysinit
> @@ -92,13 +92,10 @@ if /bin/pidof -o %PPID /sbin/udevd >/dev/null; then
> fi
>
> # Load modules from the MODULES array defined in rc.conf
> -if [[ $load_modules != off && -f /proc/modules ]]; then
> +modules=$( echo ${MODULES[*]/!*/} )
> +if [[ $modules && $load_modules != off && -f /proc/modules ]]; then
> stat_busy "Loading Modules"
> - for mod in "${MODULES[@]}"; do
> - if [[ $mod = ${mod#!} ]]; then
> - /sbin/modprobe $mod
> - fi
> - done
> + /sbin/modprobe -a $modules
> stat_done
> fi
>
> --
> 1.7.0.3
>

Your echo is redundant. Just quote the expansion and assign it.

modules="${MODULES[@]/#!*}"

I think we're a looooong way away from the day when there's a '!' as
part of a module name, but I think it's probably best to anchor the
expression to the start of each element regardless.

d
 
Old 09-20-2010, 08:22 PM
"Kurt J. Bosch"
 
Default rc.sysinit: only call modprobe once

2010-09-20 17:56, Dave Reisner:

On Mon, Sep 20, 2010 at 05:39:25PM +0200, Kurt J. Bosch wrote:

2010-09-20 04:10, Dave Reisner:

On Mon, Sep 20, 2010 at 11:57:06AM +1000, Allan McRae wrote:

On 20/09/10 11:54, Dave Reisner wrote:

Use modprobe -a and a bash PE to filter the MODULES array.

Signed-off-by: Dave Reisner<d@falconindy.com>
---
rc.sysinit | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/rc.sysinit b/rc.sysinit
index 09d5e97..4b6e1e7 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -92,14 +92,10 @@ if /bin/pidof -o %PPID /sbin/udevd>/dev/null; then
fi

# Load modules from the MODULES array defined in rc.conf
-if [[ $load_modules != off&& -f /proc/modules ]]; then
- stat_busy "Loading Modules"
- for mod in "${MODULES[@]}"; do
- if [[ $mod = ${mod#!} ]]; then
- /sbin/modprobe $mod
- fi
- done
- stat_done
+if [[ $load_modules != off&& -f /proc/modules ]]&& (( ${#MODULES[@]}> 0 )); then
+ stat_busy "Loading Modules"
+ /sbin/modprobe -a "${MODULES[@]/#!*/}"
+ stat_done
fi

# Wait for udev uevents


Does this still work in the "null" case where there is only modules
specified with "!" in the front?

Allan



Excellent observation -- it would not. Counting the size of the array
with the PE in place isn't possible (or desirable), either. Perhaps a
more graceful solution is to reassign the output of the PE to a new
array and operate based on that. Certainly still beats calling modprobe
for every element in the array, imo.

d



I think it could be done like so:

From 6465c90fc851b12cfce791228415ae1c2823e050 Mon Sep 17 00:00:00 2001
From: Kurt J. Bosch<kjb-temp-2009@alpenjodel.de>
Date: Mon, 20 Sep 2010 17:31:54 +0200
Subject: [PATCH] rc.sysinit: only call modprobe once (as proposed by
Dave Reisner)

---
rc.sysinit | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/rc.sysinit b/rc.sysinit
index 09d5e97..07b3f67 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -92,13 +92,10 @@ if /bin/pidof -o %PPID /sbin/udevd>/dev/null; then
fi

# Load modules from the MODULES array defined in rc.conf
-if [[ $load_modules != off&& -f /proc/modules ]]; then
+modules=$( echo ${MODULES[*]/!*/} )
+if [[ $modules&& $load_modules != off&& -f /proc/modules ]]; then
stat_busy "Loading Modules"
- for mod in "${MODULES[@]}"; do
- if [[ $mod = ${mod#!} ]]; then
- /sbin/modprobe $mod
- fi
- done
+ /sbin/modprobe -a $modules
stat_done
fi

--
1.7.0.3



Your echo is redundant. Just quote the expansion and assign it.


NAK. Try this:
MODULES=( '!foo' '!bar' )
modules="${MODULES[@]/#!*}"
[[ $modules ]] && echo "'$modules' is not a null string"
' ' is not a null string


modules="${MODULES[@]/#!*}"

I think we're a looooong way away from the day when there's a '!' as
part of a module name, but I think it's probably best to anchor the
expression to the start of each element regardless.

OK, but the quotes aren't needed because word splitting is not performed
here. So we finally get:


modules=$( echo ${MODULES[@]/#!*} )

--
Kurt



Mon Sep 20 23:30:02 2010
Return-path: <gentoo-desktop+bounces-1700-tom=linux-archive.org@lists.gentoo.org>
Envelope-to: tom@linux-archive.org
Delivery-date: Mon, 20 Sep 2010 22:36:55 +0300
Received: from pigeon.gentoo.org ([208.92.234.80]:58404 helo=lists.gentoo.org)
by s2.java-tips.org with esmtps (TLSv1:AES256-SHA:256)
(Exim 4.69)
(envelope-from <gentoo-desktop+bounces-1700-tom=linux-archive.org@lists.gentoo.org>)
id 1OxmAZ-0008UN-K1
for tom@linux-archive.org; Mon, 20 Sep 2010 22:36:55 +0300
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
by pigeon.gentoo.org (Postfix) with SMTP id F2A4FE09EA;
Mon, 20 Sep 2010 20:27:20 +0000 (UTC)
X-Original-To: gentoo-desktop@lists.gentoo.org
Delivered-To: gentoo-desktop@lists.gentoo.org
Received: from smtp1.kolej.mff.cuni.cz (smtp1.kolej.mff.cuni.cz [78.128.192.10])
by pigeon.gentoo.org (Postfix) with ESMTP id 933CDE09EA
for <gentoo-desktop@lists.gentoo.org>; Mon, 20 Sep 2010 20:27:20 +0000 (UTC)
X-Envelope-From: xificurk@gmail.com
Received: from [78.128.196.17] (xificurk.kolej.mff.cuni.cz [78.128.196.17])
by smtp1.kolej.mff.cuni.cz (8.14.4/8.14.4) with ESMTP id o8KKRIWP090121
for <gentoo-desktop@lists.gentoo.org>; Mon, 20 Sep 2010 22:27:19 +0200 (CEST)
(envelope-from xificurk@gmail.com)
Message-ID: <4C97C39D.50405@gmail.com>
Date: Mon, 20 Sep 2010 22:27:09 +0200
From: =?UTF-8?B?IlBldHIgTW9yw6F2ZWsgW1hpZmljdXJrXSI=?=
<xificurk@gmail.com>
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; cs; rv:1.9.1.11) Gecko/20100810 Gentoo/2.0.6 SeaMonkey/2.0.6
Precedence: bulk
List-Post: <mailto:gentoo-desktop@lists.gentoo.org>
List-Help: <mailto:gentoo-desktop+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-desktop+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-desktop+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-desktop.gentoo.org>
X-BeenThere: gentoo-desktop@lists.gentoo.org
Reply-to: gentoo-desktop@lists.gentoo.org
MIME-Version: 1.0
To: gentoo-desktop@lists.gentoo.org
Subject: Re: [gentoo-desktop] [kde-sunset] KDE/Trinity 3.5.12 inside or outside
sunset
References: <AANLkTinGLw-Fihh1+0pe6bEmzT5r9WgAWWus7B_yhtop@mail.gmail.com>
In-Reply-To: <AANLkTinGLw-Fihh1+0pe6bEmzT5r9WgAWWus7B_yhtop@mail.gmail.com>
X-Enigmail-Version: 1.0.1
OpenPGP: id=85252A70
Content-Type: multipart/signed; micalg=pgp-sha1;
protocol="application/pgp-signature";
boundary="------------enig8DECF35AF46561F82C0B3E1D"

This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig8DECF35AF46561F82C0B3E1D
Content-Type: multipart/mixed;
boundary="------------040800010502030401040108"

This is a multi-part message in MIME format.
--------------040800010502030401040108
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Personally, I don't see much point in creating a new overlay since it
would be most probably used by the same users as kde-sunset. We can
still keep old ebuilds of latest official KDE3 packages there and in the
same time add "new" releases of TDE.

Petr

Ladislav Laska napsal(a):

Hello,
=20
I'd like to ask, what do you think of trinity project? The 3.5.12
release is relatively near and I'd like to start discussion wether to
incorporate it into sunset, or develop it in separate overlay.
=20
I originally intended to do it in sunset, but now I'm not sure. The
development seems to be pretty serious and maybe it won't be sunset
anymore - I'd say we should create something like kde-resurrection.
:-)
=20
What do you think?
=20
Regards Ladislav Laska
S pozdravem Ladislav Laska
---
xmpp/jabber: ladislav.laska@jabber.cz
=20


--------------040800010502030401040108
Content-Type: text/x-vcard; charset=utf-8;
name="xificurk.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="xificurk.vcf"

YmVnaW46dmNhcmQNCmZuO3F1b3RlZC1wcmludGFibGU6UGV0ci BNb3I9QzM9QTF2ZWsNCm47
cXVvdGVkLXByaW50YWJsZTpNb3I9QzM9QTF2ZWs7UGV0cg0Kb3 JnO3F1b3RlZC1wcmludGFi
bGU6VW5pdmVyeml0YSBLYXJsb3ZhO01hdGVtYXRpY2tvLWZ5em lrPUMzPUExbG49QzM9QUQg
ZmFrdWx0YQ0KZW1haWw7aW50ZXJuZXQ6eGlmaWN1cmtAZ21haW wuY29tDQp0aXRsZTpTdHVk
ZW50DQp0ZWw7Y2VsbDorNDIwNzc1Mjc3NTA3DQpub3RlOmphYm JlcjogeGlmaWN1cmtAZ21h
aWwuY29tDQp4LW1vemlsbGEtaHRtbDpGQUxTRQ0KdXJsOmh0dH A6Ly93d3cubWZmLmN1bmku
Y3oNCnZlcnNpb246Mi4xDQplbmQ6dmNhcmQNCg0K
--------------040800010502030401040108--

--------------enig8DECF35AF46561F82C0B3E1D
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)
Comment: Using GnuPG with Gentoo - http://enigmail.mozdev.org/

iEYEARECAAYFAkyXw6YACgkQgqaYbboLnUUsTQCgnznDblwVzx fybDRLMoCsD3uh
D5UAoLC0aJnN6C6bPYVZG1P+RuAgZhG3
=mt8B
-----END PGP SIGNATURE-----

--------------enig8DECF35AF46561F82C0B3E1D--
 
Old 09-20-2010, 08:46 PM
Tavian Barnes
 
Default rc.sysinit: only call modprobe once

On 20 September 2010 16:22, Kurt J. Bosch <kjb-temp-2009@alpenjodel.de> wrote:
> 2010-09-20 17:56, Dave Reisner:
>>
>> On Mon, Sep 20, 2010 at 05:39:25PM +0200, Kurt J. Bosch wrote:
>>>
>>> 2010-09-20 04:10, Dave Reisner:
>>>>
>>>> On Mon, Sep 20, 2010 at 11:57:06AM +1000, Allan McRae wrote:
>>>>>
>>>>> On 20/09/10 11:54, Dave Reisner wrote:
>>>>>>
>>>>>> Use modprobe -a and a bash PE to filter the MODULES array.
>>>>>>
>>>>>> Signed-off-by: Dave Reisner<d@falconindy.com>
>>>>>> ---
>>>>>> *rc.sysinit | * 12 ++++--------
>>>>>> *1 files changed, 4 insertions(+), 8 deletions(-)
>>>>>>
>>>>>> diff --git a/rc.sysinit b/rc.sysinit
>>>>>> index 09d5e97..4b6e1e7 100755
>>>>>> --- a/rc.sysinit
>>>>>> +++ b/rc.sysinit
>>>>>> @@ -92,14 +92,10 @@ if /bin/pidof -o %PPID /sbin/udevd>/dev/null; then
>>>>>> *fi
>>>>>>
>>>>>> *# Load modules from the MODULES array defined in rc.conf
>>>>>> -if [[ $load_modules != off&& * *-f /proc/modules ]]; then
>>>>>> - * *stat_busy "Loading Modules"
>>>>>> - * *for mod in "${MODULES[@]}"; do
>>>>>> - * * * if [[ $mod = ${mod#!} ]]; then
>>>>>> - * * * * * /sbin/modprobe $mod
>>>>>> - * * * fi
>>>>>> - * *done
>>>>>> - * *stat_done
>>>>>> +if [[ $load_modules != off&& * *-f /proc/modules ]]&& * *((
>>>>>> ${#MODULES[@]}> * *0 )); then
>>>>>> + * * * stat_busy "Loading Modules"
>>>>>> + * * * * * * * /sbin/modprobe -a "${MODULES[@]/#!*/}"
>>>>>> + * * * stat_done
>>>>>> *fi
>>>>>>
>>>>>> *# Wait for udev uevents
>>>>>
>>>>> Does this still work in the "null" case where there is only modules
>>>>> specified with "!" in the front?
>>>>>
>>>>> Allan
>>>>>
>>>>
>>>> Excellent observation -- it would not. Counting the size of the array
>>>> with the PE in place isn't possible (or desirable), either. Perhaps a
>>>> more graceful solution is to reassign the output of the PE to a new
>>>> array and operate based on that. Certainly still beats calling modprobe
>>>> for every element in the array, imo.
>>>>
>>>> d
>>>>
>>>
>>> I think it could be done like so:
>>>
>>> *From 6465c90fc851b12cfce791228415ae1c2823e050 Mon Sep 17 00:00:00 2001
>>> From: Kurt J. Bosch<kjb-temp-2009@alpenjodel.de>
>>> Date: Mon, 20 Sep 2010 17:31:54 +0200
>>> Subject: [PATCH] rc.sysinit: only call modprobe once (as proposed by
>>> Dave Reisner)
>>>
>>> ---
>>> *rc.sysinit | * *9 +++------
>>> *1 files changed, 3 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/rc.sysinit b/rc.sysinit
>>> index 09d5e97..07b3f67 100755
>>> --- a/rc.sysinit
>>> +++ b/rc.sysinit
>>> @@ -92,13 +92,10 @@ if /bin/pidof -o %PPID /sbin/udevd>/dev/null; then
>>> *fi
>>>
>>> *# Load modules from the MODULES array defined in rc.conf
>>> -if [[ $load_modules != off&& *-f /proc/modules ]]; then
>>> +modules=$( echo ${MODULES[*]/!*/} )
>>> +if [[ $modules&& *$load_modules != off&& *-f /proc/modules ]]; then
>>> * * *stat_busy "Loading Modules"
>>> - * *for mod in "${MODULES[@]}"; do
>>> - * * * if [[ $mod = ${mod#!} ]]; then
>>> - * * * * * /sbin/modprobe $mod
>>> - * * * fi
>>> - * *done
>>> + * */sbin/modprobe -a $modules
>>> * * *stat_done
>>> *fi
>>>
>>> --
>>> 1.7.0.3
>>>
>>
>> Your echo is redundant. Just quote the expansion and assign it.
>>
> NAK. Try this:
> MODULES=( '!foo' '!bar' )
> modules="${MODULES[@]/#!*}"
> [[ $modules ]] && echo "'$modules' is not a null string"
> ' ' is not a null string
>
>> modules="${MODULES[@]/#!*}"
>>
>> I think we're a looooong way away from the day when there's a '!' as
>> part of a module name, but I think it's probably best to anchor the
>> expression to the start of each element regardless.
>>
> OK, but the quotes aren't needed because word splitting is not performed
> here. So we finally get:
>
> modules=$( echo ${MODULES[@]/#!*} )
>
> --
> Kurt
>
>
>

Actually, removing the quotes is good enough:

$ MODULES=( '!foo' '!bar' )
$ modules=${MODULES[@]/#!*}
$ [[ $modules ]] && echo "'$modules' is not a null string"
$

--
Tavian Barnes
 
Old 09-20-2010, 08:46 PM
Tavian Barnes
 
Default rc.sysinit: only call modprobe once

On 20 September 2010 16:22, Kurt J. Bosch <kjb-temp-2009@alpenjodel.de> wrote:
> 2010-09-20 17:56, Dave Reisner:
>>
>> On Mon, Sep 20, 2010 at 05:39:25PM +0200, Kurt J. Bosch wrote:
>>>
>>> 2010-09-20 04:10, Dave Reisner:
>>>>
>>>> On Mon, Sep 20, 2010 at 11:57:06AM +1000, Allan McRae wrote:
>>>>>
>>>>> On 20/09/10 11:54, Dave Reisner wrote:
>>>>>>
>>>>>> Use modprobe -a and a bash PE to filter the MODULES array.
>>>>>>
>>>>>> Signed-off-by: Dave Reisner<d@falconindy.com>
>>>>>> ---
>>>>>> *rc.sysinit | * 12 ++++--------
>>>>>> *1 files changed, 4 insertions(+), 8 deletions(-)
>>>>>>
>>>>>> diff --git a/rc.sysinit b/rc.sysinit
>>>>>> index 09d5e97..4b6e1e7 100755
>>>>>> --- a/rc.sysinit
>>>>>> +++ b/rc.sysinit
>>>>>> @@ -92,14 +92,10 @@ if /bin/pidof -o %PPID /sbin/udevd>/dev/null; then
>>>>>> *fi
>>>>>>
>>>>>> *# Load modules from the MODULES array defined in rc.conf
>>>>>> -if [[ $load_modules != off&& * *-f /proc/modules ]]; then
>>>>>> - * *stat_busy "Loading Modules"
>>>>>> - * *for mod in "${MODULES[@]}"; do
>>>>>> - * * * if [[ $mod = ${mod#!} ]]; then
>>>>>> - * * * * * /sbin/modprobe $mod
>>>>>> - * * * fi
>>>>>> - * *done
>>>>>> - * *stat_done
>>>>>> +if [[ $load_modules != off&& * *-f /proc/modules ]]&& * *((
>>>>>> ${#MODULES[@]}> * *0 )); then
>>>>>> + * * * stat_busy "Loading Modules"
>>>>>> + * * * * * * * /sbin/modprobe -a "${MODULES[@]/#!*/}"
>>>>>> + * * * stat_done
>>>>>> *fi
>>>>>>
>>>>>> *# Wait for udev uevents
>>>>>
>>>>> Does this still work in the "null" case where there is only modules
>>>>> specified with "!" in the front?
>>>>>
>>>>> Allan
>>>>>
>>>>
>>>> Excellent observation -- it would not. Counting the size of the array
>>>> with the PE in place isn't possible (or desirable), either. Perhaps a
>>>> more graceful solution is to reassign the output of the PE to a new
>>>> array and operate based on that. Certainly still beats calling modprobe
>>>> for every element in the array, imo.
>>>>
>>>> d
>>>>
>>>
>>> I think it could be done like so:
>>>
>>> *From 6465c90fc851b12cfce791228415ae1c2823e050 Mon Sep 17 00:00:00 2001
>>> From: Kurt J. Bosch<kjb-temp-2009@alpenjodel.de>
>>> Date: Mon, 20 Sep 2010 17:31:54 +0200
>>> Subject: [PATCH] rc.sysinit: only call modprobe once (as proposed by
>>> Dave Reisner)
>>>
>>> ---
>>> *rc.sysinit | * *9 +++------
>>> *1 files changed, 3 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/rc.sysinit b/rc.sysinit
>>> index 09d5e97..07b3f67 100755
>>> --- a/rc.sysinit
>>> +++ b/rc.sysinit
>>> @@ -92,13 +92,10 @@ if /bin/pidof -o %PPID /sbin/udevd>/dev/null; then
>>> *fi
>>>
>>> *# Load modules from the MODULES array defined in rc.conf
>>> -if [[ $load_modules != off&& *-f /proc/modules ]]; then
>>> +modules=$( echo ${MODULES[*]/!*/} )
>>> +if [[ $modules&& *$load_modules != off&& *-f /proc/modules ]]; then
>>> * * *stat_busy "Loading Modules"
>>> - * *for mod in "${MODULES[@]}"; do
>>> - * * * if [[ $mod = ${mod#!} ]]; then
>>> - * * * * * /sbin/modprobe $mod
>>> - * * * fi
>>> - * *done
>>> + * */sbin/modprobe -a $modules
>>> * * *stat_done
>>> *fi
>>>
>>> --
>>> 1.7.0.3
>>>
>>
>> Your echo is redundant. Just quote the expansion and assign it.
>>
> NAK. Try this:
> MODULES=( '!foo' '!bar' )
> modules="${MODULES[@]/#!*}"
> [[ $modules ]] && echo "'$modules' is not a null string"
> ' ' is not a null string
>
>> modules="${MODULES[@]/#!*}"
>>
>> I think we're a looooong way away from the day when there's a '!' as
>> part of a module name, but I think it's probably best to anchor the
>> expression to the start of each element regardless.
>>
> OK, but the quotes aren't needed because word splitting is not performed
> here. So we finally get:
>
> modules=$( echo ${MODULES[@]/#!*} )
>
> --
> Kurt
>
>
>

Actually, removing the quotes is good enough:

$ MODULES=( '!foo' '!bar' )
$ modules=${MODULES[@]/#!*}
$ [[ $modules ]] && echo "'$modules' is not a null string"
$

--
Tavian Barnes
 

Thread Tools




All times are GMT. The time now is 02:51 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org