Merge pull request #331 from femtofox/main

Update noon2
This commit is contained in:
noon92 2025-02-14 10:34:03 +02:00 • committed by GitHub
commit 784e5e5f44
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 40 additions and 10 deletions

View file

@ -56,13 +56,13 @@ echo "femtofox" | tee /etc/hostname > /dev/null
echo "Configuring autostart of systemd services..."
systemctl enable button
systemctl enable meshtasticd
systemctl enable femto-runonce.service
systemctl enable femto-usb-config-tool.service
systemctl enable femto-boot-complete.service
systemctl enable femto-wifi-mesh-control
systemctl enable femto-watchclock-dog
systemctl disable meshtasticd
systemctl disable apt-daily.timer
systemctl disable unattended-upgrades
systemctl disable smbd nmbd # samba services, can be enabled via menu
@ -100,6 +100,20 @@ sudo chage -d 0 femto
usermod -a -G tty femto
usermod -a -G dialout femto
# Ensure libgcc_s.so and libc_nonshared.a exist
mkdir -p /usr/lib/gcc/arm-linux-gnueabihf/11/
ln -sf /usr/lib/arm-linux-gnueabihf/libgcc_s.so.1 /usr/lib/gcc/arm-linux-gnueabihf/11/libgcc_s.so
ln -sf /usr/lib/arm-linux-gnueabihf/libgcc_s.so.1 /lib/libgcc_s.so.1
ln -sf /usr/lib/gcc/arm-linux-gnueabihf/11/libgcc_s.so /usr/lib/libgcc.so
# Add library paths
echo "/usr/lib/gcc/arm-linux-gnueabihf/11" | tee -a /etc/ld.so.conf.d/gcc.conf
ldconfig
# Back up libc_nonshared.a because build.sh removes it
cp /usr/lib/arm-linux-gnueabihf/libc_nonshared.a /usr/lib/arm-linux-gnueabihf/libc_nonshared.a.keep
echo "Cleaning up chroot..."
apt clean && rm -rf /var/lib/apt/lists/* && rm -rf /tmp/* && rm -rf /var/tmp/* && find /var/log -type f -exec truncate -s 0 {} + && : > /root/.bash_history && history -c
rm -rf /tmp/* && rm -rf /var/tmp/* && find /var/log -type f -exec truncate -s 0 {} + && : > /root/.bash_history && history -c
exit

View file

@ -0,0 +1,4 @@
# this sets the mac address source to eth0, replacing the previous code that derived a seed from the CPU s/n.
# of course, eth0 also has its mac address derived from CPU s/n, but this way meshtastic uses the exact mac address, instead of a bastardized version converted to a 9 digit int with `| bc | tail -c -9`.
General:
MACAddressSource: eth0

View file

@ -1,6 +1,6 @@
[Unit]
Description=Foxbuntu First Boot
After=meshtasticd.service
After=rc-local.service
Before=serial-getty@ttyFIQ0.service
DefaultDependencies=no

View file

@ -1,6 +1,6 @@
[Unit]
Description=Foxbuntu USB Configuration Tool
After=meshtasticd.service
After=rc-local.service
Before=serial-getty@ttyFIQ0.service
DefaultDependencies=no

View file

@ -1,6 +1,4 @@
[Service]
ExecStart=
ExecStart=/bin/sh -c '/usr/sbin/meshtasticd -h $(sed -n "/Serial/ s/^.*: \\(.*\\)$/\\U\\1/p" /proc/cpuinfo | bc | tail -c 9)'
Nice=-20
[Unit]

View file

@ -559,7 +559,7 @@ meshtastic_settings() {
;;
2) # view/change private key)
loading "Getting current private key..."
key=$(femto-meshtasticd-config.sh -u)
key=$(femto-meshtasticd-config.sh -r)
if [ -n "$key" ]; then
dialog --no-collapse --title "Meshtastic private key" --yesno "Current private key:\n$key\n\nSet new key?" 9 55
if [ $? -eq 0 ]; then #unless cancel/no

View file

@ -151,4 +151,4 @@ Full module info:\n$modinfo_output\n\nNote: Dependencies are loaded/unloaded aut
done
done
exit 0
exit 0

View file

@ -22,6 +22,7 @@ Re-running this script will:\n\
* Set the eth0 MAC to be derivative of CPU serial number\n\
* Add terminal type to user femto's .bashrc\n\
* Add a shortcut \`sfc\` to user femto's .bashrc\n\
* Enable the meshtasticd service\n\
\n\
Finally, the Femtofox will reboot.\n\
\n\
@ -98,6 +99,10 @@ else
log_message "TERM, LANG and NCURSES_NO_UTF8_ACS already present in .bashrc, skipping"
fi
# Fix Compiler
log_message "Fixing Compiler."
cp /usr/lib/arm-linux-gnueabihf/libc_nonshared.a.keep /usr/lib/arm-linux-gnueabihf/libc_nonshared.a
# Add a cheeky alias to .bash_aliases
if ! grep -Fxq "alias sfc='sudo femto-config'" /home/femto/.bashrc; then # Check if the lines are already in .bash_aliases
echo "alias sfc='sudo femto-config'" >> /home/femto/.bashrc
@ -106,6 +111,9 @@ else
log_message "\`alias sfc='sudo femto-config'\` already present in .bashrc, skipping"
fi
log_message "Enabling meshtasticd service"
systemctl enable meshtasticd
# remove first boot flag
sed -i -E 's/^first_boot=.*/first_boot=false/' /etc/femto.conf
log_message "Removing first boot flag and rebooting in 5 seconds..."

View file

@ -112,7 +112,7 @@ package_menu() {
if [ $exit_status -eq 1 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog
return
elif [ $exit_status -eq 2 ]; then # Help ("extra") button
dialog --no-collapse --colors --title "$($package_dir/$1.sh -N) License" --msgbox "$($package_dir/$1.sh -G)" 0 0
dialog --no-collapse --colors --title "$($package_dir/$1.sh -N) License" --msgbox " \Zu$($package_dir/$1.sh -N)\Zn\n$(if output=$($package_dir/$1.sh -T); [ -n "$output" ]; then echo "License: $output"; fi)\n\n$($package_dir/$1.sh -G)" 0 0
else
# execute the actual commands
case $choice in

View file

@ -23,6 +23,12 @@ if [ ! -w "$LAST_TIME_FILE" ]; then
fi
while true; do
# Check if meshtasticd service is running
if ! systemctl is-active --quiet meshtasticd; then
#echo "meshtasticd service is not running. Skipping..." | tee -a "$LOGFILE"
sleep 30
continue
fi
NEW_TIME=$(date +%s)
# Ensure last_time file is readable before using it
@ -47,6 +53,6 @@ while true; do
exit 1
fi
sleep 5
sleep 30
done