Limit nodeid seed to 32 bits

This commit is contained in:
nagumii 2024-12-03 21:56:33 +02:00
parent ec0d4d44db
commit 35c1c386df

View file

@ -14,12 +14,16 @@ if ! grep -A 1 "iface eth0 inet dhcp" /etc/network/interfaces | grep -q "hwaddre
echo "Making current eth0 MAC address permanent."
fi
#run once to set meshtastic nodeid to derivative of CPU serial number (unique to this board)
#run once to set meshtastic nodeid to derivative of CPU serial number (unique to this board). Check at boot in case of upgrade overwriting this.
if ! grep -q "^ExecStart=.*--hwid" /usr/lib/systemd/system/meshtasticd.service; then
sed -i "/^ExecStart=/ s:$: --hwid $((16#$(cat /proc/cpuinfo | grep Serial | awk '{print $3}' | tail -c 8))):" /usr/lib/systemd/system/meshtasticd.service
sed -i "/^ExecStart=/ s:$: --hwid $((0x$(awk '/Serial/ {print $3}' /proc/cpuinfo) & 0xFFFFFFFF)):" /usr/lib/systemd/system/meshtasticd.service
echo "Used Luckfox CPU S/N to generate unique nodeid seed for Meshtastic."
systemctl stop meshtasticd
systemctl daemon-reload
systemctl start meshtasticd
fi
# try enable RTC
echo 'ds1307 0x68' | sudo tee /sys/class/i2c-adapter/i2c-3/new_device > /dev/null 2>&1