summaryrefslogtreecommitdiffstats
path: root/package/strongswan/files/ipsec.button
blob: 9bd902356060617dee88d26bd11b7f12b700dd36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh

# snarf the code that loads the config values
# since we also load the functions, might as well save the shell calls
. /etc/init.d/ipsec

[ -n "$IPSEC_RESET_BUTTON" -a "$BUTTON" = "$IPSEC_RESET_BUTTON" ] || exit

if [ ! -e /var/run/pluto.pid ] ; then

	[ "$ACTION" = "pressed" ] && start
	
else

	if   [ "$ACTION" = "pressed"  ] ; then
	
		stop 
		
	elif [ "$ACTION" = "released" ] ; then

		while [ -e /var/run/pluto.pid ] ; do
			sleep 1
		done

		while ps auxww | grep ipsec | grep -v grep ; do
			sleep 1
		done

		start
		
	fi
	
fi