#!/bin/sh
# Vpnc helper script for maemo

if [ "$1" = "connect" ]; then
	shift # need to remove "connect" from getting passed to vpnc
	CMD="/usr/sbin/vpnc $*"
	exec $CMD 

elif [ "$1" = "disconnect" ]; then
	# vpngui knows our pid..
 	kill -TERM $2 > /dev/null 2>&1
	# In case that didn't work...
	killall vpnc > /dev/null 2>&1
	# ..and pretend everything went fine

	exit 0

elif [ "$1" = "reconnect" ]; then
	# vpngui knows our pid..
 	kill -USR1 $2 > /dev/null 2>&1
	exit 0

else
	exit 1
fi

# vim:ts=4
