Re: [PATCH 2/3] wait_for_if_up fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
>> ---
>>  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
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux