diff --git a/environment-setup/femtofox.chroot b/environment-setup/femtofox.chroot index ebf59e2..f3c1859 100644 --- a/environment-setup/femtofox.chroot +++ b/environment-setup/femtofox.chroot @@ -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 diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.d/femto_mac_address.yaml b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.d/femto_mac_address.yaml new file mode 100644 index 0000000..b1f2e8a --- /dev/null +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.d/femto_mac_address.yaml @@ -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 \ No newline at end of file diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.yaml b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.yaml.bak similarity index 100% rename from foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.yaml rename to foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/config.yaml.bak diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-runonce.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-runonce.service index d5692f4..574335d 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-runonce.service +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-runonce.service @@ -1,6 +1,6 @@ [Unit] Description=Foxbuntu First Boot -After=meshtasticd.service +After=rc-local.service Before=serial-getty@ttyFIQ0.service DefaultDependencies=no diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-usb-config-tool.service b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-usb-config-tool.service index 679b722..8f1c5dc 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-usb-config-tool.service +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/femto-usb-config-tool.service @@ -1,6 +1,6 @@ [Unit] Description=Foxbuntu USB Configuration Tool -After=meshtasticd.service +After=rc-local.service Before=serial-getty@ttyFIQ0.service DefaultDependencies=no diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/meshtasticd.service.d/override.conf b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/meshtasticd.service.d/override.conf index add99ee..2af10c1 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/meshtasticd.service.d/override.conf +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/systemd/system/meshtasticd.service.d/override.conf @@ -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] diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index 290ceff..cd17d1c 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -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 diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh index 6df8c8d..50e77d1 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh @@ -151,4 +151,4 @@ Full module info:\n$modinfo_output\n\nNote: Dependencies are loaded/unloaded aut done done -exit 0 \ No newline at end of file +exit 0 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 e3470cb..f467c0b 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 @@ -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..." diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh index 3b7fcf3..a5fe150 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -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 diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-watchclock-dog.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-watchclock-dog.sh index 6cefdfa..d6c56bc 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-watchclock-dog.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-watchclock-dog.sh @@ -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