summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2018-05-04 11:41:26 +0200
committerSimon Rettberg2018-05-04 11:41:26 +0200
commitc893145e65bdea2d44bf95bcd5b130d4fabb5055 (patch)
treeab851146fce492c29ceb716d38d5dea0b7ad6627
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
-rw-r--r--core/rootfs/rootfs-stage31/data/inc/setup_network10
-rw-r--r--core/rootfs/rootfs-stage31/data/inc/setup_network_retry1
-rwxr-xr-xcore/rootfs/rootfs-stage31/data/init3
3 files changed, 12 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
diff --git a/core/rootfs/rootfs-stage31/data/inc/setup_network_retry b/core/rootfs/rootfs-stage31/data/inc/setup_network_retry
index 0578d9b2..95c662c7 100644
--- a/core/rootfs/rootfs-stage31/data/inc/setup_network_retry
+++ b/core/rootfs/rootfs-stage31/data/inc/setup_network_retry
@@ -12,6 +12,7 @@ for i in 1 2 3 4 5 6 7 8; do
echo "and up again.."
ip link set dev $IFACE up
+ ip link set dev $BRIDGE up
usleep 1000
wait_for_iface "$IFACE"
diff --git a/core/rootfs/rootfs-stage31/data/init b/core/rootfs/rootfs-stage31/data/init
index 4caf653c..2269014c 100755
--- a/core/rootfs/rootfs-stage31/data/init
+++ b/core/rootfs/rootfs-stage31/data/init
@@ -178,6 +178,9 @@ for mnt in run tmp; do
busybox umount -f -l "/$mnt" 2>/dev/null
done
+echo "Waiting for async processes..."
+wait
+
echo "Switching root...."
echo "$bench_result" > "${FUTURE_ROOT}/opt/openslx/.benchmark"
# Prepare environment (HOME is needed as a hack for nss_ldap with ssl and no caching)