mirror of
https://github.com/getumbrel/umbrel-apps.git
synced 2026-12-01 17:33:49 +03:00
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com> Co-authored-by: nmfretz <nmfretz@gmail.com>
44 lines
1.0 KiB
Bash
Executable File
44 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
|
|
APP_DIR="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")/..")"
|
|
DATA_DIR="${APP_DIR}/data"
|
|
SETTINGS_FILE="${DATA_DIR}/settings.env"
|
|
|
|
mkdir -p "${DATA_DIR}/thread"
|
|
|
|
BACKBONE_IF="eth0"
|
|
if command -v ip >/dev/null 2>&1; then
|
|
detected="$(ip route show default 2>/dev/null | awk '/default/ {print $5; exit}')"
|
|
[[ -n "${detected}" ]] && BACKBONE_IF="${detected}"
|
|
fi
|
|
|
|
if [[ ! -f "${SETTINGS_FILE}" ]]; then
|
|
cat > "${SETTINGS_FILE}" <<EOF
|
|
|
|
# Serial device for the Thread radio dongle, e.g. /dev/ttyACM0 or /dev/ttyUSB0.
|
|
DEVICE=
|
|
|
|
# Baud rate for the radio. Most modern dongles use 460800.
|
|
BAUDRATE=460800
|
|
|
|
# Hardware flow control (0 = off, 1 = on).
|
|
FLOW_CONTROL=0
|
|
|
|
# Network interface OTBR should bridge Thread traffic to.
|
|
BACKBONE_IF=${BACKBONE_IF}
|
|
|
|
# Enable IPv6 firewall for the Thread network (recommended).
|
|
FIREWALL=1
|
|
|
|
# Enable NAT64 so Thread devices can reach IPv4 services.
|
|
NAT64=1
|
|
|
|
# Auto-flash RCP firmware on the dongle (leave 0 unless you know you need it).
|
|
AUTOFLASH_FIRMWARE=0
|
|
EOF
|
|
fi
|
|
|
|
exit 0
|