summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/modules/dhcpc-busybox/data/etc/systemd/system/lightdm.service.d/lock-hostname.conf2
-rwxr-xr-xcore/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx19
l---------core/modules/slx-network-configs-targets/data/etc/systemd/system/network.target.wants/slx-wait-primary-dhcp.service1
-rw-r--r--core/modules/slx-network-configs-targets/data/etc/systemd/system/slx-wait-primary-dhcp.service7
-rwxr-xr-xcore/modules/slx-network-configs-targets/data/opt/openslx/scripts/systemd-wait_primary_dhcp18
5 files changed, 20 insertions, 27 deletions
diff --git a/core/modules/dhcpc-busybox/data/etc/systemd/system/lightdm.service.d/lock-hostname.conf b/core/modules/dhcpc-busybox/data/etc/systemd/system/lightdm.service.d/lock-hostname.conf
new file mode 100644
index 00000000..cf079a5b
--- /dev/null
+++ b/core/modules/dhcpc-busybox/data/etc/systemd/system/lightdm.service.d/lock-hostname.conf
@@ -0,0 +1,2 @@
+[Service]
+ExecStartPre=-/opt/openslx/scripts/udhcpc-openslx --lock-hostname-updates
diff --git a/core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx b/core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx
index 0d74e832..327bdaa4 100755
--- a/core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx
+++ b/core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx
@@ -29,6 +29,22 @@ declare -rg RESOLV_CONF="/opt/openslx/resolv.conf"
declare -rg THIS_RESOLV="/run/network/${interface}.resolv"
declare -rg flag="/run/network/primary-dhcp.flag"
+if [ "$1" = "--lock-hostname-updates" ]; then
+ # If we change the hostname while Xorg is running, this might
+ # cause issues, depending on how it's set up. So we run this
+ # script with the lock argument to touch the flag file right
+ # before we try to launch lightdm/Xorg. In case the DHCP request
+ # is too slow, this means we'll run with the wrong hostname
+ # (potentially), but that's better than delaying the bootup
+ # unnecessarily.
+ # So also note that if you ever change this script's name/location
+ # (JUST DON'T), you'd need to update all call sites, i.e. the
+ # udhcpc startup script, and the lightdm service drop-in.
+ mkdir -p /run/network
+ touch "$flag"
+ exit 0
+fi
+
shopt -s extglob
rebuild_resolv_conf () {
@@ -186,7 +202,8 @@ case "$1" in
echo "SLX_NET_WINS='$wins'" >> /opt/openslx/config
fi
- # Only if network is not ready yet
+ # Only update hostname if network is not ready yet
+ # later on this might cause issues
if ! [ -e "$flag" ]; then
# Update hostname
if [ -z "$dns_fqdn" ] && [ -n "$domain" ] && [ -n "$hostname" ]; then
diff --git a/core/modules/slx-network-configs-targets/data/etc/systemd/system/network.target.wants/slx-wait-primary-dhcp.service b/core/modules/slx-network-configs-targets/data/etc/systemd/system/network.target.wants/slx-wait-primary-dhcp.service
deleted file mode 120000
index e7f32c14..00000000
--- a/core/modules/slx-network-configs-targets/data/etc/systemd/system/network.target.wants/slx-wait-primary-dhcp.service
+++ /dev/null
@@ -1 +0,0 @@
-../slx-wait-primary-dhcp.service \ No newline at end of file
diff --git a/core/modules/slx-network-configs-targets/data/etc/systemd/system/slx-wait-primary-dhcp.service b/core/modules/slx-network-configs-targets/data/etc/systemd/system/slx-wait-primary-dhcp.service
deleted file mode 100644
index 68dc13f7..00000000
--- a/core/modules/slx-network-configs-targets/data/etc/systemd/system/slx-wait-primary-dhcp.service
+++ /dev/null
@@ -1,7 +0,0 @@
-[Unit]
-Description=Wait until DHCP for the primary NIC has finished
-Before=network.target
-
-[Service]
-Type=oneshot
-ExecStart=/opt/openslx/scripts/systemd-wait_primary_dhcp
diff --git a/core/modules/slx-network-configs-targets/data/opt/openslx/scripts/systemd-wait_primary_dhcp b/core/modules/slx-network-configs-targets/data/opt/openslx/scripts/systemd-wait_primary_dhcp
deleted file mode 100755
index 3e452549..00000000
--- a/core/modules/slx-network-configs-targets/data/opt/openslx/scripts/systemd-wait_primary_dhcp
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/ash
-
-flag="/run/network/primary-dhcp.flag"
-readonly flag
-w=0
-
-# Wait a maximum of 10 seconds for the flag file
-while ! [ -e "$flag" ] && [ "$w" -lt 10 ]; do
- let w++
- sleep 1
-done
-
-# Then touch it anyways, this will prevent the DHCP
-# trigger script from changing the hostname later on
-mkdir -p /run/network
-touch "$flag"
-
-exit 0