From 883d57a3e734e5f2963a34ddd8b79d0fde7c0b01 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 19 Feb 2025 13:24:32 +0200 Subject: [PATCH 1/4] Network failover --- .../rootfs_uclibc_rv1106/etc/network/interfaces | 9 +++++++++ .../usr/local/bin/femto-runonce.sh | 16 ++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/network/interfaces b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/network/interfaces index 315112b..bfde602 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/network/interfaces +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/network/interfaces @@ -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 diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index 4ba57a2..8f6073b 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -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 <> /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 From a980af7e47a46cc040cc1fb1abeda744c6355db0 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 19 Feb 2025 13:49:53 +0200 Subject: [PATCH 2/4] add back ssh keygen --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index 8f6073b..df60518 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -110,7 +110,7 @@ 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..." From 01b65a642454b29e01ab590865cf62b6ebf33044 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 19 Feb 2025 13:50:27 +0200 Subject: [PATCH 3/4] Update femto-runonce.sh --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index df60518..c0d19ac 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -115,6 +115,7 @@ 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 +systemctl enable ttyd # remove first boot flag systemctl disable femto-runonce From 9db705447e8a218e659e89e8275d5b01a3e92831 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 19 Feb 2025 14:14:38 +0200 Subject: [PATCH 4/4] disable ttyd in chroot and re-enable on first boot --- environment-setup/femtofox.chroot | 3 ++- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/environment-setup/femtofox.chroot b/environment-setup/femtofox.chroot index 19d213c..d0274df 100644 --- a/environment-setup/femtofox.chroot +++ b/environment-setup/femtofox.chroot @@ -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 diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index c0d19ac..a319a38 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -115,6 +115,7 @@ 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