Add strongswan (#1330)
[openwrt.git] / package / strongswan / files / ipsec.button
1 #!/bin/sh
2
3 # snarf the code that loads the config values
4 # since we also load the functions, might as well save the shell calls
5 . /etc/init.d/ipsec
6
7 [ -n "$IPSEC_RESET_BUTTON" -a "$BUTTON" = "$IPSEC_RESET_BUTTON" ] || exit
8
9 if [ ! -e /var/run/pluto.pid ] ; then
10
11         [ "$ACTION" = "pressed" ] && start
12         
13 else
14
15         if   [ "$ACTION" = "pressed"  ] ; then
16         
17                 stop 
18                 
19         elif [ "$ACTION" = "released" ] ; then
20
21                 while [ -e /var/run/pluto.pid ] ; do
22                         sleep 1
23                 done
24
25                 while ps auxww | grep ipsec | grep -v grep ; do
26                         sleep 1
27                 done
28
29                 start
30                 
31         fi
32         
33 fi
34