Files
Arch-R/projects/ArchR/packages/sysutils/systemd/scripts/network-base-setup
T
Douglas Teles 3d1ad6e278 fix four minor gaps: rtl8188eus udev rule, bfq scope, hostname, tsadc
Found during the live multi-device SSH sweep; none break a single device but
each is a real defect:

- linux-drivers/RTL8188EUS 99-rtl8188eus.rules: the RUN line used single `$`
  for its shell vars, which udev parses as its own specifier ("invalid
  substitution type") and rejects the whole rule, so the rtl8xxxu->8188eu
  rebind never ran (the dongle stayed on the better driver only by probe-order
  luck). Double them to `$$`.

- linux 10-bfq-sched.rules: `KERNEL=="mmcblk[0-9]*"` matched partitions too,
  whose queue/* knobs do not exist, spamming the boot log with ~15 ENOENT
  write failures. Gate on SUBSYSTEM=="block", DEVTYPE=="disk".

- hostname: system.cfg shipped `system.hostname=@DEVICENAME@` -> "RK3326" (the
  SoC name, identical on every unit), so two ArchR consoles on one LAN collide
  on NetBIOS/mDNS registration (nmbd "Failed to register my name"). Set the
  base name to "archr" and append a short per-device machine-id suffix in
  network-base-setup so each device is unique.

- tsadc: r3xs.dtsi and eeclone.dts enabled tsadc without
  rockchip,hw-tshut-mode/-polarity, so the driver logged "Missing tshut ...
  using default" on every boot. Spell out the defaults (CRU reset, active-low);
  behaviour unchanged. DTS compiles clean (eeclone + soysauce).

The "GO-Super Gamepad" joypad name on the Soysauce was investigated and is
intentional (soysauce.dts sets joypad-name with a matching retroarch config),
so it is left as-is.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 22:10:57 -03:00

35 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
. /etc/profile
HOSTNAME=$(get_setting system.hostname)
# Make the hostname unique per device. Multiple ArchR consoles on one LAN
# otherwise share a name and collide on NetBIOS / mDNS registration (nmbd
# "Failed to register my name ..."). Append a short, stable suffix derived
# from the per-device machine-id (the same id the gadget uses for its
# serial). Skip if no machine-id is available yet.
MID="$(cat /storage/.cache/systemd-machine-id 2>/dev/null)"
[ -z "${MID}" ] && MID="$(cat /etc/machine-id 2>/dev/null)"
[ -n "${MID}" ] && HOSTNAME="${HOSTNAME}-$(echo "${MID}" | cut -c1-4)"
echo ${HOSTNAME} >/proc/sys/kernel/hostname
hostnamectl --transient hostname ${HOSTNAME}
avahi-set-host-name ${HOSTNAME}
rm -f /run/archr/hosts
if [ -f /storage/.config/hosts.conf ]; then
cat /storage/.config/hosts.conf > /run/archr/hosts
fi
# RESOLUTION ORDER:
# 1. USER OVERRIDE: /storage/.config/resolv.conf exists -> Use it directly.
# 2. DYNAMIC/STUB: No override -> Symlink to systemd-resolved stub.
if [ -f /storage/.config/resolv.conf ]; then
rm -f /run/archr/resolv.conf
cat /storage/.config/resolv.conf > /run/archr/resolv.conf
else
TARGET="/run/systemd/resolve/stub-resolv.conf"
LINK="/run/archr/resolv.conf"
if [ ! -L "$LINK" ] || [ "$(readlink "$LINK")" != "$TARGET" ]; then
rm -f "$LINK"
ln -sf "$TARGET" "$LINK"
fi
fi