add function wait_for_route_ok
PATCH 3/3 add function wait_for_route_ok
Manually setuping nic through udev is not always done when we want network access. Here add a function wait_for_route_ok to wait and make sure the network is accesible
--- modules.d/99base/dracut-lib.sh | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
modules.d/99base/dracut-lib.sh +11 -0
@@ -392,6 +392,17 @@ wait_for_if_up() { return 1 } +wait_for_route_ok() { + local cnt=0 + while [ $cnt -lt 200 ]; do + li=$(ip route show) + [[ "$li" =~ "$1" ]] && return 0 + sleep 0.1 + cnt=$(($cnt+1)) + done + return 1 +} + # root=nfs:[<server-ip>:]<root-dir>[:<nfs-options>] # root=nfs4:[<server-ip>:]<root-dir>[:<nfs-options>] nfsroot_to_var() {
Signature · 1 line
1.7.7.5
A message that is not in the archive (sent off-list or not yet received): 20120215064029.GA30112-4/[email protected]
Am 15.02.2012 07:40, schrieb Dave Young:
Quoted 21 lines
Manually setuping nic through udev is not always done when we want network access. Here add a function
wait_for_route_okto wait and make sure the network is accesibleSigned-off-by Dave Young <[email protected]>--- modules.d/99base/dracut-lib.sh | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)modules.d/99base/dracut-lib.sh +4
-0@@ -392,6 +392,17 @@ wait_for_if_up() { return 1 } +wait_for_route_ok() { + local cnt=0 + while [ $cnt -lt 200 ]; do + li=$(ip route show)
modules.d/99base/dracut-lib.sh wait_for_if_up() { · line 408
Quoted 10 lines
modules.d/99base/dracut-lib.sh +7
-0+ [[ "$li" =~ "$1" ]] && return 0 + sleep 0.1 + cnt=$(($cnt+1)) + done + return 1 +} + # root=nfs:[<server-ip>:]<root-dir>[:<nfs-options>] # root=nfs4:[<server-ip>:]<root-dir>[:<nfs-options>] nfsroot_to_var() {
$ li=$(ip route show) $ [[ "$li" =~ "$1" ]] && echo OK dash: 6: [[: not found
Please do not use "bash" syntax
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 38 lines · Harald Hoyer
Am 15.02.2012 07:40, schrieb Dave Young:
Quoted 21 lines
Manually setuping nic through udev is not always done when we want network access. Here add a function
wait_for_route_okto wait and make sure the network is accesibleSigned-off-by Dave Young <[email protected]>--- modules.d/99base/dracut-lib.sh | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)modules.d/99base/dracut-lib.sh +4
-0@@ -392,6 +392,17 @@ wait_for_if_up() { return 1 } +wait_for_route_ok() { + local cnt=0 + while [ $cnt -lt 200 ]; do + li=$(ip route show)modules.d/99base/dracut-lib.sh wait_for_if_up() { · line 408
Quoted 10 lines
modules.d/99base/dracut-lib.sh +7
-0+ [[ "$li" =~ "$1" ]] && return 0 + sleep 0.1 + cnt=$(($cnt+1)) + done + return 1 +} + # root=nfs:[<server-ip>:]<root-dir>[:<nfs-options>] # root=nfs4:[<server-ip>:]<root-dir>[:<nfs-options>] nfsroot_to_var() {$ li=$(ip route show) $ [[ "$li" =~ "$1" ]] && echo OK dash: 6: [[: not found
Quoted 1 line
Please do not use "bash" syntax
For this issue, similar with the wait_for_if_up, Probably when this scripts is called ip route show show nothing because there's still no route added. In this case we should not return 0
I will update the two patch like "[ -z "${li##*state UP*}" ]", and check [ -z "$li" ] as well for the nul case
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Thanks Dave
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 43 lines · Dave Young
Quoted 38 lines · Harald Hoyer
Am 15.02.2012 07:40, schrieb Dave Young:
Quoted 21 lines
Manually setuping nic through udev is not always done when we want network access. Here add a function
wait_for_route_okto wait and make sure the network is accesibleSigned-off-by Dave Young <[email protected]>--- modules.d/99base/dracut-lib.sh | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)modules.d/99base/dracut-lib.sh +4
-0@@ -392,6 +392,17 @@ wait_for_if_up() { return 1 } +wait_for_route_ok() { + local cnt=0 + while [ $cnt -lt 200 ]; do + li=$(ip route show)modules.d/99base/dracut-lib.sh wait_for_if_up() { · line 408
Quoted 10 lines
modules.d/99base/dracut-lib.sh +7
-0+ [[ "$li" =~ "$1" ]] && return 0 + sleep 0.1 + cnt=$(($cnt+1)) + done + return 1 +} + # root=nfs:[<server-ip>:]<root-dir>[:<nfs-options>] # root=nfs4:[<server-ip>:]<root-dir>[:<nfs-options>] nfsroot_to_var() {$ li=$(ip route show) $ [[ "$li" =~ "$1" ]] && echo OK dash: 6: [[: not foundQuoted 1 line
Please do not use "bash" syntax
Quoted 7 lines
For this issue, similar with the
wait_for_if_up, Probably when this scripts is calledip route showshow nothing because there's still no route added. In this case we should not return 0I will update the two patch like "[ -z "${li##*state UP*}" ]", and check [ -z "$li" ] as well for the nul case
Hmm, for the wait_for_if_up, pass an unexisted nic is a rare case, So I only resent the v2 patch of wait_for_route_ok.
Harald, could you apply the 1/3 and the v2 of 3/3?
Quoted 8 lines
Quoted 5 lines
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Thanks Dave