From 246e9a6eabc947044dca4d4309ef3cb6843e45a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonard=20G=C3=B6hrs?= Date: Fri, 23 Feb 2024 15:18:20 +0100 Subject: [PATCH] meta-lxatac-bsp: lxatac-factory-data: run script before udev starts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes sure that our tac-bridge.link file is ready before udev reads it. We have previously run into race conditions where the file was not present at the correct point in time, resulting in the bridge interface coming up with the wrong MAC address. Signed-off-by: Leonard Göhrs --- .../files/lxatac-factory-data.service | 7 +++++-- .../lxatac-factory-data/files/lxatac-factory-data.sh | 9 +++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/meta-lxatac-bsp/recipes-core/lxatac-factory-data/files/lxatac-factory-data.service b/meta-lxatac-bsp/recipes-core/lxatac-factory-data/files/lxatac-factory-data.service index afdedb9c..6a759b84 100644 --- a/meta-lxatac-bsp/recipes-core/lxatac-factory-data/files/lxatac-factory-data.service +++ b/meta-lxatac-bsp/recipes-core/lxatac-factory-data/files/lxatac-factory-data.service @@ -1,10 +1,13 @@ [Unit] Description=Gather and Distribute Factory Data -Before=NetworkManager.service +DefaultDependencies=no +After=systemd-remount-fs.service +Before=systemd-udevd.service +RequiresMountsFor=/run [Service] Type=oneshot ExecStart=/usr/sbin/lxatac-factory-data [Install] -WantedBy=multi-user.target +WantedBy=sysinit.target diff --git a/meta-lxatac-bsp/recipes-core/lxatac-factory-data/files/lxatac-factory-data.sh b/meta-lxatac-bsp/recipes-core/lxatac-factory-data/files/lxatac-factory-data.sh index 9a5a5a32..bcc89212 100644 --- a/meta-lxatac-bsp/recipes-core/lxatac-factory-data/files/lxatac-factory-data.sh +++ b/meta-lxatac-bsp/recipes-core/lxatac-factory-data/files/lxatac-factory-data.sh @@ -11,14 +11,12 @@ DST_LINK_FILE_BASE="/run/systemd/network/" mkdir -p "${DST_ENVS_BASE}" mkdir -p "${DST_LINK_FILE_BASE}" -# Set the static hostname if it is not set yet -# (The transient hostname is passed via systemd.hostname= commandline) -# -------------------------------------------------------------------- +# If no hostname is set yet persist the one we currently have +# ----------------------------------------------------------- if [[ ! -e /etc/hostname ]] then - hostname="$(hostnamectl --transient hostname)" - hostnamectl --static hostname "${hostname}" + hostname > /etc/hostname fi # Read Factory Data passed to us by barebox via the devicetree @@ -67,4 +65,3 @@ OriginalName=tac-bridge MACAddress=${MAC_BRIDGE} MACAddressPolicy=none EOF -