* [PATCH 2/3] wait_for_if_up fix
@ 2012-02-15 6:40 Dave Young
[not found] ` <20120215064027.GA30110-4/PLUo9XfK+sDdueE5tM26fLeoKvNuZc@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Dave Young @ 2012-02-15 6:40 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA
wait_for_if_up will always return 0, fix it by change to use =~ to
check if link state is up
Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
modules.d/99base/dracut-lib.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index 6b70adf..85d4925 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -385,7 +385,7 @@ wait_for_if_up() {
local cnt=0
while [ $cnt -lt 200 ]; do
li=$(ip link show $1)
- [ -z "${li##*state UP*}" ] && return 0
+ [[ "$li" =~ "state UP" ]] && return 0
sleep 0.1
cnt=$(($cnt+1))
done
--
1.7.7.5
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <20120215064027.GA30110-4/PLUo9XfK+sDdueE5tM26fLeoKvNuZc@public.gmane.org>]
* Re: [PATCH 2/3] wait_for_if_up fix [not found] ` <20120215064027.GA30110-4/PLUo9XfK+sDdueE5tM26fLeoKvNuZc@public.gmane.org> @ 2012-02-15 8:22 ` Harald Hoyer [not found] ` <4F3B6B5A.6070007-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Harald Hoyer @ 2012-02-15 8:22 UTC (permalink / raw) To: Dave Young; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA Am 15.02.2012 07:40, schrieb Dave Young: > wait_for_if_up will always return 0, fix it by change to use =~ to > check if link state is up > > Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> > --- > modules.d/99base/dracut-lib.sh | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh > index 6b70adf..85d4925 100755 > --- a/modules.d/99base/dracut-lib.sh > +++ b/modules.d/99base/dracut-lib.sh > @@ -385,7 +385,7 @@ wait_for_if_up() { > local cnt=0 > while [ $cnt -lt 200 ]; do > li=$(ip link show $1) > - [ -z "${li##*state UP*}" ] && return 0 > + [[ "$li" =~ "state UP" ]] && return 0 > sleep 0.1 > cnt=$(($cnt+1)) > done This is not posix shell compliant. $ PS1="$ " dash $ li="my state DOWN test" $ [ -z "${li##*state UP*}" ] && echo OK $ li="my state UP test" $ [ -z "${li##*state UP*}" ] && echo OK OK $ works for me ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <4F3B6B5A.6070007-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH 2/3] wait_for_if_up fix [not found] ` <4F3B6B5A.6070007-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> @ 2012-02-16 1:12 ` Dave Young 0 siblings, 0 replies; 3+ messages in thread From: Dave Young @ 2012-02-16 1:12 UTC (permalink / raw) To: Harald Hoyer; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA On 02/15/2012 04:22 PM, Harald Hoyer wrote: > Am 15.02.2012 07:40, schrieb Dave Young: >> wait_for_if_up will always return 0, fix it by change to use =~ to >> check if link state is up >> >> Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> >> --- >> modules.d/99base/dracut-lib.sh | 2 +- >> 1 files changed, 1 insertions(+), 1 deletions(-) >> >> diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh >> index 6b70adf..85d4925 100755 >> --- a/modules.d/99base/dracut-lib.sh >> +++ b/modules.d/99base/dracut-lib.sh >> @@ -385,7 +385,7 @@ wait_for_if_up() { >> local cnt=0 >> while [ $cnt -lt 200 ]; do >> li=$(ip link show $1) >> - [ -z "${li##*state UP*}" ] && return 0 >> + [[ "$li" =~ "state UP" ]] && return 0 >> sleep 0.1 >> cnt=$(($cnt+1)) >> done > > > This is not posix shell compliant. > > $ PS1="$ " dash > $ li="my state DOWN test" > $ [ -z "${li##*state UP*}" ] && echo OK > $ li="my state UP test" > $ [ -z "${li##*state UP*}" ] && echo OK > OK > $ > > works for me Thanks for comment, above work for me as well. Actually I tested with an non-exist nic. In that case $li will be nul -- Thanks Dave ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-02-16 1:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-15 6:40 [PATCH 2/3] wait_for_if_up fix Dave Young
[not found] ` <20120215064027.GA30110-4/PLUo9XfK+sDdueE5tM26fLeoKvNuZc@public.gmane.org>
2012-02-15 8:22 ` Harald Hoyer
[not found] ` <4F3B6B5A.6070007-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-02-16 1:12 ` Dave Young
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.