#! /bin/sh

THIS=`basename $0`

tty >/dev/null 2>&1 || exec >/dev/console 2>&1

echo "$THIS: Starting fake firmware update - disable modbus snmp, ftp, http, ntp and ssh"

# Disable snmp and modbus
touch /home/system/nosnmp
touch /home/system/nomodbus

# Disable ftp, http and ssh
rm -f /etc/rc.d/S91proftpd
rm -f /etc/rc.d/S91lighttpd
rm -f /etc/rc.d/S16dropbear
rm -f /etc/rc.d/S05ntp-server

echo "AMG MODE ENABLED! DEVICE WILL NO LONGER BE ACCESSIBLE VIA SSH, FTP OR MODBUS!"

sync
# normally we restart the system, but on manual start switch off blinking
[ -z "$1" ] && reboot || killall iotest
