Merge pull request #357 from femtofox/noon2

Default routes auto update more reliably (thanks @Ruledo)
This commit is contained in:
noon92 2025-02-19 14:18:20 +02:00 • committed by GitHub
commit 8b4e251b5c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 22 additions and 10 deletions

View file

@ -62,7 +62,8 @@ systemctl enable femto-boot-complete.service
systemctl enable femto-wifi-mesh-control
systemctl enable femto-watchclock-dog
systemctl disable meshtasticd
systemctl disable ttyd # enabled on first boot
systemctl disable meshtasticd # enabled on first boot
systemctl disable apt-daily.timer
systemctl disable unattended-upgrades
systemctl disable smbd nmbd # samba services, can be enabled via menu

View file

@ -8,4 +8,13 @@ iface lo inet loopback
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
metric 100
post-up sleep 5 && dhclient wlan0
pre-down ip route del default via $(ip route | awk '/default/ {print $3}') dev wlan0 metric 100
allow-hotplug eth0
iface eth0 inet dhcp
metric 10
post-up ip route replace default via $(ip route | awk '/default/ {print $3}') dev eth0 metric 10
pre-down ip route del default via $(ip route | awk '/default/ {print $3}') dev eth0 metric 10

View file

@ -70,16 +70,16 @@ fi
# prevent randomized mac address for eth0. If `eth0`` is already present in /etc/network/interfaces, skip
mac="$(awk '/Serial/ {print $3}' /proc/cpuinfo | tail -c 11 | sed 's/^\(.*\)/a2\1/' | sed 's/\(..\)/\1:/g;s/:$//')"
if ! grep -q "eth0" /etc/network/interfaces; then
file="/etc/network/interfaces"
if ! grep -q " hwaddress ether $mac" "$file"; then
log_message "Setting eth0 MAC address to $mac (derivative of CPU s/n)"
cat <<EOF >> /etc/network/interfaces
# static mac address for onboard ethernet (castellated pins)
allow-hotplug eth0
iface eth0 inet dhcp
hwaddress ether $mac
EOF
awk -v mac="$mac" '
{ print }
/allow-hotplug eth0/ { count=5 }
count && --count == 0 { print " hwaddress ether " mac }
' "$file" > "$file.tmp" && mv "$file.tmp" "$file"
else
log_message "eth0 already exists in /etc/network/interfaces, skipping"
log_message "eth0 mac address already set in /etc/network/interfaces, skipping"
fi
# Add term stuff to .bashrc
@ -110,11 +110,13 @@ systemctl enable meshtasticd
#generate SSH keys
log_message "Generating new SSH encryption keys. This can take a couple minutes..."
#femto-utils.sh -E
femto-utils.sh -E
#generate ttyd SSL keys
log_message "Generating new Web Terminal (ttyd) SSL encryption keys. This can take a couple minutes..."
/usr/local/bin/packages/ttyd.sh -k
log_message "Enabling Web Terminal (ttyd) service...
systemctl enable ttyd
# remove first boot flag
systemctl disable femto-runonce