From 8cf90bd4169189498b9a922722284413de23ba84 Mon Sep 17 00:00:00 2001 From: nagumii Date: Mon, 6 Jan 2025 15:52:21 +0200 Subject: [PATCH 01/25] +x --- .../rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh 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 old mode 100644 new mode 100755 From dec8177266b12a0b321eb0531859edc67f05f561 Mon Sep 17 00:00:00 2001 From: nagumii Date: Mon, 6 Jan 2025 16:04:06 +0200 Subject: [PATCH 02/25] Increase chrony minimum poll time to 4.5 hours Closes #68 --- .../rootfs_uclibc_rv1106/etc/chrony/chrony.conf | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/chrony/chrony.conf b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/chrony/chrony.conf index 4a51609..94313eb 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/chrony/chrony.conf +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/chrony/chrony.conf @@ -17,14 +17,14 @@ confdir /etc/chrony/conf.d # About using servers from the NTP Pool Project in general see (LP: #104525). # Approved by Ubuntu Technical Board on 2011-02-08. # See http://www.pool.ntp.org/join.html for more information. -pool ntp.ubuntu.com iburst maxsources 4 -pool 0.ubuntu.pool.ntp.org iburst maxsources 1 -pool 1.ubuntu.pool.ntp.org iburst maxsources 1 -pool 2.ubuntu.pool.ntp.org iburst maxsources 2 -server 0.pool.ntp.org iburst -server 1.pool.ntp.org iburst -server 2.pool.ntp.org iburst -server 3.pool.ntp.org iburst +pool ntp.ubuntu.com iburst maxsources 4 minpoll 14 +pool 0.ubuntu.pool.ntp.org iburst maxsources 1 minpoll 14 +pool 1.ubuntu.pool.ntp.org iburst maxsources 1 minpoll 14 +pool 2.ubuntu.pool.ntp.org iburst maxsources 2 minpoll 14 +server 0.pool.ntp.org iburst minpoll 14 +server 1.pool.ntp.org iburst minpoll 14 +server 2.pool.ntp.org iburst minpoll 14 +server 3.pool.ntp.org iburst minpoll 14 # Use time sources from DHCP. sourcedir /run/chrony-dhcp From b0e34b98402ae3eca42a0cb94e408379d1237d46 Mon Sep 17 00:00:00 2001 From: noon92 <40807970+noon92@users.noreply.github.com> Date: Mon, 6 Jan 2025 18:30:39 +0200 Subject: [PATCH 03/25] usb_config.md updated from https://stackedit.io/ --- usb_config.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/usb_config.md b/usb_config.md index 6b37c0b..5b2f5ab 100644 --- a/usb_config.md +++ b/usb_config.md @@ -65,7 +65,10 @@ When the Femtofox is finished booting, it will blink its User LED (see below) in |--|--|--|--| |
⚠️
________________
1 very long blink, lasting 5 seconds| Failed to mount USB drive. Ignoring.|
  • Invalid filesystem
  • Corrupted partition table
  • Defective USB drive
  • Defective USB OTG adapter |
  • Use a supported partition (FAT32, exFAT, NTFS, ext4)
  • Repair partition table
  • Try another USB drive
  • Try another USB OTG adapter | |
    ⚠️
    \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_
    3 long blinks, each lasting 1.5 seconds | USB drive mounted successfully but femtofox-config.txt was not found. Ignoring.| Config file missing. | Create configuration file as described above. | -|
    ⚠️
    \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_
    5 long blinks, each lasting 1.5 seconds | USB drive mounted successfully and femtofox-config.txt was found but did not contain readable configuration data. Ignoring.| Configuration file improperly formatted or contains no data. | Check configuration file contents as described above. | +| +
    ⚠️
    \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_
    5 long blinks, each lasting 1.5 seconds | USB drive mounted successfully and femtofox-config.txt was found but did not contain readable configuration data. Ignoring.| Configuration file improperly formatted or contains no data. | Check configuration file contents as described above. | +| +
    ⚠️
    \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_
    5 long blinks, each lasting 1.5 seconds | USB drive mounted successfully and femtofox-config.txt was found but did not contain readable configuration data. Ignoring.| Configuration file improperly formatted or contains no data. | Check configuration file contents as described above. | |
    ⚠️
    \_\_\_  \_\_\_  \_  \_  \_\_\_  \_\_\_  \_  \_
    2 long blinks, each lasting 1 seconds, then 2 short blinks, each lasting 1/4 of a second. Repeats twice | Error while trying to implement a Meshtastic setting after 3 attempts. Some settings may have been implemented successfully.|
  • The error may be transient.
  • Configuration file may contain improper data. |
  • Try again.
  • Check configuration file contents as described above.
  • Check the log.

    This pattern may flash before other patterns. The pattern will repeat once for each failed setting.| |
    ✅
    . . . . . . . . . .
    10 very fast blinks, each lasting 1/8th of a second | USB drive mounted successfully, and femtofox-config.txt was found and contained configuration data which was sent for deployment. Any affected services will now restart. You can disconnect the USB drive. | This does not mean that the information in the config file is correct - only that it was readable.
    Note that the "success" boot code will flash if at least one setting is successfully read - even if the setting was not implemented successfully.| |
    ✅
    \_\_  \_\_  \_\_  \_\_  \_\_
    5 medium blinks, each lasting 0.5 seconds | Boot complete. Appears on every successful boot and always appears last.| | | @@ -73,5 +76,5 @@ When the Femtofox is finished booting, it will blink its User LED (see below) in > [!NOTE] > Boot codes can appear in sequence - for example: one long (4 second) blink, followed by 5 medium (half second) blinks means the USB drive failed to mount, and that the boot sequence is complete. \ No newline at end of file From 6fc853ec3e5a2602af6f8213faec8f21bf57259e Mon Sep 17 00:00:00 2001 From: noon92 <40807970+noon92@users.noreply.github.com> Date: Mon, 6 Jan 2025 18:32:13 +0200 Subject: [PATCH 04/25] usb_config.md updated from https://stackedit.io/ --- usb_config.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/usb_config.md b/usb_config.md index 5b2f5ab..c5696c2 100644 --- a/usb_config.md +++ b/usb_config.md @@ -64,11 +64,9 @@ When the Femtofox is finished booting, it will blink its User LED (see below) in | LED blink pattern | Meaning | Possible causes | Solutions | |--|--|--|--| |
    ⚠️
    ________________
    1 very long blink, lasting 5 seconds| Failed to mount USB drive. Ignoring.|
  • Invalid filesystem
  • Corrupted partition table
  • Defective USB drive
  • Defective USB OTG adapter |
  • Use a supported partition (FAT32, exFAT, NTFS, ext4)
  • Repair partition table
  • Try another USB drive
  • Try another USB OTG adapter | -|
    ⚠️
    \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_
    3 long blinks, each lasting 1.5 seconds | USB drive mounted successfully but femtofox-config.txt was not found. Ignoring.| Config file missing. | Create configuration file as described above. | -| -
    ⚠️
    \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_
    5 long blinks, each lasting 1.5 seconds | USB drive mounted successfully and femtofox-config.txt was found but did not contain readable configuration data. Ignoring.| Configuration file improperly formatted or contains no data. | Check configuration file contents as described above. | -| -
    ⚠️
    \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_
    5 long blinks, each lasting 1.5 seconds | USB drive mounted successfully and femtofox-config.txt was found but did not contain readable configuration data. Ignoring.| Configuration file improperly formatted or contains no data. | Check configuration file contents as described above. | +|
    ⚠️
    \_\_\_\_\_  \_\_\_\_\_
    3 long blinks, each lasting 1.5 seconds | USB drive mounted successfully but femtofox-config.txt was not found. Ignoring.| Config file missing. | Create configuration file as described above. | +|
    ⚠️
    \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_
    2 long blinks, each lasting 1.5 seconds | USB drive mounted successfully but femtofox-config.txt was not found. Ignoring.| Config file missing. | Create configuration file as described above. | +|
    ⚠️
    \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_
    5 long blinks, each lasting 1.5 seconds | USB drive mounted successfully and femtofox-config.txt was found but did not contain readable configuration data. Ignoring.| Configuration file improperly formatted or contains no data. | Check configuration file contents as described above. | |
    ⚠️
    \_\_\_  \_\_\_  \_  \_  \_\_\_  \_\_\_  \_  \_
    2 long blinks, each lasting 1 seconds, then 2 short blinks, each lasting 1/4 of a second. Repeats twice | Error while trying to implement a Meshtastic setting after 3 attempts. Some settings may have been implemented successfully.|
  • The error may be transient.
  • Configuration file may contain improper data. |
  • Try again.
  • Check configuration file contents as described above.
  • Check the log.

    This pattern may flash before other patterns. The pattern will repeat once for each failed setting.| |
    ✅
    . . . . . . . . . .
    10 very fast blinks, each lasting 1/8th of a second | USB drive mounted successfully, and femtofox-config.txt was found and contained configuration data which was sent for deployment. Any affected services will now restart. You can disconnect the USB drive. | This does not mean that the information in the config file is correct - only that it was readable.
    Note that the "success" boot code will flash if at least one setting is successfully read - even if the setting was not implemented successfully.| |
    ✅
    \_\_  \_\_  \_\_  \_\_  \_\_
    5 medium blinks, each lasting 0.5 seconds | Boot complete. Appears on every successful boot and always appears last.| | | @@ -76,5 +74,6 @@ When the Femtofox is finished booting, it will blink its User LED (see below) in > [!NOTE] > Boot codes can appear in sequence - for example: one long (4 second) blink, followed by 5 medium (half second) blinks means the USB drive failed to mount, and that the boot sequence is complete. \ No newline at end of file From a97ebdfc181bb32827bb33dd778c2eb6bf468073 Mon Sep 17 00:00:00 2001 From: noon92 <40807970+noon92@users.noreply.github.com> Date: Mon, 6 Jan 2025 18:33:47 +0200 Subject: [PATCH 05/25] usb_config.md updated from https://stackedit.io/ --- usb_config.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usb_config.md b/usb_config.md index c5696c2..5b1705b 100644 --- a/usb_config.md +++ b/usb_config.md @@ -64,16 +64,16 @@ When the Femtofox is finished booting, it will blink its User LED (see below) in | LED blink pattern | Meaning | Possible causes | Solutions | |--|--|--|--| |
    ⚠️
    ________________
    1 very long blink, lasting 5 seconds| Failed to mount USB drive. Ignoring.|
  • Invalid filesystem
  • Corrupted partition table
  • Defective USB drive
  • Defective USB OTG adapter |
  • Use a supported partition (FAT32, exFAT, NTFS, ext4)
  • Repair partition table
  • Try another USB drive
  • Try another USB OTG adapter | -|
    ⚠️
    \_\_\_\_\_  \_\_\_\_\_
    3 long blinks, each lasting 1.5 seconds | USB drive mounted successfully but femtofox-config.txt was not found. Ignoring.| Config file missing. | Create configuration file as described above. | -|
    ⚠️
    \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_
    2 long blinks, each lasting 1.5 seconds | USB drive mounted successfully but femtofox-config.txt was not found. Ignoring.| Config file missing. | Create configuration file as described above. | +|
    ⚠️
    \_\_\_\_\_  \_\_\_\_\_
    2 long blinks, each lasting 1.5 seconds | USB drive mounted successfully but femtofox-config.txt contains the `dont_run_config_if_log_exists` line and a log is present on the USB drive... Ignoring.| Config file missing. | Create configuration file as described above. | +|
    ⚠️
    \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_
    3 long blinks, each lasting 1.5 seconds | USB drive mounted successfully but femtofox-config.txt was not found. Ignoring.| Config file missing. | Create configuration file as described above. | |
    ⚠️
    \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_
    5 long blinks, each lasting 1.5 seconds | USB drive mounted successfully and femtofox-config.txt was found but did not contain readable configuration data. Ignoring.| Configuration file improperly formatted or contains no data. | Check configuration file contents as described above. | -|
    ⚠️
    \_\_\_  \_\_\_  \_  \_  \_\_\_  \_\_\_  \_  \_
    2 long blinks, each lasting 1 seconds, then 2 short blinks, each lasting 1/4 of a second. Repeats twice | Error while trying to implement a Meshtastic setting after 3 attempts. Some settings may have been implemented successfully.|
  • The error may be transient.
  • Configuration file may contain improper data. |
  • Try again.
  • Check configuration file contents as described above.
  • Check the log.

    This pattern may flash before other patterns. The pattern will repeat once for each failed setting.| +|
    ⚠️
    \_\_\_  \_\_\_  \_  \_  \_\_\_  \_\_\_  \_  \_
    2 long blinks, each lasting 1 second, then 2 short blinks, each lasting 1/4 of a second. Repeats twice | Error while trying to implement a Meshtastic setting after 3 attempts. Some settings may have been implemented successfully.|
  • The error may be transient.
  • Configuration file may contain improper data. |
  • Try again.
  • Check configuration file contents as described above.
  • Check the log.

    This pattern may flash before other patterns. The pattern will repeat once for each failed setting.| |
    ✅
    . . . . . . . . . .
    10 very fast blinks, each lasting 1/8th of a second | USB drive mounted successfully, and femtofox-config.txt was found and contained configuration data which was sent for deployment. Any affected services will now restart. You can disconnect the USB drive. | This does not mean that the information in the config file is correct - only that it was readable.
    Note that the "success" boot code will flash if at least one setting is successfully read - even if the setting was not implemented successfully.| |
    ✅
    \_\_  \_\_  \_\_  \_\_  \_\_
    5 medium blinks, each lasting 0.5 seconds | Boot complete. Appears on every successful boot and always appears last.| | | > [!NOTE] > Boot codes can appear in sequence - for example: one long (4 second) blink, followed by 5 medium (half second) blinks means the USB drive failed to mount, and that the boot sequence is complete. \ No newline at end of file From cb779c57f1fee78975ccd2128d2c5f6693c2889f Mon Sep 17 00:00:00 2001 From: noon92 <40807970+noon92@users.noreply.github.com> Date: Mon, 6 Jan 2025 18:35:21 +0200 Subject: [PATCH 06/25] usb_config.md updated from https://stackedit.io/ --- usb_config.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/usb_config.md b/usb_config.md index 5b1705b..4c088c2 100644 --- a/usb_config.md +++ b/usb_config.md @@ -64,7 +64,7 @@ When the Femtofox is finished booting, it will blink its User LED (see below) in | LED blink pattern | Meaning | Possible causes | Solutions | |--|--|--|--| |
    ⚠️
    ________________
    1 very long blink, lasting 5 seconds| Failed to mount USB drive. Ignoring.|
  • Invalid filesystem
  • Corrupted partition table
  • Defective USB drive
  • Defective USB OTG adapter |
  • Use a supported partition (FAT32, exFAT, NTFS, ext4)
  • Repair partition table
  • Try another USB drive
  • Try another USB OTG adapter | -|
    ⚠️
    \_\_\_\_\_  \_\_\_\_\_
    2 long blinks, each lasting 1.5 seconds | USB drive mounted successfully but femtofox-config.txt contains the `dont_run_config_if_log_exists` line and a log is present on the USB drive... Ignoring.| Config file missing. | Create configuration file as described above. | +|
    ⚠️
    \_\_\_\_\_  \_\_\_\_\_
    2 long blinks, each lasting 1.5 seconds | USB drive mounted successfully but femtofox-config.txt contains the `dont_run_config_if_log_exists` line and a log is present on the USB drive. Ignoring.| Misconfiguration. | Remove log from USB drive or remove `dont_run_config_if_log_exists` line from femtofox-config.txt | |
    ⚠️
    \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_
    3 long blinks, each lasting 1.5 seconds | USB drive mounted successfully but femtofox-config.txt was not found. Ignoring.| Config file missing. | Create configuration file as described above. | |
    ⚠️
    \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_  \_\_\_\_\_
    5 long blinks, each lasting 1.5 seconds | USB drive mounted successfully and femtofox-config.txt was found but did not contain readable configuration data. Ignoring.| Configuration file improperly formatted or contains no data. | Check configuration file contents as described above. | |
    ⚠️
    \_\_\_  \_\_\_  \_  \_  \_\_\_  \_\_\_  \_  \_
    2 long blinks, each lasting 1 second, then 2 short blinks, each lasting 1/4 of a second. Repeats twice | Error while trying to implement a Meshtastic setting after 3 attempts. Some settings may have been implemented successfully.|
  • The error may be transient.
  • Configuration file may contain improper data. |
  • Try again.
  • Check configuration file contents as described above.
  • Check the log.

    This pattern may flash before other patterns. The pattern will repeat once for each failed setting.| @@ -74,6 +74,5 @@ When the Femtofox is finished booting, it will blink its User LED (see below) in > [!NOTE] > Boot codes can appear in sequence - for example: one long (4 second) blink, followed by 5 medium (half second) blinks means the USB drive failed to mount, and that the boot sequence is complete. \ No newline at end of file From 830ddffbf8ff91e6fbce154af0ee687719ca153c Mon Sep 17 00:00:00 2001 From: noon92 <40807970+noon92@users.noreply.github.com> Date: Mon, 6 Jan 2025 18:36:31 +0200 Subject: [PATCH 07/25] usb_config.md updated from https://stackedit.io/ --- usb_config.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usb_config.md b/usb_config.md index 4c088c2..d8de72a 100644 --- a/usb_config.md +++ b/usb_config.md @@ -27,6 +27,7 @@ meshtastic_lora_radio="ebyte-e22-900m30s" meshtastic_url="https://meshtastic.org/e/#CgMSAQESCAgBOAFAA0gB" meshtastic_admin_key="T/b8EGvi/Nqi6GyGefJt/jOQr+5uWHHZuBavkNcUwWQ=" meshtastic_legacy_admin="true" +dont_run_if_log_exists ``` > [!NOTE] > Enter as many or as few settings as you like. @@ -74,5 +75,5 @@ When the Femtofox is finished booting, it will blink its User LED (see below) in > [!NOTE] > Boot codes can appear in sequence - for example: one long (4 second) blink, followed by 5 medium (half second) blinks means the USB drive failed to mount, and that the boot sequence is complete. \ No newline at end of file From d4e8a2bf723377a7335978c6647e060cecf08de6 Mon Sep 17 00:00:00 2001 From: noon92 <40807970+noon92@users.noreply.github.com> Date: Mon, 6 Jan 2025 18:39:05 +0200 Subject: [PATCH 08/25] Update femtofox-config.txt to include `dont_run_if_log_exists` --- assets/femtofox-config.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/assets/femtofox-config.txt b/assets/femtofox-config.txt index 7e90931..7e656b4 100644 --- a/assets/femtofox-config.txt +++ b/assets/femtofox-config.txt @@ -3,6 +3,8 @@ ## To set a setting, uncomment a line by removing its preceeding `#` ## All settings are optional - remove any you don't want to set. +### If the following line is uncommented, USB config will be skipped if a log file is present on the USB drive, indicating the tool has already been run on this system +#dont_run_if_log_exists ### Foxbuntu settings From 8039667d963daf21bd04eb6e02a58e9f55265b63 Mon Sep 17 00:00:00 2001 From: noon92 <40807970+noon92@users.noreply.github.com> Date: Mon, 6 Jan 2025 18:40:08 +0200 Subject: [PATCH 09/25] Update femtofox-config.txt --- assets/femtofox-config.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/assets/femtofox-config.txt b/assets/femtofox-config.txt index 7e656b4..401ad63 100644 --- a/assets/femtofox-config.txt +++ b/assets/femtofox-config.txt @@ -3,9 +3,6 @@ ## To set a setting, uncomment a line by removing its preceeding `#` ## All settings are optional - remove any you don't want to set. -### If the following line is uncommented, USB config will be skipped if a log file is present on the USB drive, indicating the tool has already been run on this system -#dont_run_if_log_exists - ### Foxbuntu settings ## Localization settings. CaSe SeNsItIvE @@ -43,3 +40,7 @@ ## To clear the admin key list, enter `meshtastic_admin_key="clear"` #meshtastic_admin_key="XX=" #meshtastic_legacy_admin="false" + + +### If the following line is uncommented, USB config will be skipped if a log file is present on the USB drive, indicating the tool has already been run on this system +#dont_run_if_log_exists From d92ac547c32f48d9c347711f0884d23f93054ee4 Mon Sep 17 00:00:00 2001 From: noon92 <40807970+noon92@users.noreply.github.com> Date: Mon, 6 Jan 2025 18:43:35 +0200 Subject: [PATCH 10/25] usb_config.md updated from https://stackedit.io/ --- usb_config.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/usb_config.md b/usb_config.md index d8de72a..ebd5c97 100644 --- a/usb_config.md +++ b/usb_config.md @@ -56,6 +56,9 @@ dont_run_if_log_exists > [!CAUTION] > Attempting to set wifi settings via USB configuration tool without a wifi adapter connected will lead to a 5 minute hang while the configuration tool runs - either disconnect and reconnect power or wait the full 5 minutes to to recover. +> [!NOTE] +> `dont_run_if_log_exists` will prevent the USB configuration tool from working if there's a log present on the USB drive, indicating it has already been run. There is also an LED boot code for this, descri + **To apply your configuration, reboot the Femtofox with the USB drive plugged in. No other USB drives can be plugged in at the same time.** A log (`femtofox-config.log`) is saved to `/home/femto` and the USB drive (except on NTFS, which is read only).
    @@ -75,5 +78,6 @@ When the Femtofox is finished booting, it will blink its User LED (see below) in > [!NOTE] > Boot codes can appear in sequence - for example: one long (4 second) blink, followed by 5 medium (half second) blinks means the USB drive failed to mount, and that the boot sequence is complete. \ No newline at end of file From f1e4f82d52aed221e338b28aee1e883f6cbe873d Mon Sep 17 00:00:00 2001 From: noon92 <40807970+noon92@users.noreply.github.com> Date: Mon, 6 Jan 2025 18:43:45 +0200 Subject: [PATCH 11/25] usb_config.md updated from https://stackedit.io/ --- usb_config.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usb_config.md b/usb_config.md index ebd5c97..5da6e92 100644 --- a/usb_config.md +++ b/usb_config.md @@ -57,7 +57,7 @@ dont_run_if_log_exists > Attempting to set wifi settings via USB configuration tool without a wifi adapter connected will lead to a 5 minute hang while the configuration tool runs - either disconnect and reconnect power or wait the full 5 minutes to to recover. > [!NOTE] -> `dont_run_if_log_exists` will prevent the USB configuration tool from working if there's a log present on the USB drive, indicating it has already been run. There is also an LED boot code for this, descri +> `dont_run_if_log_exists` will prevent the USB configuration tool from working if there's a log present on the USB drive, indicating it has already been run. There is also an LED boot code for this, described below. **To apply your configuration, reboot the Femtofox with the USB drive plugged in. No other USB drives can be plugged in at the same time.** A log (`femtofox-config.log`) is saved to `/home/femto` and the USB drive (except on NTFS, which is read only). @@ -78,6 +78,6 @@ When the Femtofox is finished booting, it will blink its User LED (see below) in > [!NOTE] > Boot codes can appear in sequence - for example: one long (4 second) blink, followed by 5 medium (half second) blinks means the USB drive failed to mount, and that the boot sequence is complete. \ No newline at end of file From 7db4596fde62b321ec2955625320c737b310ba54 Mon Sep 17 00:00:00 2001 From: Tom <116762865+Nestpebble@users.noreply.github.com> Date: Tue, 7 Jan 2025 12:02:23 +0000 Subject: [PATCH 12/25] usb_config.md updated from https://stackedit.io/ --- usb_config.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usb_config.md b/usb_config.md index 5da6e92..579f86f 100644 --- a/usb_config.md +++ b/usb_config.md @@ -32,7 +32,7 @@ dont_run_if_log_exists > [!NOTE] > Enter as many or as few settings as you like. > -> For `wifi_country`, insert your country's two letter code (such as US or IN) in capital letters. +> For `wifi_country`, insert your country's ISO/IEC alpha2 two letter country code (such as US, GB, DE, IN, etc.) in capital letters. > > Use a timezone as it appears in [the tz database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). > @@ -78,6 +78,6 @@ When the Femtofox is finished booting, it will blink its User LED (see below) in > [!NOTE] > Boot codes can appear in sequence - for example: one long (4 second) blink, followed by 5 medium (half second) blinks means the USB drive failed to mount, and that the boot sequence is complete. \ No newline at end of file From f72d7fd500e481f075a57f6be04ab124b23d7de9 Mon Sep 17 00:00:00 2001 From: Tom <116762865+Nestpebble@users.noreply.github.com> Date: Tue, 7 Jan 2025 12:03:55 +0000 Subject: [PATCH 13/25] usb_config.md updated from https://stackedit.io/ --- usb_config.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usb_config.md b/usb_config.md index 579f86f..3938482 100644 --- a/usb_config.md +++ b/usb_config.md @@ -32,7 +32,7 @@ dont_run_if_log_exists > [!NOTE] > Enter as many or as few settings as you like. > -> For `wifi_country`, insert your country's ISO/IEC alpha2 two letter country code (such as US, GB, DE, IN, etc.) in capital letters. +> For `wifi_country`, insert your country's [ISO/IEC alpha2 two letter country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) (such as US, GB, DE, IN, etc.) in capital letters. > > Use a timezone as it appears in [the tz database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). > @@ -78,6 +78,6 @@ When the Femtofox is finished booting, it will blink its User LED (see below) in > [!NOTE] > Boot codes can appear in sequence - for example: one long (4 second) blink, followed by 5 medium (half second) blinks means the USB drive failed to mount, and that the boot sequence is complete. \ No newline at end of file From 84b99133b2a98fc8a02eaa450b63cc74bdcf7770 Mon Sep 17 00:00:00 2001 From: nagumii Date: Tue, 7 Jan 2025 15:11:55 +0200 Subject: [PATCH 14/25] TC2-BBS installer WIP @thecommschannel --- .../usr/local/bin/femto-config | 13 +- .../usr/local/bin/femto-install-wizard.sh | 2 +- .../usr/local/bin/femto-software.sh | 197 ++++++++++++++++++ 3 files changed, 208 insertions(+), 4 deletions(-) create mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh 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 b03459c..311b2c8 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 @@ -39,7 +39,7 @@ wifi_config() { local wifi_country="" wifi_ssid=$(dialog --title "$title2" --inputbox "Enter Wi-Fi SSID:" 8 40 "$(grep -oP '^ *ssid="\K[^"]+' /etc/wpa_supplicant/wpa_supplicant.conf)" 3>&1 1>&2 2>&3) # display current SSID wifi_psk=$(dialog --title "$title2" --inputbox "Enter Wi-Fi Password:" 8 40 3>&1 1>&2 2>&3) - wifi_country=$(dialog --title "$title2" --inputbox "Enter Country Code (US, DE...):" 9 40 "$(grep -oP '^ *country=\K[^ ]+' /etc/wpa_supplicant/wpa_supplicant.conf)" 3>&1 1>&2 2>&3) # display current country + wifi_country=$(dialog --title "$title2" --inputbox "Enter Country Code (US, DE...):" 8 40 "$(grep -oP '^ *country=\K[^ ]+' /etc/wpa_supplicant/wpa_supplicant.conf)" 3>&1 1>&2 2>&3) # display current country cmd="femto-network-config.sh -s \"$wifi_ssid\" -p \"$wifi_psk\"" [ -n "$wifi_country" ] && cmd="$cmd -c \"$wifi_country\"" cmd="$cmd -r" @@ -459,8 +459,15 @@ help_menu() { } # Parse options -while getopts ":lw" opt; do +while getopts ":hlw" opt; do case ${opt} in + h) + echo -e "If script is run without arguments, the main femto-config UI will load.\n\ +Options are:\n\ +-h This message\n\ +-l Set LoRa radio model menu\n\ +-w Set Wi-Fi config menu" + ;; l) # Option -l (set lora radio) set_lora_radio ;; @@ -494,7 +501,7 @@ while true; do 1) femto-install-wizard.sh ;; 2) networking_settings ;; 3) meshtasticd_settings ;; - 4) femto-software-menu.sh ;; + 4) femto-software.sh ;; 5) utilities ;; 6) help_menu ;; 7) break ;; diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh index f06e954..861603c 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh @@ -45,7 +45,7 @@ wizard() { femto-config -l - key=$(dialog --title "$title" --cancel-label "Skip" --inputbox "Enter Meshtastic admin key (optional). If 3 admin keys are already in Meshtastic, more will be ignored.\n(SHIFT+INS to paste):" 8 50 3>&1 1>&2 2>&3) + key=$(dialog --title "$title" --cancel-label "Skip" --inputbox "Enter Meshtastic admin key (optional). If 3 admin keys are already in Meshtastic, more will be ignored.\n(SHIFT+INS to paste):" 11 50 3>&1 1>&2 2>&3) if [ -n "$key" ]; then #if a URL was entered femto-meshtasticd-config.sh -a "$key" pause 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 new file mode 100644 index 0000000..9c0ccc1 --- /dev/null +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh @@ -0,0 +1,197 @@ +#!/bin/bash + +uninstall="false" + +meshing_around() { # Install Meshing Around + failedInstall=false + #check if /opt/meshing-around exists if not git clone + if [ ! -d /opt/meshing-around ]; then + dialog --title "$software" --yesno "Meshing Around is a feature-rich bot designed to enhance your Meshtastic network experience with a variety of powerful tools and fun features\nConnectivity and utility through text-based message delivery.\nWhether you're looking to perform network tests, send messages, or even play games, mesh_bot.py has you covered.\nInstallation requires internet connection.\n\nLearn more at https://github.com/SpudGunMan/meshing-around\nIf software is already present, will attempt to update.\n\nInstall?" 0 0 + if [ $? -eq 0 ]; then #unless cancel/no + if ! git clone https://github.com/spudgunman/meshing-around /opt/meshing-around; then + dialog --title "$software" --msgbox "\nCloning of Meshing Around git repo failed.\nCheck internet connectivity." 10 60 + failedInstall=true + fi + fi + else + # /opt/meshing-around exists, check for updates + cd /opt/meshing-around + if ! sudo git pull; then + dialog --title "$software" --msgbox "\nFailed to update Meshing Around.\nCheck internet connectivity." 10 60 + failedInstall=true + fi + # check if /opt/meshing-around/data has any .pkl files if so assume it's installed + if [ -n "$(find /opt/meshing-around/data -name '*.pkl' -print -quit)" ]; then + # todo uninstall? + dialog --title "$software" --yesno "Meshing Around appears installed and updated, do you want to edit the config file? (press ctl+o,enter to save, ctl+x to exit nano)" 0 0 + if [ $? -eq 0 ]; then #unless cancel/no + sudo nano /opt/meshing-around/config.ini + fi + # set flag to not run install.sh + installed=true + echo "Restarting services..." + sudo systemctl restart mesh_bot + sudo systemctl restart pong_bot + fi + fi + # if /opt/meshing-around exists + if [ -f /opt/meshing-around/install.sh ] && [ "$installed" != true ] && [ "$failedInstall" != true ]; then + # ask what type of bot mesh or pong + dialog --title "$software" --yesno "Meshing Around can be configured to run as mesh_bot or pong_bot.\n\nRun mesh_bot?" 0 0 + if [ $? -eq 0 ]; then #unless cancel/no + /opt/meshing-around/install.sh mesh + dialog --title "$software" --yesno "Would you like to edit the config file? (press ctl+s save, ctl+x to exit editor)" 0 0 + if [ $? -eq 0 ]; then #unless cancel/no + sudo nano /opt/meshing-around/config.ini + echo "Restarting services..." + sudo systemctl restart mesh_bot + fi + # finished. display the contents of install_notes.txt + dialog --title "$software" --textbox /opt/meshing-around/install_notes.txt 20 60 + else + /opt/meshing-around/install.sh pong + dialog --title "$software" --yesno "Would you like to edit the config file? (press ctl+s save, ctl+x to exit editor)" 0 0 + if [ $? -eq 0 ]; then #unless cancel/no + sudo nano /opt/meshing-around/config.ini + echo "Restarting services..." + sudo systemctl restart pong_bot + fi + # finished. display the contents of install_notes.txt + dialog --title "$software" --textbox /opt/meshing-around/install_notes.txt 20 60 + fi + fi +} + + +tc2_bbs() { # Install TC²BBS + failedInstall=false + dialog --title "$software" --yesno "The TC²-BBS system integrates with Meshtastic devices. The system allows for message handling, bulletin boards, mail systems, and a channel directory.\nInstallation requires internet connection.\n\nLearn more at https://github.com/TheCommsChannel/TC2-BBS-mesh\nIf software is already present, will attempt to update.\n\nInstall?" 0 0 + if [ ! -d /opt/TC2-BBS-mesh ]; then + if [ $? -eq 0 ]; then #unless cancel/no + if ! git clone https://github.com/TheCommsChannel/TC2-BBS-mesh.git /opt/TC2-BBS-mesh; then + dialog --title "$software" --msgbox "\nCloning of TC²-BBS git repo failed.\nCheck internet connectivity." 10 60 + return + fi + else + return + fi + else + # /opt/meshing-around exists, check for updates + cd /opt/TC2-BBS-mesh + if ! sudo git pull; then + dialog --title "$software" --msgbox "\nFailed to update TC²-BBS.\nCheck internet connectivity." 10 60 + return + fi + fi + if [ ! -f /opt/TC2-BBS-mesh/config.ini ]; then # if the config file doesn't exist but the clone was successful, then we need to do some configuring and rejiggering + cd /opt/TC2-BBS-mesh + echo "Creating virtual environment. This can take a couple minutes." + python3 -m venv venv + source venv/bin/activate + pip install -r requirements.txt + mv example_config.ini config.ini + sed -i 's/type = serial/type = tcp/' config.ini + sed -i 's/^# hostname = 192.168.x.x/hostname = 127.0.0.1/' config.ini + fi + dialog --title "$software" --yesno "Installation/upgrade successful! \n\nInstall service?\n\nIn Linux, services automatically start on boot and restart if the software stops for any reason." 0 0 + if [ $? -eq 0 ]; then #unless cancel/no + source venv/bin/activate + sed -i "s/pi/${SUDO_USER:-$(whoami)}/g" mesh-bbs.service + sed -i "s|/home/femto/|/opt/|g" mesh-bbs.service + cp mesh-bbs.service /etc/systemd/system/ + sudo systemctl enable mesh-bbs.service + sudo systemctl restart mesh-bbs.service + echo -e "Waiting for service to start...\n" + sleep 7 + systemctl status mesh-bbs.service + echo "\nPress any key to continue..." + read -n 1 -s -r + fi +} + + +curses_client() { # Install curses client + git clone https://github.com/pdxlocations/curses-client-for-meshtastic.git /opt/curses-client-for-meshtastic + ln -s /opt/curses-client-for-meshtastic/meshtastic-curses.py ~/meshtastic-curses.py + # config the curses client to localhost tcp TODO, permissions? + dialog --title "$software" --msgbox "\nInstallation complete.\n\nRun \`~/meshtastic-curses.py\` to launch." 10 60 +} + + +mosquitto() { # Install mosquitto + apt update + DEBIAN_FRONTEND=noninteractive apt install -y --option Dpkg::Options::="--force-confold" mosquitto mosquitto-clients + # config mosquitto to listen on all interfaces and allow anonymous + sudo sh -c "echo 'listener 1883 0.0.0.0\nallow_anonymous true' >> /etc/mosquitto/mosquitto.conf" + sudo systemctl restart mosquitto + dialog --title "$software" --msgbox "\nInstallation complete.\n\nMosquitto." 10 60 +} + + +gpsd() { # Install gpsd + apt update + DEBIAN_FRONTEND=noninteractive apt install -y --option Dpkg::Options::="--force-confold" gpsd gpsd-clients python-gps + # do stuff TODO config gpsd and chrony + # telemetry script + sudo systemctl restart gpsd + dialog --title "$software" --msgbox "\nInstallation complete.\n\nGPSD." 10 60 +} + + +help=$(cat <&1 1>&2 2>&3) + + exit_status=$? # This line checks the exit status of the dialog command + if [ $exit_status -ne 0 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog + break + fi + + case $option in + 1) meshing_around ;; + 2) tc2_bbs ;; + 3) curses_client ;; + 4) mosquitto ;; + 5) gpsd ;; + 6) break ;; + esac +done + +exit 0 \ No newline at end of file From 65eda7c508ed3e57fc0ebcaadca9c560e7993960 Mon Sep 17 00:00:00 2001 From: nagumii Date: Tue, 7 Jan 2025 17:44:44 +0200 Subject: [PATCH 15/25] Changed ownership of /opt/TC2-BBS-mesh --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 9c0ccc1..2c89baf 100644 --- 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 @@ -64,7 +64,6 @@ meshing_around() { # Install Meshing Around tc2_bbs() { # Install TC²BBS - failedInstall=false dialog --title "$software" --yesno "The TC²-BBS system integrates with Meshtastic devices. The system allows for message handling, bulletin boards, mail systems, and a channel directory.\nInstallation requires internet connection.\n\nLearn more at https://github.com/TheCommsChannel/TC2-BBS-mesh\nIf software is already present, will attempt to update.\n\nInstall?" 0 0 if [ ! -d /opt/TC2-BBS-mesh ]; then if [ $? -eq 0 ]; then #unless cancel/no @@ -85,6 +84,8 @@ tc2_bbs() { # Install TC²BBS fi if [ ! -f /opt/TC2-BBS-mesh/config.ini ]; then # if the config file doesn't exist but the clone was successful, then we need to do some configuring and rejiggering cd /opt/TC2-BBS-mesh + chown -R femto /opt/TC2-BBS-mesh + git config --global --add safe.directory /opt/TC2-BBS-mesh # prevents git error when updating echo "Creating virtual environment. This can take a couple minutes." python3 -m venv venv source venv/bin/activate @@ -95,6 +96,7 @@ tc2_bbs() { # Install TC²BBS fi dialog --title "$software" --yesno "Installation/upgrade successful! \n\nInstall service?\n\nIn Linux, services automatically start on boot and restart if the software stops for any reason." 0 0 if [ $? -eq 0 ]; then #unless cancel/no + cd /opt/TC2-BBS-mesh source venv/bin/activate sed -i "s/pi/${SUDO_USER:-$(whoami)}/g" mesh-bbs.service sed -i "s|/home/femto/|/opt/|g" mesh-bbs.service From fca361db17be3fc442811d5303959d5cf102271a Mon Sep 17 00:00:00 2001 From: nagumii Date: Tue, 7 Jan 2025 18:24:48 +0200 Subject: [PATCH 16/25] +x to femto-software.sh --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh 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 old mode 100644 new mode 100755 From 833df288a04b592e7482f3194c692217d5226365 Mon Sep 17 00:00:00 2001 From: nagumii Date: Tue, 7 Jan 2025 18:26:54 +0200 Subject: [PATCH 17/25] Add notice to fsresize that it can take a good long while --- .../usr/bin/filesystem_resize.sh | 28 +++++ .../usr/local/bin/femto-software-menu.sh | 112 ------------------ 2 files changed, 28 insertions(+), 112 deletions(-) create mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/bin/filesystem_resize.sh delete mode 100755 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software-menu.sh diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/bin/filesystem_resize.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/bin/filesystem_resize.sh new file mode 100644 index 0000000..bd4f011 --- /dev/null +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/bin/filesystem_resize.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# Check if the filesystem has been resized previously +if [ ! -f /etc/.filesystem_resized ]; then + # Perform filesystem resize + resize2fs /dev/mmcblk1p5 + resize2fs /dev/mmcblk1p6 + echo "Resizing /dev/mmcblk1p7 can take up to 10 minutes, depending on microSD card size and speed." + resize2fs /dev/mmcblk1p7 + + # Create a marker file indicating filesystem resize has been done + touch /etc/.filesystem_resized + + echo "Filesystem resized successfully." +fi + +if [ ! -f /etc/.filesystem_swap ]; then + fallocate -l 1G /swapfile + chmod 600 /swapfile + mkswap /swapfile > /dev/null + swapon /swapfile > /dev/null + echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab > /dev/null + + touch /etc/.filesystem_swap + + echo "Swap successfully." +fi + diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software-menu.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software-menu.sh deleted file mode 100755 index be5a8c4..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-software-menu.sh +++ /dev/null @@ -1,112 +0,0 @@ -while true; do -title="Software" - option="" - option=$(dialog --cancel-label "Back" --menu "$title" 0 0 6 \ - 1 "Meshing Around by Spud" \ - 2 "The Comms Channel BBS, TC2BBS" \ - 3 "Curses Client for Meshtastic" \ - 4 "Mosquitto MQTT broker" \ - 5 "GPS and Telemetry" \ - "" ""\ - 6 "Back to Main Menu" 3>&1 1>&2 2>&3) - - exit_status=$? # This line checks the exit status of the dialog command - if [ $exit_status -ne 0 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog - break - fi - - case $option in - 1) #Install Meshing Around) - #check if /opt/meshing-around exists if not git clone - if [ ! -d /opt/meshing-around ]; then - dialog --title "$software" --yesno "Meshing Around is a feature-rich bot designed to enhance your Meshtastic network experience with a variety of powerful tools and fun features\nConnectivity and utility through text-based message delivery.\nWhether you're looking to perform network tests, send messages, or even play games, mesh_bot.py has you covered.\nInstallation requires internet connection.\n\nLearn more at https://github.com/SpudGunMan/meshing-around\n\nInstall?" 0 0 - if [ $? -eq 0 ]; then #unless cancel/no - if ! git clone https://github.com/spudgunman/meshing-around /opt/meshing-around; then - dialog --title "$software" --msgbox "\nCloning of Meshing Around git repo failed.\nCheck internet connectivity." 10 60 - failedInstall=true - fi - fi - else - # /opt/meshing-around exists, check for updates - cd /opt/meshing-around - if ! sudo git pull; then - dialog --title "$software" --msgbox "\nFailed to update Meshing Around.\nCheck internet connectivity." 10 60 - failedInstall=true - fi - # check if /opt/meshing-around/data has any .pkl files if so assume it's installed - if [ -n "$(find /opt/meshing-around/data -name '*.pkl' -print -quit)" ]; then - # todo uninstall? - dialog --title "$software" --yesno "Meshing Around appears installed and updated, do you want to edit the config file? (press ctl+o,enter to save, ctl+x to exit nano)" 0 0 - if [ $? -eq 0 ]; then #unless cancel/no - sudo nano /opt/meshing-around/config.ini - fi - # set flag to not run install.sh - installed=true - echo "Restarting services..." - sudo systemctl restart mesh_bot - sudo systemctl restart pong_bot - fi - fi - # if /opt/meshing-around exists - if [ -f /opt/meshing-around/install.sh ] && [ "$installed" != true ] && [ "$failedInstall" != true ]; then - # ask what type of bot mesh or pong - dialog --title "$software" --yesno "Meshing Around can be configured to run as mesh_bot or pong_bot.\n\nRun mesh_bot?" 0 0 - if [ $? -eq 0 ]; then #unless cancel/no - /opt/meshing-around/install.sh mesh - dialog --title "$software" --yesno "Would you like to edit the config file? (press ctl+o,enter to save, ctl+x to exit nano)" 0 0 - if [ $? -eq 0 ]; then #unless cancel/no - sudo nano /opt/meshing-around/config.ini - echo "Restarting services..." - sudo systemctl restart mesh_bot - fi - # finished. display the contents of install_notes.txt - dialog --title "$software" --textbox /opt/meshing-around/install_notes.txt 20 60 - else - /opt/meshing-around/install.sh pong - dialog --title "$software" --yesno "Would you like to edit the config file? (press ctl+o,enter to save, ctl+x to exit nano)" 0 0 - if [ $? -eq 0 ]; then #unless cancel/no - sudo nano /opt/meshing-around/config.ini - echo "Restarting services..." - sudo systemctl restart pong_bot - fi - # finished. display the contents of install_notes.txt - dialog --title "$software" --textbox /opt/meshing-around/install_notes.txt 20 60 - fi - fi - ;; - 2) #Install TC2BBS) - if git clone https://github.com/TheCommsChannel/TC2-BBS-mesh.git /opt/TC2-BBS-mesh; then - /opt/TC2-BBS-mesh/install.sh #install script - # config the TC2-BBS to localhost tcp TODO - dialog --title "$software" --msgbox "\nInstallation complete.\n\nRun \`sudo nano /opt/TC2-BBS-mesh/config.ini\` to configure." 10 60 - else - dialog --title "$software" --msgbox "\nCloning of TC2-BBS git repo failed.\nCheck internet connectivity." 10 60 - fi - ;; - 3) #Install curses client) - git clone https://github.com/pdxlocations/curses-client-for-meshtastic.git /opt/curses-client-for-meshtastic - ln -s /opt/curses-client-for-meshtastic/meshtastic-curses.py ~/meshtastic-curses.py - # config the curses client to localhost tcp TODO, permissions? - dialog --title "$software" --msgbox "\nInstallation complete.\n\nRun \`~/meshtastic-curses.py\` to launch." 10 60 - ;; - 4) #Install mosquitto) - apt update - DEBIAN_FRONTEND=noninteractive apt install -y --option Dpkg::Options::="--force-confold" mosquitto mosquitto-clients - # config mosquitto to listen on all interfaces and allow anonymous - sudo sh -c "echo 'listener 1883 0.0.0.0\nallow_anonymous true' >> /etc/mosquitto/mosquitto.conf" - sudo systemctl restart mosquitto - dialog --title "$software" --msgbox "\nInstallation complete.\n\nMosquitto." 10 60 - ;; - 5) #Install gpsd) - apt update - DEBIAN_FRONTEND=noninteractive apt install -y --option Dpkg::Options::="--force-confold" gpsd gpsd-clients python-gps - # do stuff TODO config gpsd and chrony - # telemetry script - sudo systemctl restart gpsd - dialog --title "$software" --msgbox "\nInstallation complete.\n\nGPSD." 10 60 - ;; - 6) - break - ;; - esac -done \ No newline at end of file From 6decb18e3e5a155fd9e0da72b2c43cae5e08daf9 Mon Sep 17 00:00:00 2001 From: nagumii Date: Tue, 7 Jan 2025 19:19:55 +0200 Subject: [PATCH 18/25] +x to femto-software.sh --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 2c89baf..f1f43ec 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 @@ -71,6 +71,8 @@ tc2_bbs() { # Install TC²BBS dialog --title "$software" --msgbox "\nCloning of TC²-BBS git repo failed.\nCheck internet connectivity." 10 60 return fi + chown -R femto /opt/TC2-BBS-mesh + git config --global --add safe.directory /opt/TC2-BBS-mesh # prevents git error when updating else return fi @@ -84,8 +86,6 @@ tc2_bbs() { # Install TC²BBS fi if [ ! -f /opt/TC2-BBS-mesh/config.ini ]; then # if the config file doesn't exist but the clone was successful, then we need to do some configuring and rejiggering cd /opt/TC2-BBS-mesh - chown -R femto /opt/TC2-BBS-mesh - git config --global --add safe.directory /opt/TC2-BBS-mesh # prevents git error when updating echo "Creating virtual environment. This can take a couple minutes." python3 -m venv venv source venv/bin/activate From 54815afb10c1f497b6042ad558a9092a7712434b Mon Sep 17 00:00:00 2001 From: nagumii Date: Tue, 7 Jan 2025 19:52:45 +0200 Subject: [PATCH 19/25] +x filesystem_resize.sh --- .../sysdrv/out/rootfs_uclibc_rv1106/usr/bin/filesystem_resize.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/bin/filesystem_resize.sh diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/bin/filesystem_resize.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/bin/filesystem_resize.sh old mode 100644 new mode 100755 From c90fefcb442c770645baf4335d57385f25ec3527 Mon Sep 17 00:00:00 2001 From: nagumii Date: Tue, 7 Jan 2025 20:18:48 +0200 Subject: [PATCH 20/25] Fold filesystem_resize.sh into runonce --- .../usr/bin/filesystem_resize.sh | 28 ------------------- .../usr/local/bin/femto-runonce.sh | 1 - 2 files changed, 29 deletions(-) delete mode 100755 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/bin/filesystem_resize.sh diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/bin/filesystem_resize.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/bin/filesystem_resize.sh deleted file mode 100755 index bd4f011..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/bin/filesystem_resize.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -# Check if the filesystem has been resized previously -if [ ! -f /etc/.filesystem_resized ]; then - # Perform filesystem resize - resize2fs /dev/mmcblk1p5 - resize2fs /dev/mmcblk1p6 - echo "Resizing /dev/mmcblk1p7 can take up to 10 minutes, depending on microSD card size and speed." - resize2fs /dev/mmcblk1p7 - - # Create a marker file indicating filesystem resize has been done - touch /etc/.filesystem_resized - - echo "Filesystem resized successfully." -fi - -if [ ! -f /etc/.filesystem_swap ]; then - fallocate -l 1G /swapfile - chmod 600 /swapfile - mkswap /swapfile > /dev/null - swapon /swapfile > /dev/null - echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab > /dev/null - - touch /etc/.filesystem_swap - - echo "Swap successfully." -fi - 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 e1c28ed..31bc90d 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 @@ -20,7 +20,6 @@ Proceed?" 14 60 exit 1 fi fi - # resize filesystem to fill partition /usr/bin/filesystem_resize.sh From a22ce7dcab099a1115ea473ce280298699656c93 Mon Sep 17 00:00:00 2001 From: nagumii Date: Tue, 7 Jan 2025 20:25:57 +0200 Subject: [PATCH 21/25] Update femto-runonce.sh --- .../usr/local/bin/femto-runonce.sh | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) 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 31bc90d..e5bf7d8 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 @@ -4,7 +4,7 @@ log_message() { logger "First boot: $1" # Log to the system log } -if [ ! -e "/usr/local/bin/.firstboot" ]; then +if [ ! -e "/etc/.firstboot" ]; then # prevents weirdness over tty export NCURSES_NO_UTF8_ACS=1 export TERM=xterm-256color @@ -21,18 +21,32 @@ Proceed?" 14 60 fi fi -# resize filesystem to fill partition -/usr/bin/filesystem_resize.sh +# Perform filesystem resize + sudo resize2fs /dev/mmcblk1p5 + sudo resize2fs /dev/mmcblk1p6 + log_message "Resizing /dev/mmcblk1p7 can take up to 10 minutes, depending on microSD card size and speed." + sudo resize2fs /dev/mmcblk1p7 + + # allocate swap file +if [ ! -f /etc/.filesystem_swap ]; then # check if swap file already exists + sudo fallocate -l 1G /swapfile + sudo chmod 600 /swapfile + sudo mkswap /swapfile > /dev/null + sudo swapon /swapfile > /dev/null + echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab > /dev/null + touch /etc/.filesystem_swap + log_message "Swap file allocated." +else + log_message "Swap file already allocated, skipping." +fi # add RTC support bash -c 'echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-3/new_device' -log_message "Added RTC support." +log_message "Added ds1307/ds3231 RTC support." # prevent randomized mac address for eth0. If `eth0`` is already present in /etc/network/interfaces, skip if ! grep -q "eth0" /etc/network/interfaces; then log_message "Setting eth0 MAC address to derivative of CPU s/n." - echo "$msg" - logger "$msg" cat <> /etc/network/interfaces # static mac address for onboard ethernet (castellated pins) allow-hotplug eth0 @@ -40,9 +54,7 @@ iface eth0 inet dhcp hwaddress ether $(awk '/Serial/ {print $3}' /proc/cpuinfo | tail -c 11 | sed 's/^\(.*\)/a2\1/' | sed 's/\(..\)/\1:/g;s/:$//') EOF else - log_message "eth0 already exists in /etc/network/interfaces." - echo "$msg" - logger "$msg" + log_message "eth0 already exists in /etc/network/interfaces, skipping." fi # set meshtastic nodeid to derivative of CPU serial number (unique to this board) @@ -59,7 +71,7 @@ log_message "Enabling wifi setting in Meshtasticd." /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 +rm /etc/.firstboot log_message "Removing first boot flag and rebooting in 5 seconds..." sleep 5 reboot \ No newline at end of file From 56d23183e19873f47111505520a20198fc01540e Mon Sep 17 00:00:00 2001 From: nagumii Date: Tue, 7 Jan 2025 20:37:48 +0200 Subject: [PATCH 22/25] Finish folding fsresize into runonce --- .../BoardConfig_IPC/overlay/overlay-luckfox-ubuntu/etc/rc.local | 2 +- foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/.firstboot | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/.firstboot diff --git a/foxbuntu/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ubuntu/etc/rc.local b/foxbuntu/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ubuntu/etc/rc.local index c8a499a..fcdbf1d 100755 --- a/foxbuntu/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ubuntu/etc/rc.local +++ b/foxbuntu/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ubuntu/etc/rc.local @@ -6,7 +6,7 @@ luckfox-config load #run only on first boot -if [ -e "/usr/local/bin/.firstboot" ]; then +if [ -e "/etc/.firstboot" ]; then /usr/local/bin/femto-runonce.sh fi diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/.firstboot b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/.firstboot new file mode 100644 index 0000000..e60fd6a --- /dev/null +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/.firstboot @@ -0,0 +1 @@ +# File to tell rc.local that this is the first boot. Will be deleted automatically. \ No newline at end of file From 7ae896f632be9d7108f79576cccb49aa1ef28e91 Mon Sep 17 00:00:00 2001 From: nagumii Date: Tue, 7 Jan 2025 21:43:11 +0200 Subject: [PATCH 23/25] Add TC2 to software menu --- .../usr/local/bin/.firstboot | 1 - .../usr/local/bin/femto-software.sh | 52 ++++++++----------- 2 files changed, 23 insertions(+), 30 deletions(-) delete mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/.firstboot diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/.firstboot b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/.firstboot deleted file mode 100644 index e60fd6a..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/.firstboot +++ /dev/null @@ -1 +0,0 @@ -# File to tell rc.local that this is the first boot. Will be deleted automatically. \ No newline at end of file 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 f1f43ec..82d7468 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 @@ -65,24 +65,24 @@ meshing_around() { # Install Meshing Around tc2_bbs() { # Install TC²BBS dialog --title "$software" --yesno "The TC²-BBS system integrates with Meshtastic devices. The system allows for message handling, bulletin boards, mail systems, and a channel directory.\nInstallation requires internet connection.\n\nLearn more at https://github.com/TheCommsChannel/TC2-BBS-mesh\nIf software is already present, will attempt to update.\n\nInstall?" 0 0 - if [ ! -d /opt/TC2-BBS-mesh ]; then - if [ $? -eq 0 ]; then #unless cancel/no - if ! git clone https://github.com/TheCommsChannel/TC2-BBS-mesh.git /opt/TC2-BBS-mesh; then - dialog --title "$software" --msgbox "\nCloning of TC²-BBS git repo failed.\nCheck internet connectivity." 10 60 + if [ $? -eq 0 ]; then #unless cancel/no + if [ ! -d /opt/TC2-BBS-mesh ]; then + if ! git clone https://github.com/TheCommsChannel/TC2-BBS-mesh.git /opt/TC2-BBS-mesh; then + dialog --title "$software" --msgbox "\nCloning of TC²-BBS git repo failed.\nCheck internet connectivity." 10 60 + return + fi + chown -R femto /opt/TC2-BBS-mesh + git config --global --add safe.directory /opt/TC2-BBS-mesh # prevents git error when updating + else + # /opt/meshing-around exists, check for updates + cd /opt/TC2-BBS-mesh + if ! sudo git pull; then + dialog --title "$software" --msgbox "\nFailed to update TC²-BBS.\nCheck internet connectivity." 10 60 return fi - chown -R femto /opt/TC2-BBS-mesh - git config --global --add safe.directory /opt/TC2-BBS-mesh # prevents git error when updating - else - return fi else - # /opt/meshing-around exists, check for updates - cd /opt/TC2-BBS-mesh - if ! sudo git pull; then - dialog --title "$software" --msgbox "\nFailed to update TC²-BBS.\nCheck internet connectivity." 10 60 - return - fi + return fi if [ ! -f /opt/TC2-BBS-mesh/config.ini ]; then # if the config file doesn't exist but the clone was successful, then we need to do some configuring and rejiggering cd /opt/TC2-BBS-mesh @@ -94,21 +94,15 @@ tc2_bbs() { # Install TC²BBS sed -i 's/type = serial/type = tcp/' config.ini sed -i 's/^# hostname = 192.168.x.x/hostname = 127.0.0.1/' config.ini fi - dialog --title "$software" --yesno "Installation/upgrade successful! \n\nInstall service?\n\nIn Linux, services automatically start on boot and restart if the software stops for any reason." 0 0 - if [ $? -eq 0 ]; then #unless cancel/no - cd /opt/TC2-BBS-mesh - source venv/bin/activate - sed -i "s/pi/${SUDO_USER:-$(whoami)}/g" mesh-bbs.service - sed -i "s|/home/femto/|/opt/|g" mesh-bbs.service - cp mesh-bbs.service /etc/systemd/system/ - sudo systemctl enable mesh-bbs.service - sudo systemctl restart mesh-bbs.service - echo -e "Waiting for service to start...\n" - sleep 7 - systemctl status mesh-bbs.service - echo "\nPress any key to continue..." - read -n 1 -s -r - fi + echo "Installation/upgrade successful! Adding/recreating service." + cd /opt/TC2-BBS-mesh + source venv/bin/activate + sed -i "s/pi/${SUDO_USER:-$(whoami)}/g" mesh-bbs.service + sed -i "s|/home/femto/|/opt/|g" mesh-bbs.service + cp mesh-bbs.service /etc/systemd/system/ + sudo systemctl enable mesh-bbs.service + sudo systemctl restart mesh-bbs.service + dialog --title "$software" --msgbox "\nInstallation complete." 8 50 } From e3ba27709db487501ad30757a5797b6e557363e1 Mon Sep 17 00:00:00 2001 From: nagumii Date: Tue, 7 Jan 2025 22:50:44 +0200 Subject: [PATCH 24/25] tiny fix for tc2-bbs installer --- .../usr/local/bin/femto-install-wizard.sh | 7 ++----- .../rootfs_uclibc_rv1106/usr/local/bin/femto-software.sh | 7 +++++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh index 861603c..fcd98e7 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-install-wizard.sh @@ -36,11 +36,8 @@ wizard() { if [ $? -eq 0 ]; then #unless cancel/no newurl=$(dialog --title "Meshtastic URL" --cancel-label "Skip" --inputbox "New Meshtasticd URL (SHIFT+INS to paste):" 8 50 3>&1 1>&2 2>&3) if [ -n "$newurl" ]; then #if a URL was entered - dialog --title "$title" --yesno "New Meshtasticd URL:\n$newurl\n\nConfirm?" 15 60 - if [ $? -eq 0 ]; then #unless cancel/no - femto-meshtasticd-config.sh -q "$newurl" - pause - fi + femto-meshtasticd-config.sh -q "$newurl" + pause fi femto-config -l 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 82d7468..26527f9 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 @@ -102,6 +102,13 @@ tc2_bbs() { # Install TC²BBS cp mesh-bbs.service /etc/systemd/system/ sudo systemctl enable mesh-bbs.service sudo systemctl restart mesh-bbs.service + + # for whatever reason, this is necessary + sleep 5 + sudo systemctl restart mesh-bbs + + echo -e "\nPress any key to continue..." + read -n 1 -s -r dialog --title "$software" --msgbox "\nInstallation complete." 8 50 } From 0fffb11f40fa3909d298dc6b45477a1d48f95326 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 8 Jan 2025 01:17:00 +0200 Subject: [PATCH 25/25] Added mesh connectivity test feature I got sick of manually testing mesh connectivity from CLI --- .../usr/local/bin/femto-config | 28 ++++++++++++------- .../usr/local/bin/femto-meshtasticd-config.sh | 12 ++++++++ 2 files changed, 30 insertions(+), 10 deletions(-) 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 311b2c8..147f0ff 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 @@ -291,12 +291,13 @@ meshtasticd_settings() { 7 "Clear admin keys" \ 8 "Legacy admin channel" \ 9 "Detailed Meshtasticd service status" \ - 10 "Start/restart Meshtasticd service" \ - 11 "Stop Meshtasticd service" \ - 12 "Upgrade/install Meshtasticd" \ - 13 "Uninstall Meshtasticd" \ + 10 "Mesh connectivity test" \ + 11 "Start/restart Meshtasticd service" \ + 12 "Stop Meshtasticd service" \ + 13 "Upgrade/install Meshtasticd" \ + 14 "Uninstall Meshtasticd" \ "" "" \ - 14 "Back to Main Menu" 3>&1 1>&2 2>&3) + 15 "Back to Main Menu" 3>&1 1>&2 2>&3) exit_status=$? # This line checks the exit status of the dialog command if [ $exit_status -ne 0 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog @@ -371,35 +372,42 @@ meshtasticd_settings() { dialog --infobox "Getting Meshtasticd service status..." 5 45 dialog --title "Meshtasticd service status" --msgbox "$(systemctl status meshtasticd)" 0 0 ;; - 10) #start/restart meshtasticd) + 10) #test mesh connectivity) + dialog --title "Meshtastic connectivity test" --yesno "Will send \"test\" to channel 0 and wait for acknowledgement. Will try up to 3 times.\n\nPerform test?" 10 45 + if [ $? -eq 0 ]; then #unless cancel/no + dialog --infobox "Performing mesh connectivity test.\n\nThis may take a while..." 6 45 + dialog --title "Meshtasticd service status" --msgbox "$(femto-meshtasticd-config.sh -r)" 0 0 + fi + ;; + 11) #start/restart meshtasticd) dialog --title "$title" --yesno "Start/restart Meshtasticd service?" 5 45 if [ $? -eq 0 ]; then #unless cancel/no femto-meshtasticd-config.sh -s dialog --msgbox "Meshtasticd service started/restarted." 5 45 fi ;; - 11) #stop meshtasticd) + 12) #stop meshtasticd) dialog --title "$title" --yesno "Stop Meshtasticd service?" 5 45 if [ $? -eq 0 ]; then #unless cancel/no femto-meshtasticd-config.sh -t dialog --msgbox "Meshtasticd service stopped." 5 45 fi ;; - 12) #Upgrade meshtasticd) + 13) #Upgrade meshtasticd) dialog --title "$title" --yesno "Upgrade Meshtasticd?\nRequires internet connection." 0 0 if [ $? -eq 0 ]; then #unless cancel/no femto-meshtasticd-config.sh -u pause fi ;; - 13) #uninstall meshtasticd) + 14) #uninstall meshtasticd) dialog --title "$title" --yesno "Uninstall Meshtasticd?\n\nFoxbuntu was designed with Meshtasticd integration in mind, and may behave unexpectedly if Meshtasticd is removed." 0 0 if [ $? -eq 0 ]; then femto-meshtasticd-config.sh -x dialog --msgbox "Meshtasticd uninstalled. To purge all remnants, run \`sudo apt purge\`.\nAfter reinstallation but before first launch, run the \"first boot script\" from the misc menu." 8 40 fi ;; - 14) + 15) return ;; esac diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh index c904409..ac57580 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh @@ -16,6 +16,7 @@ Options are: -c Clear admin keys -p Get legacy admin channel state -o "true" Set legacy admin channel state (true/false = enabled/disabled), case sensitive +-r Test mesh connectivity by sending "test" to channel 0 and waiting for. Will attempt 3 times -s Start/restart Meshtasticd Service -t Stop Meshtasticd Service -u Upgrade Meshtasticd @@ -119,6 +120,17 @@ while getopts ":hgkl:q:va:cpo:struxm" opt; do o) # Option -o (set legacy admin true/false) meshtastic_update "--set security.admin_channel_enabled $OPTARG" 10 "Set legacy admin state" ;; + r) # Option -r (mesh connectivity test) + for ((i=0; i<=2; i++)); do + if meshtastic --host --ch-index 0 --sendtext "test" --ack 2>/dev/null | grep -q "ACK"; then + echo "Received acknowledgement!" + exit 0 + else + echo "Retrying... ($((i + 1)))" + fi + done + echo "Failed after 3 attempts." + ;; s) # Option -s (start/restart Meshtasticd service) systemctl restart meshtasticd echo "Meshtasticd service started/restarted."