summaryrefslogtreecommitdiffstats
path: root/core/rootfs/rootfs-stage31/data/inc/setup_network
diff options
context:
space:
mode:
authorSimon Rettberg2018-05-04 11:41:26 +0200
committerSimon Rettberg2018-05-04 11:41:26 +0200
commitc893145e65bdea2d44bf95bcd5b130d4fabb5055 (patch)
treeab851146fce492c29ceb716d38d5dea0b7ad6627 /core/rootfs/rootfs-stage31/data/inc/setup_network
parent[rfs-stage31] Don't try to source config before downloading it... (diff)
downloadmltk-c893145e65bdea2d44bf95bcd5b130d4fabb5055.tar.gz
mltk-c893145e65bdea2d44bf95bcd5b130d4fabb5055.tar.xz
mltk-c893145e65bdea2d44bf95bcd5b130d4fabb5055.zip
[rfs-stage31] Fix race when syncing time, more network setup tweaks
Diffstat (limited to 'core/rootfs/rootfs-stage31/data/inc/setup_network')
-rw-r--r--core/rootfs/rootfs-stage31/data/inc/setup_network10
1 files changed, 8 insertions, 2 deletions
diff --git a/core/rootfs/rootfs-stage31/data/inc/setup_network b/core/rootfs/rootfs-stage31/data/inc/setup_network
index 76195780..6a196b82 100644
--- a/core/rootfs/rootfs-stage31/data/inc/setup_network
+++ b/core/rootfs/rootfs-stage31/data/inc/setup_network
@@ -95,9 +95,11 @@ wait_for_iface "$BRIDGE"
PARAM=
if [ -n "$CLIENTIP" ]; then
PARAM="-r $CLIENTIP"
+ echo -n "$CLIENTIP" > "/run/firstip"
+fi
+if [ -n "$GATEWAY" ]; then
+ echo -n "$GATEWAY" > "/run/firstgw"
fi
-echo -n "$CLIENTIP" > "/run/firstip"
-echo -n "$GATEWAY" > "/run/firstgw"
# save our variables for retry on fail ff.
echo "CLIENTIP=$CLIENTIP" >> /run/network.conf
@@ -105,4 +107,8 @@ echo "GATEWAY=$GATEWAY" >> /run/network.conf
echo "BRIDGE=$BRIDGE" >> /run/network.conf
udhcpc $PARAM -O ntpsrv -O domain -O wpad -O search -t 5 -T 2 -s "/inc/udhcpc-trigger" -f -n -q -i "$BRIDGE"
+URET=$?
# udhcpc return value will be return value of this script
+[ -z "$CLIENTIP" ] && CLIENTIP=$(cat /run/firstip)
+[ -z "$GATEWAY" ] && GATEWAY=$(cat /run/firstgw)
+return $URET