#!/usr/bin/env bash # Script d’installation MeshtasticD sur Raspberry Pi OS avec preset LoRa SX1262 Waveshare # Configuration directe dans /etc/meshtasticd/config.yaml set -e SERVICE_FILE="/etc/systemd/system/meshtasticd.service" CONFIG_FILE="/etc/meshtasticd/config.yaml" echo "=== Mise à jour du système ===" sudo apt update && sudo apt -y upgrade echo "=== Installation des dépendances ===" sudo apt install -y \ libgpiod-dev \ libyaml-cpp-dev \ libbluetooth-dev \ libusb-1.0-0-dev \ libi2c-dev \ libuv1-dev \ openssl \ libssl-dev \ libulfius-dev \ liborcania-dev \ avahi-daemon curl gpg echo "=== Ajout du dépôt Meshtastic (Debian 12 Bookworm par défaut) ===" echo 'deb http://download.opensuse.org/repositories/network:/Meshtastic:/beta/Debian_12/ /' \ | sudo tee /etc/apt/sources.list.d/network:Meshtastic:beta.list curl -fsSL https://download.opensuse.org/repositories/network:/Meshtastic:/beta/Debian_12/Release.key \ | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/network_Meshtastic_beta.gpg > /dev/null sudo apt update echo "=== Installation de meshtasticd ===" sudo apt install -y meshtasticd echo "=== Création du répertoire de configuration ===" sudo mkdir -p /etc/meshtasticd/config.d sudo mkdir -p /etc/meshtasticd/available.d echo "=== Écriture du fichier de configuration ===" sudo tee "$CONFIG_FILE" > /dev/null <<'EOF' Lora: Module: sx1262 # Waveshare SX126X XXXM DIO2_AS_RF_SWITCH: true CS: 21 IRQ: 16 Busy: 20 Reset: 18 # SPIbus: 0 # spidev0.0 par défaut GPS: SerialPath: /dev/ttyS0 I2C: # Laisse vide si pas d'I2C utilisé Display: # Pas de display pour l’instant Logging: LogLevel: debug #TraceFile: /var/log/meshtasticd.json #AsciiLogs: true Webserver: Port: 443 RootPath: /usr/share/meshtasticd/web #SSLKey: /etc/meshtasticd/ssl/private_key.pem #SSLCert: /etc/meshtasticd/ssl/certificate.pem General: MaxNodes: 200 MaxMessageQueue: 100 ConfigDirectory: /etc/meshtasticd/config.d/ AvailableDirectory: /etc/meshtasticd/available.d/ EOF echo "=== Configuration du service systemd ===" if [ ! -f "${SERVICE_FILE}" ]; then sudo tee "${SERVICE_FILE}" > /dev/null <