#!/bin/bash
# How to run this script
# sudo curl https://www.bi7jta.org/files/MMDVM_Firmware/repeater_HAT/reboot_flash/m17-fm_3.exit_flash_mode.sh | sudo sh 

sudo mount -o remount,rw / ;
echo "Enable Pi-Star Services..." 

sudo systemctl enable pistar-watchdog.timer
sudo systemctl enable mmdvmhost.timer

# 检查 nextiondriver.service 是否存在
if systemctl list-units --type=service --all | grep -q "nextiondriver.service"; then
  echo "nextiondriver.service exists. enable it..."
  
  # Enable nextiondriver.service
  sudo systemctl enable nextiondriver.service
  
  echo "nextiondriver.service has been enabled."
else
  echo "nextiondriver.service does not exist."
fi

sleep 3

echo "Exit Flash mode DONE"




