|
|
|
@ -1,6 +1,6 @@
|
|
|
|
#!/bin/bash
|
|
|
|
#!/bin/bash
|
|
|
|
# D-Star Site Install Script
|
|
|
|
# D-Star Site Install Script
|
|
|
|
# For Raspberry Pi 3 running Raspberry Pi OS Lite
|
|
|
|
# For Raspberry Pi 3B running Raspberry Pi OS Lite (64-bit)
|
|
|
|
# Usage: sudo bash install.sh
|
|
|
|
# Usage: sudo bash install.sh
|
|
|
|
|
|
|
|
|
|
|
|
set -e
|
|
|
|
set -e
|
|
|
|
@ -45,14 +45,42 @@ echo "Installing ZeroTier..."
|
|
|
|
curl -s https://install.zerotier.com | bash
|
|
|
|
curl -s https://install.zerotier.com | bash
|
|
|
|
zerotier-cli join $ZEROTIER_NETWORK
|
|
|
|
zerotier-cli join $ZEROTIER_NETWORK
|
|
|
|
echo "ZeroTier installed and joined network $ZEROTIER_NETWORK"
|
|
|
|
echo "ZeroTier installed and joined network $ZEROTIER_NETWORK"
|
|
|
|
echo "NOTE: Approve this device in ZeroTier Central before continuing"
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo ""
|
|
|
|
read -p "Press ENTER once device is approved in ZeroTier Central..."
|
|
|
|
echo "NOTE: Approve this device in ZeroTier Central before continuing"
|
|
|
|
|
|
|
|
read -p "Press ENTER once device is approved..."
|
|
|
|
|
|
|
|
|
|
|
|
# Enable serial port
|
|
|
|
# Configure serial port for MMDVM board
|
|
|
|
echo "Configuring serial port..."
|
|
|
|
echo "Configuring serial port..."
|
|
|
|
raspi-config nonint do_serial_hw 0
|
|
|
|
|
|
|
|
raspi-config nonint do_serial_cons 1
|
|
|
|
# Modern Pi OS - config in /boot/firmware/config.txt
|
|
|
|
|
|
|
|
CONFIG_FILE="/boot/firmware/config.txt"
|
|
|
|
|
|
|
|
if [ ! -f "$CONFIG_FILE" ]; then
|
|
|
|
|
|
|
|
# Fall back to old path
|
|
|
|
|
|
|
|
CONFIG_FILE="/boot/config.txt"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Disable Bluetooth and enable UART for MMDVM board
|
|
|
|
|
|
|
|
if ! grep -q "dtoverlay=disable-bt" "$CONFIG_FILE"; then
|
|
|
|
|
|
|
|
echo "" >> "$CONFIG_FILE"
|
|
|
|
|
|
|
|
echo "# MMDVM Board - disable BT, enable hardware UART" >> "$CONFIG_FILE"
|
|
|
|
|
|
|
|
echo "dtoverlay=disable-bt" >> "$CONFIG_FILE"
|
|
|
|
|
|
|
|
echo "enable_uart=1" >> "$CONFIG_FILE"
|
|
|
|
|
|
|
|
echo "Serial port configured in $CONFIG_FILE"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Disable serial console so Linux doesn't use the UART
|
|
|
|
|
|
|
|
echo "Disabling serial console..."
|
|
|
|
|
|
|
|
systemctl stop serial-getty@ttyAMA0.service 2>/dev/null || true
|
|
|
|
|
|
|
|
systemctl disable serial-getty@ttyAMA0.service 2>/dev/null || true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Remove serial console from cmdline.txt
|
|
|
|
|
|
|
|
CMDLINE_FILE="/boot/firmware/cmdline.txt"
|
|
|
|
|
|
|
|
if [ ! -f "$CMDLINE_FILE" ]; then
|
|
|
|
|
|
|
|
CMDLINE_FILE="/boot/cmdline.txt"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
sed -i 's/console=serial0,[0-9]* //' "$CMDLINE_FILE"
|
|
|
|
|
|
|
|
sed -i 's/console=ttyAMA0,[0-9]* //' "$CMDLINE_FILE"
|
|
|
|
|
|
|
|
echo "Serial console removed from $CMDLINE_FILE"
|
|
|
|
|
|
|
|
|
|
|
|
# Add pi user to dialout
|
|
|
|
# Add pi user to dialout
|
|
|
|
usermod -a -G dialout pi
|
|
|
|
usermod -a -G dialout pi
|
|
|
|
@ -102,7 +130,6 @@ echo "Installing systemd service..."
|
|
|
|
cp "$REPO_DIR/services/mmdvmhost.service" /etc/systemd/system/
|
|
|
|
cp "$REPO_DIR/services/mmdvmhost.service" /etc/systemd/system/
|
|
|
|
systemctl daemon-reload
|
|
|
|
systemctl daemon-reload
|
|
|
|
systemctl enable mmdvmhost
|
|
|
|
systemctl enable mmdvmhost
|
|
|
|
systemctl start mmdvmhost
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo ""
|
|
|
|
echo "================================================"
|
|
|
|
echo "================================================"
|
|
|
|
@ -112,8 +139,12 @@ echo ""
|
|
|
|
echo "ZeroTier status:"
|
|
|
|
echo "ZeroTier status:"
|
|
|
|
zerotier-cli status
|
|
|
|
zerotier-cli status
|
|
|
|
echo ""
|
|
|
|
echo ""
|
|
|
|
echo "Service status:"
|
|
|
|
echo "A reboot is required to activate serial port changes."
|
|
|
|
systemctl status mmdvmhost --no-pager
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo ""
|
|
|
|
echo "Logs:"
|
|
|
|
read -p "Reboot now? [y/N]: " REBOOT
|
|
|
|
echo " journalctl -u mmdvmhost -f"
|
|
|
|
if [ "$REBOOT" = "y" ] || [ "$REBOOT" = "Y" ]; then
|
|
|
|
|
|
|
|
reboot
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
echo "Run 'sudo reboot' when ready."
|
|
|
|
|
|
|
|
echo "MMDVMHost will start automatically after reboot."
|
|
|
|
|
|
|
|
fi
|
|
|
|
|