From aec75d598a22152b6321152fa74bf4ac1e6656f8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 25 Oct 2025 13:59:45 +0000 Subject: [PATCH 2/6] Add systemd timer to run mesh_bot_w3.service daily at 4:20 am Co-authored-by: SpudGunMan <12676665+SpudGunMan@users.noreply.github.com> --- etc/mesh_bot_w3.timer | 9 +++++++++ install.sh | 27 +++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 etc/mesh_bot_w3.timer diff --git a/etc/mesh_bot_w3.timer b/etc/mesh_bot_w3.timer new file mode 100644 index 0000000..83a252a --- /dev/null +++ b/etc/mesh_bot_w3.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Run mesh_bot_w3.service daily at 4:20 am + +[Timer] +OnCalendar=*-*-* 04:20:00 +Persistent=true + +[Install] +WantedBy=timers.target diff --git a/install.sh b/install.sh index 0f6da19..c6a5b98 100755 --- a/install.sh +++ b/install.sh @@ -256,6 +256,19 @@ if [[ $(echo "${bot}" | grep -i "^m") ]]; then service="mesh_bot" fi +# install mesh_bot_w3.service timer to run daily at 4:20 am +echo "" +echo "Installing mesh_bot_w3.timer to run mesh_bot_w3.service daily at 4:20 am..." +sudo cp etc/mesh_bot_w3.service /etc/systemd/system/ +sudo cp etc/mesh_bot_w3.timer /etc/systemd/system/ +sudo systemctl daemon-reload +sudo systemctl enable mesh_bot_w3.timer +sudo systemctl start mesh_bot_w3.timer +echo "mesh_bot_w3.timer installed and enabled" +echo "Check timer status with: systemctl status mesh_bot_w3.timer" +echo "List all timers with: systemctl list-timers" +echo "" + # check if running on embedded for final steps if [[ $(echo "${embedded}" | grep -i "^n") ]]; then # ask if emoji font should be installed for linux @@ -317,6 +330,10 @@ if [[ $(echo "${embedded}" | grep -i "^n") ]]; then printf "sudo systemctl disable %s.service\n" "$service" >> install_notes.txt printf "Reporting chron job added to run report_generator5.py\n" >> install_notes.txt printf "chronjob: %s\n" "$chronjob" >> install_notes.txt + printf "\nmesh_bot_w3.timer installed to run daily at 4:20 am\n" >> install_notes.txt + printf "Check timer status: systemctl status mesh_bot_w3.timer\n" >> install_notes.txt + printf "List all timers: systemctl list-timers\n" >> install_notes.txt + printf "View timer logs: journalctl -u mesh_bot_w3.timer\n" >> install_notes.txt printf "*** Stay Up to date using 'bash update.sh' ***\n" >> install_notes.txt if [[ $(echo "${venv}" | grep -i "^y") ]]; then @@ -347,6 +364,13 @@ else sudo systemctl daemon-reload sudo systemctl enable $service.service sudo systemctl start $service.service + # install mesh_bot_w3.service timer to run daily at 4:20 am + sudo cp /opt/meshing-around/etc/mesh_bot_w3.service /etc/systemd/system/ + sudo cp /opt/meshing-around/etc/mesh_bot_w3.timer /etc/systemd/system/ + sudo systemctl daemon-reload + sudo systemctl enable mesh_bot_w3.timer + sudo systemctl start mesh_bot_w3.timer + printf "\nmesh_bot_w3.timer installed and enabled\n" # check if the cron job already exists if ! crontab -l | grep -q "$chronjob"; then # add the cron job to run the report_generator5.py script @@ -363,6 +387,9 @@ else printf "sudo journalctl -u %s.service\n" "$service" >> install_notes.txt printf "sudo systemctl stop %s.service\n" "$service" >> install_notes.txt printf "sudo systemctl disable %s.service\n" "$service" >> install_notes.txt + printf "\nmesh_bot_w3.timer installed to run daily at 4:20 am\n" >> install_notes.txt + printf "Check timer status: systemctl status mesh_bot_w3.timer\n" >> install_notes.txt + printf "List all timers: systemctl list-timers\n" >> install_notes.txt printf "*** Stay Up to date using 'bash update.sh' ***\n" >> install_notes.txt fi From 6097ff899cccbf9f5154b47b0e35db8ea2527aa7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 25 Oct 2025 14:02:49 +0000 Subject: [PATCH 3/6] Add explicit Unit directive to mesh_bot_w3.timer Co-authored-by: SpudGunMan <12676665+SpudGunMan@users.noreply.github.com> --- etc/mesh_bot_w3.timer | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/mesh_bot_w3.timer b/etc/mesh_bot_w3.timer index 83a252a..4554852 100644 --- a/etc/mesh_bot_w3.timer +++ b/etc/mesh_bot_w3.timer @@ -4,6 +4,7 @@ Description=Run mesh_bot_w3.service daily at 4:20 am [Timer] OnCalendar=*-*-* 04:20:00 Persistent=true +Unit=mesh_bot_w3.service [Install] WantedBy=timers.target From 2872fb040ea878d139968c152a09373a22fca5a4 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Sat, 25 Oct 2025 08:35:16 -0700 Subject: [PATCH 4/6] refactor --- etc/mesh_bot_reporting.timer | 15 ++- etc/mesh_bot_reporting.tmp | 5 +- etc/mesh_bot_w3.timer | 10 -- etc/mesh_bot_w3.tmp | 28 ----- etc/mesh_bot_w3_server.tmp | 21 ++++ install.sh | 209 +++++++++++++++++++++++++---------- 6 files changed, 184 insertions(+), 104 deletions(-) delete mode 100644 etc/mesh_bot_w3.timer delete mode 100644 etc/mesh_bot_w3.tmp create mode 100644 etc/mesh_bot_w3_server.tmp diff --git a/etc/mesh_bot_reporting.timer b/etc/mesh_bot_reporting.timer index 96c35a8..542096e 100644 --- a/etc/mesh_bot_reporting.timer +++ b/etc/mesh_bot_reporting.timer @@ -2,9 +2,16 @@ Description=MeshingAround-ReportingTask [Timer] -OnUnitActiveSec=1h -OnbootSec=5min -Unit=mesh_bot_reporting.service +OnCalendar=*-*-* 04:20:00 +Persistent=true +#Unit=mesh_bot_reporting.service +#OnUnitActiveSec=1h +#OnbootSec=5min [Install] -WantedBy=timers.target \ No newline at end of file +WantedBy=timers.target + +[Service] +Type=oneshot +ExecStart=/usr/bin/python3 /opt/meshing-around/etc/report_generator5.py +ExecStartPost=/usr/bin/python3 /opt/meshing-around/etc/report_generator.py \ No newline at end of file diff --git a/etc/mesh_bot_reporting.tmp b/etc/mesh_bot_reporting.tmp index dec2dac..515e630 100644 --- a/etc/mesh_bot_reporting.tmp +++ b/etc/mesh_bot_reporting.tmp @@ -14,6 +14,9 @@ Group=pi WorkingDirectory=/dir/ ExecStart=python3 etc/report_generator5.py ExecStop=pkill -f report_generator5.py +# ExecStart=python3 etc/report_generator.py +# ExecStop=pkill -f report_generator.py + # Disable Python's buffering of STDOUT and STDERR, so that output from the # service shows up immediately in systemd's logs @@ -23,4 +26,4 @@ Restart=on-failure Type=notify #try simple if any problems [Install] -WantedBy=default.target +WantedBy=default.target \ No newline at end of file diff --git a/etc/mesh_bot_w3.timer b/etc/mesh_bot_w3.timer deleted file mode 100644 index 4554852..0000000 --- a/etc/mesh_bot_w3.timer +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=Run mesh_bot_w3.service daily at 4:20 am - -[Timer] -OnCalendar=*-*-* 04:20:00 -Persistent=true -Unit=mesh_bot_w3.service - -[Install] -WantedBy=timers.target diff --git a/etc/mesh_bot_w3.tmp b/etc/mesh_bot_w3.tmp deleted file mode 100644 index 16ffcf8..0000000 --- a/etc/mesh_bot_w3.tmp +++ /dev/null @@ -1,28 +0,0 @@ -# /etc/systemd/system/mesh_bot_w3.service -# sudo systemctl daemon-reload -# sudo systemctl enable mesh_bot_w3.service -# sudo systemctl start mesh_bot_w3.service - -[Unit] -Description=MeshingAround-W3Server -After=network.target - -[Service] -Type=simple -User=pi -Group=pi -WorkingDirectory=/dir/ -ExecStart=python3 modules/web.py -ExecStop=pkill -f mesh_bot_w3.py -Environment=REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt -Environment=SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt - -# Disable Python's buffering of STDOUT and STDERR, so that output from the -# service shows up immediately in systemd's logs -Environment=PYTHONUNBUFFERED=1 - -Restart=on-failure -Type=notify #try simple if any problems - -[Install] -WantedBy=default.target diff --git a/etc/mesh_bot_w3_server.tmp b/etc/mesh_bot_w3_server.tmp new file mode 100644 index 0000000..abda9ce --- /dev/null +++ b/etc/mesh_bot_w3_server.tmp @@ -0,0 +1,21 @@ +[Unit] +Description=MeshingAround-WebServer +After=network.target + +[Service] +Type=simple +User=pi +Group=pi +WorkingDirectory=/dir/ +ExecStart=python3 modules/web.py +ExecStop=pkill -f mesh_bot_w3.py +Environment=REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt +Environment=SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt +Environment=PYTHONUNBUFFERED=1 +Restart=on-failure + +[Install] +WantedBy=multi-user.target + + + diff --git a/install.sh b/install.sh index c6a5b98..c48a3d6 100755 --- a/install.sh +++ b/install.sh @@ -1,10 +1,71 @@ #!/bin/bash # meshing-around install helper script +# to uninstall, run with --nope -# install.sh +NOPE=0 cd "$(dirname "$0")" program_path=$(pwd) -chronjob="0 1 * * * /usr/bin/python3 $program_path/etc/report_generator5.py" + +for arg in "$@"; do + if [[ "$arg" == "--nope" ]]; then + NOPE=1 + fi +done + +if [[ $NOPE -eq 1 ]]; then + echo "Uninstalling Meshing Around and all related services..." + + sudo systemctl stop mesh_bot || true + sudo systemctl disable mesh_bot || true + + sudo systemctl stop pong_bot || true + sudo systemctl disable pong_bot || true + + sudo systemctl stop mesh_bot_w3_server || true + sudo systemctl disable mesh_bot_w3_server || true + + sudo systemctl stop mesh_bot_reporting || true + sudo systemctl disable mesh_bot_reporting || true + + sudo rm -f /etc/systemd/system/mesh_bot.service + sudo rm -f /etc/systemd/system/mesh_bot_reporting + sudo rm -f /etc/systemd/system/pong_bot.service + sudo rm -f /etc/systemd/system/mesh_bot_w3_server.service + sudo rm -f /etc/systemd/system/mesh_bot_reporting.service + sudo rm -f /etc/systemd/system/mesh_bot_reporting.timer + + sudo systemctl daemon-reload + sudo systemctl reset-failed + + sudo gpasswd -d meshbot dialout || true + sudo gpasswd -d meshbot tty || true + sudo gpasswd -d meshbot bluetooth || true + sudo groupdel meshbot || true + sudo userdel meshbot || true + + sudo rm -rf /opt/meshing-around/ + + # If Ollama was installed and you want to remove it: + if [[ -f /etc/systemd/system/ollama.service ]]; then + read -p "Ollama service detected. Do you want to remove Ollama and all its data? (y/n): " remove_ollama + if [[ "$remove_ollama" =~ ^[Yy] ]]; then + sudo systemctl stop ollama || true + sudo systemctl disable ollama || true + sudo rm -f /etc/systemd/system/ollama.service + sudo rm -rf /usr/local/bin/ollama + sudo rm -rf ~/.ollama + echo "Ollama removed." + else + echo "Ollama not removed." + fi + fi + + echo "Uninstall complete. Hope to see you again! 73" + exit 0 +fi + +# install.sh, Meshing Around installer script +# Thanks for using Meshing Around! printf "\n########################" printf "\nMeshing Around Installer\n" printf "########################\n" @@ -76,17 +137,19 @@ else printf "\nDependencies installed\n" fi -# add user to groups for serial access -printf "\nAdding user to dialout, bluetooth, and tty groups for serial access\n" -sudo usermod -a -G dialout "$USER" -sudo usermod -a -G tty "$USER" -sudo usermod -a -G bluetooth "$USER" # copy service files cp etc/pong_bot.tmp etc/pong_bot.service cp etc/mesh_bot.tmp etc/mesh_bot.service cp etc/mesh_bot_reporting.tmp etc/mesh_bot_reporting.service -cp etc/mesh_bot_w3.tmp etc/mesh_bot_w3.service +cp etc/mesh_bot_w3_server.tmp etc/mesh_bot_w3_server.service + +# set the correct path in the service file +replace="s|/dir/|$program_path/|g" +sed -i "$replace" etc/pong_bot.service +sed -i "$replace" etc/mesh_bot.service +sed -i "$replace" etc/mesh_bot_reporting.service +sed -i "$replace" etc/mesh_bot_w3_server.service # copy modules/custom_scheduler.py template if it does not exist if [[ ! -f modules/custom_scheduler.py ]]; then @@ -184,15 +247,7 @@ else read bot fi -# set the correct path in the service file -replace="s|/dir/|$program_path/|g" -sed -i "$replace" etc/pong_bot.service -sed -i "$replace" etc/mesh_bot.service -sed -i "$replace" etc/mesh_bot_reporting.service -sed -i "$replace" etc/mesh_bot_w3.service -# set the correct user in the service file? - -#ask if we should add a user for the bot +# ask if we should add a user for the bot if [[ $(echo "${embedded}" | grep -i "^n") ]]; then printf "\nDo you want to add a local user (meshbot) no login, for the bot? (y/n)" read meshbotservice @@ -208,7 +263,23 @@ if [[ $(echo "${meshbotservice}" | grep -i "^y") ]] || [[ $(echo "${embedded}" | else whoami=$(whoami) fi -# set basic permissions for the bot user + +# set the correct user in the service file +replace="s|User=pi|User=$whoami|g" +sed -i "$replace" etc/pong_bot.service +sed -i "$replace" etc/mesh_bot.service +sed -i "$replace" etc/mesh_bot_reporting.service +sed -i "$replace" etc/mesh_bot_reporting.timer +# set the correct group in the service file +replace="s|Group=pi|Group=$whoami|g" +sed -i "$replace" etc/pong_bot.service +sed -i "$replace" etc/mesh_bot.service +sed -i "$replace" etc/mesh_bot_reporting.service +sed -i "$replace" etc/mesh_bot_reporting.timer +printf "\n service files updated\n" + +# add user to groups for serial access +printf "\nAdding user to dialout, bluetooth, and tty groups for serial access\n" sudo usermod -a -G dialout "$whoami" sudo usermod -a -G tty "$whoami" sudo usermod -a -G bluetooth "$whoami" @@ -225,18 +296,6 @@ if ! systemctl is-active --quiet ntp.service && \ printf "\nNo NTP service detected, it is recommended to have NTP running for proper bot operation.\n" fi -# set the correct user in the service file -replace="s|User=pi|User=$whoami|g" -sed -i "$replace" etc/pong_bot.service -sed -i "$replace" etc/mesh_bot.service -sed -i "$replace" etc/mesh_bot_reporting.service -sed -i "$replace" etc/mesh_bot_w3.service -replace="s|Group=pi|Group=$whoami|g" -sed -i "$replace" etc/pong_bot.service -sed -i "$replace" etc/mesh_bot.service -sed -i "$replace" etc/mesh_bot_reporting.service -sed -i "$replace" etc/mesh_bot_w3.service -printf "\n service files updated\n" if [[ $(echo "${bot}" | grep -i "^p") ]]; then # install service for pong bot @@ -256,19 +315,29 @@ if [[ $(echo "${bot}" | grep -i "^m") ]]; then service="mesh_bot" fi -# install mesh_bot_w3.service timer to run daily at 4:20 am +# install mesh_bot_reporting timer to run daily at 4:20 am echo "" -echo "Installing mesh_bot_w3.timer to run mesh_bot_w3.service daily at 4:20 am..." -sudo cp etc/mesh_bot_w3.service /etc/systemd/system/ -sudo cp etc/mesh_bot_w3.timer /etc/systemd/system/ +echo "Installing mesh_bot_reporting.timer to run mesh_bot_reporting daily at 4:20 am..." +sudo cp etc/mesh_bot_reporting.service /etc/systemd/system/ +sudo cp etc/mesh_bot_reporting.timer /etc/systemd/system/ sudo systemctl daemon-reload -sudo systemctl enable mesh_bot_w3.timer -sudo systemctl start mesh_bot_w3.timer -echo "mesh_bot_w3.timer installed and enabled" -echo "Check timer status with: systemctl status mesh_bot_w3.timer" +sudo systemctl enable mesh_bot_reporting.timer +sudo systemctl start mesh_bot_reporting.timer +echo "mesh_bot_reporting.timer installed and enabled" +echo "Check timer status with: systemctl status mesh_bot_reporting.timer" echo "List all timers with: systemctl list-timers" echo "" +# # install mesh_bot_w3_server service +# echo "Installing mesh_bot_w3_server.service to run the web3 server..." +# sudo cp etc/mesh_bot_w3_server.service /etc/systemd/system/ +# sudo systemctl daemon-reload +# sudo systemctl enable mesh_bot_w3_server.service +# sudo systemctl start mesh_bot_w3_server.service +# echo "mesh_bot_w3_server.service installed and enabled" +# echo "Check service status with: systemctl status mesh_bot_w3_server.service" +# echo "" + # check if running on embedded for final steps if [[ $(echo "${embedded}" | grep -i "^n") ]]; then # ask if emoji font should be installed for linux @@ -328,12 +397,14 @@ if [[ $(echo "${embedded}" | grep -i "^n") ]]; then printf "sudo journalctl -u %s.service\n" "$service" >> install_notes.txt printf "sudo systemctl stop %s.service\n" "$service" >> install_notes.txt printf "sudo systemctl disable %s.service\n" "$service" >> install_notes.txt - printf "Reporting chron job added to run report_generator5.py\n" >> install_notes.txt - printf "chronjob: %s\n" "$chronjob" >> install_notes.txt - printf "\nmesh_bot_w3.timer installed to run daily at 4:20 am\n" >> install_notes.txt - printf "Check timer status: systemctl status mesh_bot_w3.timer\n" >> install_notes.txt + printf "sudo systemctl disable %s.service\n" "$service" >> install_notes.txt + printf "Add this to your crontab to run the report generator hourly:" >> install_notes.txt + printf "0 * * * * /usr/bin/python3 $program_path/etc/report_generator5.py" >> install_notes.txt + printf " to edit crontab run 'crontab -e'" >> install_notes.txt + printf "\nmesh_bot_reporting.timer installed to run daily at 4:20 am\n" >> install_notes.txt + printf "Check timer status: systemctl status mesh_bot_reporting.timer\n" >> install_notes.txt printf "List all timers: systemctl list-timers\n" >> install_notes.txt - printf "View timer logs: journalctl -u mesh_bot_w3.timer\n" >> install_notes.txt + printf "View timer logs: journalctl -u mesh_bot_reporting.timer\n" >> install_notes.txt printf "*** Stay Up to date using 'bash update.sh' ***\n" >> install_notes.txt if [[ $(echo "${venv}" | grep -i "^y") ]]; then @@ -364,21 +435,17 @@ else sudo systemctl daemon-reload sudo systemctl enable $service.service sudo systemctl start $service.service - # install mesh_bot_w3.service timer to run daily at 4:20 am - sudo cp /opt/meshing-around/etc/mesh_bot_w3.service /etc/systemd/system/ - sudo cp /opt/meshing-around/etc/mesh_bot_w3.timer /etc/systemd/system/ + sudo systemctl daemon-reload - sudo systemctl enable mesh_bot_w3.timer - sudo systemctl start mesh_bot_w3.timer - printf "\nmesh_bot_w3.timer installed and enabled\n" - # check if the cron job already exists - if ! crontab -l | grep -q "$chronjob"; then - # add the cron job to run the report_generator5.py script - (crontab -l 2>/dev/null; echo "$chronjob") | crontab - - printf "\nAdded cron job to run report_generator5.py\n" - else - printf "\nCron job already exists, skipping\n" - fi + # # check if the cron job already exists + # if ! crontab -l | grep -q "$chronjob"; then + # # add the cron job to run the report_generator5.py script + # (crontab -l 2>/dev/null; echo "$chronjob") | crontab - + # printf "\nAdded cron job to run report_generator5.py\n" + # else + # printf "\nCron job already exists, skipping\n" + # fi + # document the service install printf "Reference following commands:\n\n" > install_notes.txt printf "sudo systemctl status %s.service\n" "$service" >> install_notes.txt printf "sudo systemctl start %s.service\n" "$service" >> install_notes.txt @@ -387,8 +454,11 @@ else printf "sudo journalctl -u %s.service\n" "$service" >> install_notes.txt printf "sudo systemctl stop %s.service\n" "$service" >> install_notes.txt printf "sudo systemctl disable %s.service\n" "$service" >> install_notes.txt - printf "\nmesh_bot_w3.timer installed to run daily at 4:20 am\n" >> install_notes.txt - printf "Check timer status: systemctl status mesh_bot_w3.timer\n" >> install_notes.txt + printf "Add this to your crontab to run the report generator hourly:" >> install_notes.txt + printf "0 * * * * /usr/bin/python3 $program_path/etc/report_generator5.py" >> install_notes.txt + printf " to edit crontab run 'crontab -e'" >> install_notes.txt + printf "\nmesh_bot_reporting.timer installed to run daily at 4:20 am\n" >> install_notes.txt + printf "Check timer status: systemctl status mesh_bot_reporting.timer\n" >> install_notes.txt printf "List all timers: systemctl list-timers\n" >> install_notes.txt printf "*** Stay Up to date using 'bash update.sh' ***\n" >> install_notes.txt fi @@ -401,13 +471,23 @@ exit 0 # sudo systemctl stop mesh_bot # sudo systemctl disable mesh_bot + # sudo systemctl stop pong_bot # sudo systemctl disable pong_bot + +# sudo systemctl stop mesh_bot_w3_server +# sudo systemctl disable mesh_bot_w3_server + # sudo systemctl stop mesh_bot_reporting # sudo systemctl disable mesh_bot_reporting + # sudo rm /etc/systemd/system/mesh_bot.service -# sudo rm /etc/systemd/system/mesh_bot_w3.service +# sudo rm /etc/systemd/system/mesh_bot_reporting # sudo rm /etc/systemd/system/pong_bot.service +# sudo rm /etc/systemd/system/mesh_bot_w3_server.service +# sudo rm /etc/systemd/system/mesh_bot_reporting.service +# sudo rm /etc/systemd/system/mesh_bot_reporting.timer + # sudo systemctl daemon-reload # sudo systemctl reset-failed @@ -417,7 +497,14 @@ exit 0 # sudo groupdel meshbot # sudo userdel meshbot -# sudo rm -rf /opt/meshing-around +# sudo rm -rf /opt/meshing-around/ + +# If Ollama was installed and you want to remove it: +# sudo systemctl stop ollama +# sudo systemctl disable ollama +# sudo rm /etc/systemd/system/ollama.service +# sudo rm -rf /usr/local/bin/ollama +# sudo rm -rf ~/.ollama # after install shenannigans From 2c3c3fed1096a25f8b43576923f0cdda2900211a Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Sat, 25 Oct 2025 08:45:07 -0700 Subject: [PATCH 5/6] Update INSTALL.md --- INSTALL.md | 92 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 54 insertions(+), 38 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 1179102..d48f89a 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -2,6 +2,9 @@ ## Table of Contents +- [Manual Install](#manual-install) +- [Docker Installation](#docker-installation) +- [Requirements](#requirements) - [install.sh](#installsh) - [Purpose](#purpose) - [Usage](#usage) @@ -22,68 +25,69 @@ --- -### Manual Install -Install the required dependencies using pip: +## Manual Install + +Install all required dependencies using pip: + ```sh pip install -r requirements.txt ``` -Copy the configuration template to `config.ini` and edit it to suit your needs: +Copy the configuration template and edit as needed: + ```sh cp config.template config.ini ``` +--- -### Docker Installation - handy for windows -See further info on the [docker.md](script/docker/README.md) -### Requirements -Python 3.8? or later is needed (docker on 3.13). The following can be installed with `pip install -r requirements.txt` or using the [install.sh](install.sh) script for venv and automation: +## Docker Installation -```sh -pip install meshtastic -pip install pubsub -``` +See [script/docker/README.md](script/docker/README.md) for Docker-based setup instructions. +Docker is recommended for Windows or if you want an isolated environment. -Mesh-bot enhancements: +--- -```sh -pip install pyephem -pip install requests -pip install geopy -pip install maidenhead -pip install beautifulsoup4 -pip install dadjokes -pip install schedule -pip install wikipedia -``` +## Requirements -For the Ollama LLM: +- **Python 3.8 or later** (Python 3.13+ supported in Docker) +- All dependencies are listed in `requirements.txt` and can be installed with: + ```sh + pip install -r requirements.txt + ``` +- To enable emoji in the Debian/Ubuntu console: + ```sh + sudo apt-get install fonts-noto-color-emoji + ``` +- For Ollama LLM support, see the prompts during `install.sh` or visit [https://ollama.com](https://ollama.com). -```sh -pip install googlesearch-python -``` - -To enable emoji in the Debian console, install the fonts: - -```sh -sudo apt-get install fonts-noto-color-emoji -``` +--- ## install.sh ### Purpose -`install.sh` is an installation and setup script for the Meshing Around Bot project. It automates installing dependencies, configuring the environment, setting up system services, and preparing the bot for use on Linux systems (especially Debian/Ubuntu/Raspberry Pi and embedded devices). + +`install.sh` automates installation, configuration, and service setup for the Meshing Around Bot project. It is designed for Linux systems (Debian/Ubuntu/Raspberry Pi and embedded devices). ### Usage -Run this script from the project root directory: + +Run from the project root directory: + ```sh bash install.sh ``` +To uninstall: + +```sh +bash install.sh --nope +``` + ### What it does -- Checks for existing installations and required permissions. -- Optionally moves the project to `/opt/meshing-around` for standardization. -- Installs Python and pip if not present (unless on embedded systems). + +- Checks for existing installations and permissions. +- Optionally moves the project to `/opt/meshing-around`. +- Installs Python and pip if missing (unless on embedded systems). - Adds the current user (or a dedicated `meshbot` user) to necessary groups for serial and Bluetooth access. - Copies and configures systemd service files for running the bot as a service. - Sets up configuration files, updating latitude/longitude automatically. @@ -95,11 +99,13 @@ bash install.sh - Offers to reboot the system to complete setup. ### When to use + - For first-time installation of the Meshing Around Bot. - When migrating to a new device or environment. - After cloning or updating the repository to set up dependencies and services. ### Note + - You may be prompted for input during installation (e.g., for embedded mode, virtual environment, or optional features). - Review and edit the script if you have custom requirements or are running on a non-standard system. @@ -108,10 +114,13 @@ bash install.sh ## update.sh ### Purpose + `update.sh` is an update and maintenance script for the Meshing Around Bot project. It automates the process of safely updating your codebase, backing up data, and merging configuration changes. ### Usage -Run this script from the project root directory: + +Run from the project root directory: + ```sh bash update.sh ``` @@ -122,6 +131,7 @@ chmod +x update.sh ``` ### What it does + - Stops running Mesh Bot services to prevent conflicts during update. - Fetches and pulls the latest changes from the GitHub repository (using `git pull --rebase`). - Handles git conflicts, offering to reset to the latest remote version if needed. @@ -132,10 +142,12 @@ chmod +x update.sh - Provides status messages and logs for troubleshooting. ### When to use + - To update your Mesh Bot installation to the latest version. - Before making significant changes or troubleshooting, as it creates a backup of your data. ### Note + - Review `ini_merge_log.txt` and `config_new.ini` after running for any configuration changes or errors. - You may be prompted if git conflicts are detected. @@ -144,9 +156,11 @@ chmod +x update.sh ## launch.sh ### Purpose + `launch.sh` is a convenience script for starting the Mesh Bot, Pong Bot, or generating reports within the Python virtual environment. It ensures the correct environment is activated and the appropriate script is run. ### How to Use + From your project root, run one of the following commands: - Launch Mesh Bot: @@ -171,6 +185,7 @@ From your project root, run one of the following commands: ``` ### What it does + - Ensures you are in the project directory. - Copies `config.template` to `config.ini` if no config exists. - Activates the Python virtual environment (`venv`). @@ -178,6 +193,7 @@ From your project root, run one of the following commands: - Deactivates the virtual environment when done. ### Note + - The script requires a Python virtual environment (`venv`) to be present in the project directory. - If `venv` is missing, the script will exit with an error message. - Always provide an argument (`mesh`, `pong`, `html`, `html5`, or `add`) to specify what you want to launch. \ No newline at end of file From fd1cd2a44c497f5547db9ff1745a9fcfd35e73c4 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Sat, 25 Oct 2025 17:28:16 -0700 Subject: [PATCH 6/6] patch --- etc/mesh_bot_reporting.timer | 9 ++------- etc/mesh_bot_reporting.tmp | 2 +- install.sh | 6 +++--- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/etc/mesh_bot_reporting.timer b/etc/mesh_bot_reporting.timer index 542096e..79ce89d 100644 --- a/etc/mesh_bot_reporting.timer +++ b/etc/mesh_bot_reporting.timer @@ -4,14 +4,9 @@ Description=MeshingAround-ReportingTask [Timer] OnCalendar=*-*-* 04:20:00 Persistent=true -#Unit=mesh_bot_reporting.service +Unit=mesh_bot_reporting.service #OnUnitActiveSec=1h #OnbootSec=5min [Install] -WantedBy=timers.target - -[Service] -Type=oneshot -ExecStart=/usr/bin/python3 /opt/meshing-around/etc/report_generator5.py -ExecStartPost=/usr/bin/python3 /opt/meshing-around/etc/report_generator.py \ No newline at end of file +WantedBy=timers.target \ No newline at end of file diff --git a/etc/mesh_bot_reporting.tmp b/etc/mesh_bot_reporting.tmp index 515e630..bd1b4f5 100644 --- a/etc/mesh_bot_reporting.tmp +++ b/etc/mesh_bot_reporting.tmp @@ -26,4 +26,4 @@ Restart=on-failure Type=notify #try simple if any problems [Install] -WantedBy=default.target \ No newline at end of file +WantedBy=timers.target \ No newline at end of file diff --git a/install.sh b/install.sh index c48a3d6..97f5324 100755 --- a/install.sh +++ b/install.sh @@ -398,9 +398,9 @@ if [[ $(echo "${embedded}" | grep -i "^n") ]]; then printf "sudo systemctl stop %s.service\n" "$service" >> install_notes.txt printf "sudo systemctl disable %s.service\n" "$service" >> install_notes.txt printf "sudo systemctl disable %s.service\n" "$service" >> install_notes.txt - printf "Add this to your crontab to run the report generator hourly:" >> install_notes.txt + printf "\n older chron statment to run the report generator hourly:\n" >> install_notes.txt printf "0 * * * * /usr/bin/python3 $program_path/etc/report_generator5.py" >> install_notes.txt - printf " to edit crontab run 'crontab -e'" >> install_notes.txt + printf " to edit crontab run 'crontab -e'\n" >> install_notes.txt printf "\nmesh_bot_reporting.timer installed to run daily at 4:20 am\n" >> install_notes.txt printf "Check timer status: systemctl status mesh_bot_reporting.timer\n" >> install_notes.txt printf "List all timers: systemctl list-timers\n" >> install_notes.txt @@ -454,7 +454,7 @@ else printf "sudo journalctl -u %s.service\n" "$service" >> install_notes.txt printf "sudo systemctl stop %s.service\n" "$service" >> install_notes.txt printf "sudo systemctl disable %s.service\n" "$service" >> install_notes.txt - printf "Add this to your crontab to run the report generator hourly:" >> install_notes.txt + printf "older crontab to run the report generator hourly:" >> install_notes.txt printf "0 * * * * /usr/bin/python3 $program_path/etc/report_generator5.py" >> install_notes.txt printf " to edit crontab run 'crontab -e'" >> install_notes.txt printf "\nmesh_bot_reporting.timer installed to run daily at 4:20 am\n" >> install_notes.txt