package/skeleton: add a startup script to wait for slow network interfaces
PATCH 1/1 package/skeleton: add a startup script to wait for slow network interfaces
On some machines, the network interface is slow to appear. For example, on the Raspberry Pi, the network interface eth0 is an ethernet-over-USB, and our standard boot process is too fast, so our network startup script is called before the USB bus is compeltely enumerated, thus it can't configure eth0.
If Buildroot is configured to do a DHCP on an interface, install a startup script, just before S40network, that waits for that interface.
Since Buildroot can only be configured to run DHCP on a single interface, we do not need a script that waits for more than one interface.
Closes #8116.
--- package/skeleton/S39wait-for-network-if | 43 +++++++++++++++++++++++++++++++++ package/skeleton/skeleton.mk | 2 ++ 2 files changed, 45 insertions(+) create mode 100644 package/skeleton/S39wait-for-network-if
package/skeleton/S39wait-for-network-if new file +43 -0
@@ -0,0 +1,43 @@ +#!/bin/sh + +# In case we have a slow-to-appear interface (e.g. eth-over-USB), +# and we need to configure it, wait until it appears. But not too +# long either. WAIT_DELAY is in seconds. +WAIT_DELAY=15 + +wait_for_IF() { + IF="$(sed -r -e '/^auto lo/d;' \ + -e '/^auto (.+)$/!d;' \ + -e 's//\1/;' \ + /etc/network/interfaces + )" + if [ -z "${IF}" -o -e "/sys/class/net/${IF}" ]; then + return 0 + fi + printf "Waiting for interface %s to appear" "${IF}" + wait=${WAIT_DELAY} + while [ ${wait} -gt 0 ]; do + if [ -e "/sys/class/net/${IF}" ]; then + printf " yes\n" + return 0 + fi + sleep 1 + printf "." + : $((wait--)) + done + printf " no.\n" + return 1 +} + +case "$1" in + start) + wait_for_IF + ;; + stop) + ;; + restart) + "$0" start + ;; + *) + echo "Usage: $0 {start|stop|restart}" +esac
package/skeleton/skeleton.mk +2 -0
@@ -76,6 +76,8 @@ define SET_NETWORK_DHCP echo "auto $(NETWORK_DHCP_IFACE)"; \ echo "iface $(NETWORK_DHCP_IFACE) inet dhcp"; \ ) >> $(TARGET_DIR)/etc/network/interfaces + $(INSTALL) -D -m 0755 package/skeleton/S39wait-for-network-if \ + $(TARGET_DIR)/etc/init.d/S39wait-for-network-if endef endif
Signature · 1 line
1.9.1
PATCH 1/1 package/skeleton: add a startup script to wait for slow network interfaces
Quoted 9 lines · Yann E. MORIN
On some machines, the network interface is slow to appear. For example, on the Raspberry Pi, the network interface eth0 is an ethernet-over-USB, and our standard boot process is too fast, so our network startup script is called before the USB bus is compeltely enumerated, thus it can't configure eth0.
If Buildroot is configured to do a DHCP on an interface, install a startup script, just before S40network, that waits for that interface.
Quoted 8 lines
Since Buildroot can only be configured to run DHCP on a single interface, we do not need a script that waits for more than one interface.
Closes #8116.
Signed-off-by "Yann E. MORIN" <[email protected]>--- package/skeleton/S39wait-for-network-if | 43 +++++++++++++++++++++++++++++++++
Argh, you're adding an init script to skeleton! That's evil(TM)! :-)
Seriously, this should be part of package/initscripts/init.d/S40network instead.
Quoted 10 lines
package/skeleton/skeleton.mk | 2 ++ 2 files changed, 45 insertions(+) create mode 100644 package/skeleton/S39wait-for-network-ifpackage/skeleton/S39wait-for-network-if new file +0
-0
package/skeleton/S39wait-for-network-if line 9
Quoted 9 lines
package/skeleton/S39wait-for-network-if new file +9
-0@@ -0,0 +1,43 @@ +#!/bin/sh + +# In case we have a slow-to-appear interface (e.g. eth-over-USB), +# and we need to configure it, wait until it appears. But not too +# long either. WAIT_DELAY is in seconds. +WAIT_DELAY=15 + +wait_for_IF() { + IF="$(sed -r -e '/^auto lo/d;' \
I believe the ; are redundant when you use -e (at least that's what we do in
other cases).
package/skeleton/S39wait-for-network-if line 11
Quoted 2 lines
package/skeleton/S39wait-for-network-if new file +2
-0+ -e '/^auto (.+)$/!d;' \ + -e 's//\1/;' \
This one got me looking at the sed man page and I'm still surprised that it
works. Basically, this s command is reusing the same address as given on the previous line, but without the ! modifier, right?
Regards,
Arnout
Quoted 46 lines
package/skeleton/S39wait-for-network-if new file +32
-0+ /etc/network/interfaces + )" + if [ -z "${IF}" -o -e "/sys/class/net/${IF}" ]; then + return 0 + fi + printf "Waiting for interface %s to appear" "${IF}" + wait=${WAIT_DELAY} + while [ ${wait} -gt 0 ]; do + if [ -e "/sys/class/net/${IF}" ]; then + printf " yes\n" + return 0 + fi + sleep 1 + printf "." + : $((wait--)) + done + printf " no.\n" + return 1 +} + +case "$1" in + start) + wait_for_IF + ;; + stop) + ;; + restart) + "$0" start + ;; + *) + echo "Usage: $0 {start|stop|restart}" +esacpackage/skeleton/skeleton.mk +2
-0@@ -76,6 +76,8 @@ define SET_NETWORK_DHCP echo "auto $(NETWORK_DHCP_IFACE)"; \ echo "iface $(NETWORK_DHCP_IFACE) inet dhcp"; \ ) >> $(TARGET_DIR)/etc/network/interfaces + $(INSTALL) -D -m 0755 package/skeleton/S39wait-for-network-if \ + $(TARGET_DIR)/etc/init.d/S39wait-for-network-if endef endif
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 1/1 package/skeleton: add a startup script to wait for slow network interfaces
In reply to Yann E. MORINQuoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Yann" == Yann E MORIN <[email protected]> writes:
On some machines, the network interface is slow to appear. For example, on the Raspberry Pi, the network interface eth0 is an ethernet-over-USB, and our standard boot process is too fast, so our network startup script is called before the USB bus is compeltely enumerated, thus it can't configure eth0.
Quoted 7 lines
If Buildroot is configured to do a DHCP on an interface, install a startup script, just before S40network, that waits for that interface.
Since Buildroot can only be configured to run DHCP on a single interface, we do not need a script that waits for more than one interface.
Closes #8116.
A more generic solution for dynamic changes to network interfaces is to NOT mark them as auto and instead use ifplugd -M <interface>.
Quoted 16 lines
Signed-off-by "Yann E. MORIN" <[email protected]>--- package/skeleton/S39wait-for-network-if | 43 +++++++++++++++++++++++++++++++++ package/skeleton/skeleton.mk | 2 ++ 2 files changed, 45 insertions(+) create mode 100644 package/skeleton/S39wait-for-network-ifpackage/skeleton/S39wait-for-network-if new file +3
-0@@ -0,0 +1,43 @@ +#!/bin/sh + +# In case we have a slow-to-appear interface (e.g. eth-over-USB),
package/skeleton/S39wait-for-network-if line 13
Quoted 10 lines
package/skeleton/S39wait-for-network-if new file +10
-0+# and we need to configure it, wait until it appears. But not too +# long either. WAIT_DELAY is in seconds. +WAIT_DELAY=15 + +wait_for_IF() { + IF="$(sed -r -e '/^auto lo/d;' \ + -e '/^auto (.+)$/!d;' \ + -e 's//\1/;' \ + /etc/network/interfaces + )"
This assumes we have at most 1 interface to wait for.
Perhaps we could instead do something like (untested):
IFACES=$(awk '/^auto/ { print $2 }' /tmp/interfaces)
for i in $(seq $WAIT_DELAY); do
for IFACE in $IFACES; do
if [ ! -e "/tmp/$IFACE" ]; then
sleep 1
continue 2
fi
done
echo "ok"; exit 0
done
echo "timeout"; exit 1
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/1 package/skeleton: add a startup script to wait for slow network interfaces
Quoted 9 lines
package/skeleton/S39wait-for-network-if line 13
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Peter" == Peter Korsgaard <[email protected]> writes:
package/skeleton/S39wait-for-network-if new file +6
-0+wait_for_IF() { + IF="$(sed -r -e '/^auto lo/d;' \ + -e '/^auto (.+)$/!d;' \ + -e 's//\1/;' \ + /etc/network/interfaces + )"
Quoted 5 lines
This assumes we have at most 1 interface to wait for.
Perhaps we could instead do something like (untested):
IFACES=$(awk '/^auto/ { print $2 }'
/tmp/interfaces)
That should naturally be /etc/network/interfaces
Quoted 3 lines
for i in $(seq $WAIT_DELAY); do
for IFACE in $IFACES; do
if [ ! -e "/tmp/$IFACE" ]; then
and /sys/class/net/$IFACE
See, I did actually do a quick test after all ;)
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/1 package/skeleton: add a startup script to wait for slow network interfaces
In reply to Peter KorsgaardQuoted 31 lines
Quoted 9 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
"Peter" == Peter Korsgaard <[email protected]> writes:
"Yann" == Yann E MORIN <[email protected]> writes:
On some machines, the network interface is slow to appear. For example, on the Raspberry Pi, the network interface eth0 is an ethernet-over-USB, and our standard boot process is too fast, so our network startup script is called before the USB bus is compeltely enumerated, thus it can't configure eth0.
Quoted 7 lines
If Buildroot is configured to do a DHCP on an interface, install a startup script, just before S40network, that waits for that interface.
Since Buildroot can only be configured to run DHCP on a single interface, we do not need a script that waits for more than one interface.
Closes #8116.
This assumes we have at most 1 interface to wait for.
Perhaps we could instead do something like (untested):
IFACES=$(awk '/^auto/ { print $2 }'
/tmp/interfaces)for i in $(seq $WAIT_DELAY); do
for IFACE in $IFACES; do
if [ ! -e "/tmp/$IFACE" ]; then
sleep 1
continue 2
fi
done
Quoted 4 lines
echo "ok"; exit 0
doneecho "timeout"; exit 1
Committed after moving it to S40network and changing the implementation to support multiple interaces, thanks.
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/1 package/skeleton: add a startup script to wait for slow network interfaces
In reply to Yann E. MORINHello,
package/skeleton/S39wait-for-network-if line 27
Quoted 11 lines · Yann E. MORIN
package/skeleton/S39wait-for-network-if new file +11
-0+ printf "Waiting for interface %s to appear" "${IF}" + wait=${WAIT_DELAY} + while [ ${wait} -gt 0 ]; do + if [ -e "/sys/class/net/${IF}" ]; then + printf " yes\n" + return 0 + fi + sleep 1 + printf "." + : $((wait--)) + done
One thing that I really like in Buildroot is that by default, it generates you a system that boots really fast. People often don't have to do anything special with Buildroot to make it boot fast. So having a shell script that is installed by default and does a "sleep 1" in a loop is not very nice :-/
Though I agree that it will only slow the boot on systems where the network interfaces are not available immediately at boot time.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 1/1 package/skeleton: add a startup script to wait for slow network interfaces
Quoted 16 lines · Thomas Petazzoni
Hello,
package/skeleton/S39wait-for-network-if line 27
Quoted 11 lines · Yann E. MORIN
package/skeleton/S39wait-for-network-if new file +11
-0+ printf "Waiting for interface %s to appear" "${IF}" + wait=${WAIT_DELAY} + while [ ${wait} -gt 0 ]; do + if [ -e "/sys/class/net/${IF}" ]; then + printf " yes\n" + return 0 + fi + sleep 1 + printf "." + : $((wait--)) + done
Quoted 9 lines
One thing that I really like in Buildroot is that by default, it generates you a system that boots really fast. People often don't have to do anything special with Buildroot to make it boot fast. So having a shell script that is installed by default and does a "sleep 1" in a loop is not very nice :-/
Though I agree that it will only slow the boot on systems where the network interfaces are not available immediately at boot time.
I have that trouble too but instead of doing a sleep 1, I "hammer" the system with sleep 0.1 or usleep 25 if it's available (even usleep 1 can work, since it's not RT, it takes around 10ms).
This way it's almost transparent and add the necessary requirements before going on with the boot.
Quoted 11 lines
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20151003/e4cf1363/attachment.html>
PATCH 1/1 package/skeleton: add a startup script to wait for slow network interfaces
Quoted 28 lines · Maxime Hadjinlian
On Sat, Oct 3, 2015 at 5:47 PM, Thomas Petazzoni <[email protected] <mailto:[email protected]>> wrote:
Hello,
On Sat, 3 Oct 2015 14:31:45 +0100, Yann E. MORIN wrote:
> + printf "Waiting for interface %s to appear" "${IF}"
> + wait=${WAIT_DELAY}
> + while [ ${wait} -gt 0 ]; do
> + if [ -e "/sys/class/net/${IF}" ]; then
> + printf " yes\n"
> + return 0
> + fi
> + sleep 1
> + printf "."
> + : $((wait--))
> + doneOne thing that I really like in Buildroot is that by default, it generates you a system that boots really fast. People often don't have to do anything special with Buildroot to make it boot fast. So having a shell script that is installed by default and does a "sleep 1" in a loop is not very nice :-/
Quoted 6 lines
Though I agree that it will only slow the boot on systems where the network interfaces are not available immediately at boot time.
I have that trouble too but instead of doing a sleep 1, I "hammer" the system with sleep 0.1 or usleep 25 if it's available (even usleep 1 can work, since it's not RT, it takes around 10ms).
Since sysv init is not parallel, you're not even hammering the system since
nothing else is going on except perhaps some hotplug callbacks.
Regards,
Arnout
Quoted 22 lines
This way it's almost transparent and add the necessary requirements before going on with the boot.
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
_______________________________________________
buildroot mailing list
buildroot at busybox.net <mailto:[email protected]>
http://lists.busybox.net/mailman/listinfo/buildroot_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 1/1 package/skeleton: add a startup script to wait for slow network interfaces
Quoted 35 lines · Arnout Vandecappelle
Quoted 22 lines · Maxime Hadjinlian
On Sat, Oct 3, 2015 at 5:47 PM, Thomas Petazzoni <[email protected] <mailto:[email protected]>> wrote:
Hello,
On Sat, 3 Oct 2015 14:31:45 +0100, Yann E. MORIN wrote:
> + printf "Waiting for interface %s to appear" "${IF}"
> + wait=${WAIT_DELAY}
> + while [ ${wait} -gt 0 ]; do
> + if [ -e "/sys/class/net/${IF}" ]; then
> + printf " yes\n"
> + return 0
> + fi
> + sleep 1
> + printf "."
> + : $((wait--))
> + doneQuoted 2 lines
One thing that I really like in Buildroot is that by default, it generates you a system that boots really fast. People often don't
have
Quoted 1 line
to do anything special with Buildroot to make it boot fast. So
having a
Quoted 7 lines
shell script that is installed by default and does a "sleep 1" in a loop is not very nice :-/
Though I agree that it will only slow the boot on systems where the network interfaces are not available immediately at boot time.
I have that trouble too but instead of doing a sleep 1, I "hammer" the
Quoted 9 lines
system
Quoted 1 line
with sleep 0.1 or usleep 25 if it's available (even usleep 1 can work,
since
Quoted 1 line
it's not RT, it takes around 10ms).
Since sysv init is not parallel, you're not even hammering the system
since
nothing else is going on except perhaps some hotplug callbacks.
sysv is not, but the shell is. The scripts are started in background and then I simply use wait
Quoted 29 lines
Regards,
ArnoutQuoted 1 line
This way it's almost transparent and add the necessary requirements
before going
Quoted 16 lines
on with the boot.
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
_______________________________________________
buildroot mailing list
buildroot at busybox.net <mailto:[email protected]>
http://lists.busybox.net/mailman/listinfo/buildrootQuoted 5 lines
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Quoted 8 lines
--
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20151003/993b270d/attachment.html>
PATCH 1/1 package/skeleton: add a startup script to wait for slow network interfaces
In reply to Thomas PetazzoniQuoted 17 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Thomas" == Thomas Petazzoni <[email protected]> writes:
Hello,
package/skeleton/S39wait-for-network-if line 27
Quoted 11 lines · Yann E. MORIN
package/skeleton/S39wait-for-network-if new file +11
-0+ printf "Waiting for interface %s to appear" "${IF}" + wait=${WAIT_DELAY} + while [ ${wait} -gt 0 ]; do + if [ -e "/sys/class/net/${IF}" ]; then + printf " yes\n" + return 0 + fi + sleep 1 + printf "." + : $((wait--)) + done
Quoted 8 lines
One thing that I really like in Buildroot is that by default, it generates you a system that boots really fast. People often don't have to do anything special with Buildroot to make it boot fast. So having a shell script that is installed by default and does a "sleep 1" in a loop is not very nice :-/
Though I agree that it will only slow the boot on systems where the network interfaces are not available immediately at boot time.
Or where you misconfigured /etc/network/interfaces or forgot to enable the needed drivers in the kernel, but yeah.
But yes, using something like ifplugd to handle the interface when it shows up (or link state changes) is certainly nicer than just waiting.
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/1 package/skeleton: add a startup script to wait for slow network interfaces
In reply to Yann E. MORINHello Yann,
Quoted 62 lines · On Saturday 03 October 2015 14:31:45 Yann E. MORIN wrote:
On some machines, the network interface is slow to appear. For example, on the Raspberry Pi, the network interface eth0 is an ethernet-over-USB, and our standard boot process is too fast, so our network startup script is called before the USB bus is compeltely enumerated, thus it can't configure eth0.
If Buildroot is configured to do a DHCP on an interface, install a startup script, just before S40network, that waits for that interface.
Since Buildroot can only be configured to run DHCP on a single interface, we do not need a script that waits for more than one interface.
Closes #8116.
Signed-off-by "Yann E. MORIN" <[email protected]>--- package/skeleton/S39wait-for-network-if | 43 +++++++++++++++++++++++++++++++++ package/skeleton/skeleton.mk | 2 ++ 2 files changed, 45 insertions(+) create mode 100644 package/skeleton/S39wait-for-network-if(quoted diff) +0
-0b/package/skeleton/S39wait-for-network-if new file mode 100644 index 0000000..010026e
package/skeleton/S39wait-for-network-if new file +33
-0@@ -0,0 +1,43 @@ +#!/bin/sh + +# In case we have a slow-to-appear interface (e.g. eth-over-USB), +# and we need to configure it, wait until it appears. But not too +# long either. WAIT_DELAY is in seconds. +WAIT_DELAY=15 + +wait_for_IF() { + IF="$(sed -r -e '/^auto lo/d;' \ + -e '/^auto (.+)$/!d;' \ + -e 's//\1/;' \ + /etc/network/interfaces + )" + if [ -z "${IF}" -o -e "/sys/class/net/${IF}" ]; then + return 0 + fi + printf "Waiting for interface %s to appear" "${IF}" + wait=${WAIT_DELAY} + while [ ${wait} -gt 0 ]; do + if [ -e "/sys/class/net/${IF}" ]; then + printf " yes\n" + return 0 + fi + sleep 1 + printf "." + : $((wait--)) + done + printf " no.\n" + return 1 +} + +case "$1" in + start)
package/skeleton/S39wait-for-network-if line 43
Quoted 10 lines
package/skeleton/S39wait-for-network-if new file +10
-0+ wait_for_IF + ;; + stop) + ;; + restart) + "$0" start + ;; + *) + echo "Usage: $0 {start|stop|restart}" +esac
I am a bit late to do the review, but why not add a script in /etc/network/if-pre-up.d ? For example (notice $IFACE and $IF_MAXWAIT are set by ifupdown):
#! /bin/sh
if [ "${IF_MAXWAIT}" ]; then
printf "Waiting for interface %s to appear" "${IFACE}"
while [ ${IF_MAXWAIT} -gt 0 ]; do
if [ -e "/sys/class/net/${IFACE}" ]; then
printf " yes\n"
exit 0
fi
sleep 1
printf "."
: $((wait--))
done
printf " no.\n"
exit 1fi
Next, interface would use "maxwait" property in /etc/network/interface:
auto eth0
iface eth0 inet dhcp
maxwait 15
BR,
Signature · 3 lines
J?r?me Pouiller, Sysmic Embedded Linux specialist http://www.sysmic.fr
PATCH 1/1 package/skeleton: add a startup script to wait for slow network interfaces
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"J?r?me" == J?r?me Pouiller <[email protected]> writes:
Hi,
Quoted 18 lines
I am a bit late to do the review, but why not add a script in
/etc/network/if-pre-up.d? For example (notice $IFACE and $IF_MAXWAIT are set by ifupdown):#!
/bin/sh
if [ "${IF_MAXWAIT}" ]; thenprintf "Waiting for interface %s to appear" "${IFACE}" while [ ${IF_MAXWAIT} -gt 0 ]; do if [ -e "/sys/class/net/${IFACE}" ]; then printf " yes\n" exit 0 fi sleep 1 printf "." : $((wait--)) done printf " no.\n" exit 1
Quoted 1 line
fi
That's certainly also an option. Care to send a patch reworking the logic in S40network to a pre-up.d hook?
Quoted 5 lines
Next, interface would use "maxwait" property in
/etc/network/interface:auto eth0
iface eth0 inet dhcp
maxwait 15
Then our BR2_SYSTEM_DHCP logic should probably also be adapted to add 'maxwait 15' by default.
Thanks!
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/1 package/skeleton: add a startup script to wait for slow network interfaces
Quoted 26 lines · On Monday 19 October 2015 12:15:40 Peter Korsgaard wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"J?r?me" == J?r?me Pouiller <[email protected]> writes:
Hi,
Quoted 23 lines
I am a bit late to do the review, but why not add a script in
/etc/network/if-pre-up.d? For example (notice $IFACE and $IF_MAXWAIT
are set by ifupdown):#!
/bin/sh
if [ "${IF_MAXWAIT}" ]; thenprintf "Waiting for interface %s to appear" "${IFACE}" while [ ${IF_MAXWAIT} -gt 0 ]; do if [ -e "/sys/class/net/${IFACE}" ]; then printf " yes\n" exit 0 fi sleep 1 printf "." : $((wait--))
Quoted 8 lines
Quoted 5 lines
done printf " no.\n" exit 1fi
That's certainly also an option. Care to send a patch reworking the logic in S40network to a pre-up.d hook?
Ok, I will.
Signature · 3 lines
J?r?me Pouiller, Sysmic Embedded Linux specialist http://www.sysmic.fr