summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbuilder/modules.d/dnbd3-rootfs/hooks/fetch-config.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/builder/modules.d/dnbd3-rootfs/hooks/fetch-config.sh b/builder/modules.d/dnbd3-rootfs/hooks/fetch-config.sh
index a1f8995c..2b63f917 100755
--- a/builder/modules.d/dnbd3-rootfs/hooks/fetch-config.sh
+++ b/builder/modules.d/dnbd3-rootfs/hooks/fetch-config.sh
@@ -17,6 +17,20 @@ slx_server="$(getarg slxsrv=)"
slx_server_base="$(getarg slxbase=)"
exceptions.activate
+# if no slxsrv was specified, use the server the kernel was
+# downloaded from as fallback. Mostly for legacy PXE boot.
+if [ -z "$slx_server" ]; then
+ slx_server="$(getarg BOOT_IMAGE= | awk -F[/:] '{print $4}')"
+fi
+if [ -z "$slx_server" ]; then
+ # use tftp server from ip parameter
+ slx_server="$(getarg ip= | awk -F: '{print $2}' )"
+fi
+if [ -z "$slx_server" ]; then
+ # we have a problem :/
+ emergency_shell "Failed to determine SLX server to fetch config from."
+fi
+
# build config_url
config_url="http://${slx_server#@}/${slx_server_base}/config"