Skip to content

Commit

Permalink
meta-lxatac-bsp: lxatac-factory-data: run script before udev starts
Browse files Browse the repository at this point in the history
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 <l.goehrs@pengutronix.de>
  • Loading branch information
hnez committed Feb 23, 2024
1 parent 701ea07 commit 246e9a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -67,4 +65,3 @@ OriginalName=tac-bridge
MACAddress=${MAC_BRIDGE}
MACAddressPolicy=none
EOF

0 comments on commit 246e9a6

Please sign in to comment.