#!/bin/bash
# V1

if [[ $EUID -ne 0 ]]; then
	echo "This script must be run as root" 
	exit 1
fi
REQ=`ps | /bin/grep -c 'slattach'`
if [ $REQ == 1 ]
then
	killall -9 slattach
fi
REQ2=`/bin/ls /dev/ttyACM0`
while [ -z "$REQ2" ]
do
	echo "Veuillez brancher un Arduino"
	sleep 5
done

slattach -L -s 9600 -p slip /dev/ttyACM0 &
ifconfig sl0 192.168.10.1 pointopoint 192.168.10.2
exit 0
