various fixes, data subvols changed, mostly handled elsewhere now
[automated-distro-installer] / fai / config / files / root / fai-check / STABLE_BOOTSTRAP
index 29bb1fbb7272813e1755b349000bef79bd7c3cd4..15c865f671f1007cf05a5361a0524375103946b5 100755 (executable)
@@ -3,12 +3,20 @@
 set -eE -o pipefail
 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
 
+# keep it short so we don't delay too much wnen we don't have networking.
+NETWORK_TIMOUT_SECS=10
 fai_check=false
 check-fai() {
     # we could just as well check if last_boot != /debianstable_boostrap
     # the intent with this one is just a little clearer.
     if [[ $did_fai_check == true ]]; then
         fai_check=true
+        # ref: https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/
+        deadline=$(( `date +%s` + NETWORK_TIMOUT_SECS ))
+        while ! systemctl status network-online.target && \
+                (( `date +%s` < deadline )); do
+            sleep 1
+        done
         pxe-kexec -n --ignore-whitelist -l fai-generated faiserver ||:
     else
         return 0