mirror of
https://github.com/femtofox/femtofox.git
synced 2026-11-29 03:17:04 -05:00
Update femto-runonce.sh
This commit is contained in:
parent
9a9124f1eb
commit
1b6f0ef9dc
1 changed files with 20 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue