Re-engineered rc.local

Moved femto-runonce to a service
Moved femto-usb-config-tool to a service
re-added override for meshtasticd to execute after rc-local
small fix in femto-network-config ro removed uneeded steps (same as I did in wifi config)
added a step in runonce that if no user logged in and already has been been run once, exit and do not run menu.
This commit is contained in:
Ruledo 2025-01-19 19:17:26 -08:00
parent 14e6c36c7b
commit c7c627f0d9
7 changed files with 47 additions and 10 deletions

View file

@ -4,14 +4,12 @@
#/etc/init.d/S50usbdevice start
#run only on first boot
if [ -e "/etc/.firstboot" ]; then
/usr/local/bin/femto-runonce.sh
fi
#if [ -e "/etc/.firstboot" ]; then
# /usr/local/bin/femto-runonce.sh
#fi
luckfox-config load
systemctl restart meshtasticd #TEMPORARY bugfix
# try enable RTC
echo 'ds1307 0x68' | sudo tee /sys/class/i2c-adapter/i2c-3/new_device > /dev/null 2>&1
@ -25,14 +23,14 @@ echo 34 > /sys/class/gpio/export && echo out > /sys/class/gpio/gpio34/direction
#(sleep 5 && cpufreq-set -u 408000 && echo "Boot complete, setting CPU frequency to 408mhz.") &
# run USB automount and config tool
/usr/local/bin/femto-usb-config-tool.sh
#/usr/local/bin/femto-usb-config-tool.sh
# boot complete
(
echo "Disabling ACT LED..."
echo "none" > /sys/class/leds/work/trigger &
sleep 1
# blink successful boot code
for i in $(seq 1 5); do
echo 1 > /sys/class/gpio/gpio34/value;

View file

@ -0,0 +1,16 @@
[Unit]
Description=Foxbuntu First Boot
After=meshtasticd.service
Requires=meshtasticd.service
Before=serial-getty@ttyFIQ0.service
DefaultDependencies=no
[Service]
ExecStart=/usr/local/bin/femto-runonce.sh
Type=oneshot
RemainAfterExit=true
StandardOutput=tty
StandardError=tty
[Install]
WantedBy=serial-getty@ttyFIQ0.service

View file

@ -0,0 +1,17 @@
[Unit]
Description=Foxbuntu USB Configuration Tool
After=femto-runonce.service meshtasticd.service
Before=serial-getty@ttyFIQ0.service
DefaultDependencies=no
[Service]
ExecStart=/usr/local/bin/femto-usb-config-tool.sh
Type=oneshot
RemainAfterExit=true
StandardOutput=journal+console
StandardError=journal+console
TTYPath=/dev/console
[Install]
WantedBy=serial-getty@ttyFIQ0.service

View file

@ -1,3 +1,6 @@
[Service]
ExecStartPost=/bin/sh -c 'renice -n -20 -p $(pgrep meshtasticd)'
[Unit]
After=rc-local.service
Wants=rc-local.service

View file

@ -155,7 +155,7 @@ done
if [ "$updated_wifi" = true ]; then
ip link set wlan0 up
systemctl restart wpa_supplicant
#systemctl restart wpa_supplicant
wpa_cli -i wlan0 reconfigure # <-------- add watch for FAIL response, error out
timeout 30s dhclient -v
#timeout 30s dhclient -v
fi

View file

@ -5,6 +5,9 @@ log_message() {
}
if [ ! -e "/etc/.firstboot" ]; then
who | grep -q . || exit 1
# prevents weirdness over tty
export NCURSES_NO_UTF8_ACS=1
export TERM=xterm-256color
@ -83,4 +86,4 @@ systemctl restart meshtasticd
rm /etc/.firstboot
log_message "Removing first boot flag and rebooting in 5 seconds..."
sleep 5
reboot
reboot