Merge branch 'noon92:main' into main

This commit is contained in:
Tom 2025-01-08 01:27:24 +00:00 • committed by GitHub
commit 6e5fc461c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 287 additions and 155 deletions

View file

@ -3,7 +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.
### Foxbuntu settings
## Localization settings. CaSe SeNsItIvE
@ -41,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

View file

@ -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

View file

@ -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

View file

@ -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"
@ -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
@ -459,8 +467,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 +509,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 ;;

View file

@ -36,16 +36,13 @@ 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
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

View file

@ -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."

View file

@ -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
@ -20,20 +20,33 @@ Proceed?" 14 60
exit 1
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 <<EOF >> /etc/network/interfaces
# static mac address for onboard ethernet (castellated pins)
allow-hotplug eth0
@ -41,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)
@ -60,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

View file

@ -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

View file

@ -0,0 +1,200 @@
#!/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
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 [ $? -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
fi
else
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
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
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
# 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
}
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 <<EOF
If script is run without arguments, a dialog menu UI will load.
Options are:
-h This message
-u Uninstall - must be FIRST argument. if this is not set, the default operation is to install the software
-s Meshing Around by Spud
-b The Comms Channel BBS, TC²BBS
-c Curses Client for Meshtastic
-m Mosquitto MQTT broker
-g GPS and Telemetry
EOF
)
# Parse options
while getopts ":husbcmg" opt; do
case ${opt} in
h) echo help && exit 0 ;;
u) uninstall="true" ;;
s) meshing_around ;;
b) tc2_bbs ;;
c) curses_client ;;
m) mosquitto ;;
g) gpsd ;;
esac
done
if [ -n "$1" ]; then
exit
fi
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, TC²BBS" \
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) meshing_around ;;
2) tc2_bbs ;;
3) curses_client ;;
4) mosquitto ;;
5) gpsd ;;
6) break ;;
esac
done
exit 0

View file

@ -27,11 +27,12 @@ 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.
>
> 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](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).
>
@ -55,6 +56,9 @@ meshtastic_legacy_admin="true"
> [!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, 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).
<br>
@ -64,14 +68,16 @@ When the Femtofox is finished booting, it will blink its User LED (see below) in
| LED blink pattern | Meaning | Possible causes | Solutions |
|--|--|--|--|
|<center>⚠️<br>________________<br>1 very long blink, lasting 5 seconds| Failed to mount USB drive. Ignoring.| <li>Invalid filesystem<li>Corrupted partition table<li>Defective USB drive<li>Defective USB OTG adapter | <li>Use a supported partition (FAT32, exFAT, NTFS, ext4)<li>Repair partition table<li>Try another USB drive<li>Try another USB OTG adapter |
|<center>⚠️<br>\_\_\_\_\_&nbsp;&nbsp;\_\_\_\_\_<br>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 |
|<center>⚠️<br>\_\_\_\_\_&nbsp;&nbsp;\_\_\_\_\_&nbsp;&nbsp;\_\_\_\_\_<br>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. |
|<center>⚠️<br>\_\_\_\_\_&nbsp;&nbsp;\_\_\_\_\_&nbsp;&nbsp;\_\_\_\_\_&nbsp;&nbsp;\_\_\_\_\_&nbsp;&nbsp;\_\_\_\_\_<br>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. |
|<center>⚠️<br>\_\_\_&nbsp;&nbsp;\_\_\_&nbsp;&nbsp;\_&nbsp;&nbsp;\_&nbsp;&nbsp;\_\_\_&nbsp;&nbsp;\_\_\_&nbsp;&nbsp;\_&nbsp;&nbsp;\_<br>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.| <li>The error may be transient.<li>Configuration file may contain improper data. | <li>Try again.<li>Check configuration file contents as described above.<li>Check the log.<br><br>This pattern may flash before other patterns. The pattern will repeat once for each failed setting.|
|<center>⚠️<br>\_\_\_&nbsp;&nbsp;\_\_\_&nbsp;&nbsp;\_&nbsp;&nbsp;\_&nbsp;&nbsp;\_\_\_&nbsp;&nbsp;\_\_\_&nbsp;&nbsp;\_&nbsp;&nbsp;\_<br>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.| <li>The error may be transient.<li>Configuration file may contain improper data. | <li>Try again.<li>Check configuration file contents as described above.<li>Check the log.<br><br>This pattern may flash before other patterns. The pattern will repeat once for each failed setting.|
|<center>✅<br>. . . . . . . . . .<br>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.<br>Note that the "success" boot code will flash if at least one setting is successfully read - even if the setting was not implemented successfully.|
|<center>✅<br>\_\_&nbsp;&nbsp;\_\_&nbsp;&nbsp;\_\_&nbsp;&nbsp;\_\_&nbsp;&nbsp;\_\_<br>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.
<!--stackedit_data:
eyJoaXN0b3J5IjpbLTE3MTQ4NTcxNTddfQ==
eyJoaXN0b3J5IjpbMTgxNjgzMzAxMiwxNzkyOTA1ODk2LDQyND
g4ODY2OCwtMTcxNDg1NzE1N119
-->