#!/bin/sh
echo ""
echo "Benvenuti nel programma di configurazione Microform FNSsetup. Questo programma prepara il sistema all'utilizzo dei nomi FNS."
echo ""
echo "Leggere il contratto di licenza nel file LICENSE prima di continuare. Premere CTRL+C per interrompere l'installazione o un altro tasto per procedere con la configurazione."
./pause
if [ -e /etc/resolv.conf ]
then
    mv /etc/resolv.conf /etc/resolv.conf.fns.old
    cp ./resolv /etc/resolv.conf
fi
if [ -e /etc/inet/resolv.conf ]
then
    mv /etc/inet/resolv.conf /etc/inet/resolv.conf.fns.old
    cp ./resolv /etc/inet/resolv.conf
fi
if [ -e /etc/rc.local ]
then
    mv /etc/rc.local /etc/rc.local.tmp
    cat /etc/rc.local.tmp ./start.sh > /etc/rc.local
    chmod +x /etc/rc.local
    rm /etc/rc.local.tmp
fi
if [ -e /etc/rc.d/rc.local ]
then
    mv /etc/rc.d/rc.local /etc/rc.d/rc.local.tmp
    cat /etc/rc.d/rc.local.tmp ./start.sh > /etc/rc.d/rc.local
    chmod +x /etc/rc.d/rc.local
    rm /etc/rc.d/rc.local.tmp
fi
if [ -e /etc/rc.d/init.d/rc.local ]
then
    mv /etc/rc.d/init.d/rc.local /etc/rc.d/init.d/rc.local.tmp
    cat /etc/rc.d/init.d/rc.local.tmp ./start.sh > /etc/rc.d/init.d/rc.local
    chmod +x /etc/rc.d/rc.local
    rm /etc/rc.d/init.d/rc.local
fi
mkdir /usr/local/fnse
cp ./fnse /usr/local/fnse
modprobe ip_tables
modprobe iptable_filter
modprobe ip_queue
/usr/local/fnse &
