#!/bin/sh
#
# se e' il dm600pvr aggiorna prima la data ..thanks to piefav and Black33 for this report :)
#check=`cat /usr/lib/ipkg/status | grep -i Architecture: | grep -ic "dm600pvr"`
#if [ $check != 0 ]; then
#	rdate -s time.ien.it
#fi

# in caso si sia impostato una pausa all'avvio di openvpn
#[ -e /var/etc/SifTeam/conf/openvpn_sleep ] && echo 1 > /var/etc/SifTeam/tmp/openvpn_sleep_reboot




# *****************************************************************************
# THIS FILE IS TEMPORARLY ..IN FUTURE IS ADEGUATE AT OTHER DECODER.
# FOR NOW ADAPT YOURSELF THIS FILE FOR START OPENVPN AT REBOOT
# *****************************************************************************

# THIS FILE HAVE NAME OF YOUR CONFIG ..IF NOT PRESENT USE DEFAULT
if [ -e /var/etc/openvpn/myconfig.txt ]; then
	MYCONFIG="`cat /var/etc/openvpn/myconfig.txt`"
else
	MYCONFIG="client.conf"
fi


# load module tun.ko
/sbin/insmod /var/lib/modules/tun.ko

# make directory and node tun
/bin/mkdir /dev/net
/bin/mknod -m 0600 /dev/net/tun c 10 200

# launch program with proper config
/var/bin/openvpn --config /var/etc/openvpn/$MYCONFIG &

exit 0
