From 1b6f0ef9dc3b4cc042396c7ea09927403b406357 Mon Sep 17 00:00:00 2001 From: nagumii Date: Fri, 3 Jan 2025 13:50:34 +0200 Subject: [PATCH] Update femto-runonce.sh --- .../usr/local/bin/femto-runonce.sh | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) 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 b3fb349..fc4523f 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 @@ -1,10 +1,27 @@ #!/bin/bash - log_message() { echo "USB config: $1" # Echo to the screen logger "USB config: $1" # Log to the system log } +if [ ! -e "/usr/local/bin/.firstboot" ]; then + # prevents weirdness over tty + export NCURSES_NO_UTF8_ACS=1 + export TERM=xterm-256color + export LANG=C.UTF-8 + dialog --title "Femtofox run once utility" --yesno "\ +This does not appear to be this system's first boot.\n\ +Re-running this script will restore RTC support, set the Meshtastic nodeid and eth0 MAC address to be derivative of the CPU serial number, set the Meshtastic wifi status to \`enabled\` and then reboot.\n\ +\n\ +Re-running this script after first boot should not cause any harm, but may not work as expected.\n\ +\n\ +Proceed?" 14 60 + if [ $? -eq 1 ]; then #if cancel/no + exit 1 + fi +fi + + # resize filesystem to fill partition /usr/bin/filesystem_resize.sh @@ -36,11 +53,11 @@ sed -i "s|^ExecStart=/usr/sbin/meshtasticd.*|ExecStart=/usr/sbin/meshtasticd -h log_message "First boot: Using Luckfox CPU S/N to generate nodeid for Meshtastic." systemctl daemon-reload systemctl enable meshtasticd -systemctl start meshtasticd +systemctl restart meshtasticd # enable wifi in meshtastic settings. Because this is very important, we'll try 10 times. log_message "First boot: Enabling wifi setting in Meshtasticd." -/usr/local/bin/updatemeshtastic.sh "--set network.wifi_enabled true" 10 "First boot" +/usr/local/bin/femto-meshtasticd-config.sh -m "--set network.wifi_enabled true" 10 "First boot" # remove first boot flag rm /usr/local/bin/.firstboot