Merge pull request #126 from noon92/new-working

Update femto-runonce.sh
This commit is contained in:
noon92 2025-01-03 13:50:51 +02:00 • committed by GitHub
commit 14560f35f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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