]> git.pld-linux.org Git - packages/cisco-vpnclient.git/blob - cisco_vpnclient.init
- up to 4.8.01.0640_k9, one source for 32/64bit, correct commitlog
[packages/cisco-vpnclient.git] / cisco_vpnclient.init
1 #!/bin/sh
2 ##########################################################################
3 #           Copyright (c) 2001, Cisco Systems, All Rights Reserved
4 ###########################################################################
5 #
6 #  File:    vpnclient_init
7 #  Date:    04/23/2001
8 #
9 ###########################################################################
10 #
11 # chkconfig: 345 85 85
12 # description: Startup script for the vpn client. Version 4.6.00 (0045)
13 #
14 ###########################################################################
15 # Source function library.
16 VPNCLIENT="/opt/cisco-vpnclient/bin/vpnclient"
17 VPNDEV="cipsec0"
18 VPNMOD=cisco_ipsec
19 WHOAMI=`id | sed -e 's/(.*//'`
20
21 # See how we were called.
22 case "$1" in
23   start)
24         echo -n "Starting ${VPNCLIENT}: "
25         if [ "$WHOAMI" != "uid=0" ] ; then
26                 echo "Failed (super user access required)"
27                 exit 1
28         fi
29         /sbin/lsmod | grep -q "${VPNMOD}"
30         if [ "$?" = "0" ] ; then
31                 echo "module ${VPNMOD} is already running. Use restart instead."
32                 exit 1
33         fi
34
35         if [ -f /etc/resolv.conf.vpnbackup ]; then
36                 echo "restoring /etc/resolv.conf"
37                 mv /etc/resolv.conf.vpnbackup /etc/resolv.conf
38         fi
39         /sbin/modprobe ${VPNMOD}
40         if [ "$?" != "0" ] ; then
41                 echo "Failed (insmod)"
42         exit 1
43         fi
44         case "`uname -r`" in
45         2.6.*)
46                 ;;
47         2.5.*)
48                 ;;
49         2.4.*)
50                 ;;
51         2.2.*)
52                 ;;
53         2.0.*)
54                 #
55                 # This is only needed due to a bug in 2.0.x kernels that affects
56                 # arp lookups.
57                 #
58                 ifconfig $VPNDEV 222.222.222.222 ;
59                 if [ "$?" != "0" ] ; then
60                         echo "Failed (ifconfig)"
61                         /sbin/rmmod ${VPNMOD}
62                         exit 1
63                 fi
64                 ;;
65         *)
66                 echo "Failed (unsupported Linux version)"
67                 /sbin/rmmod ${VPNMOD}
68                 exit 1
69                 ;;
70         esac
71         echo "Done"
72         ;;
73   stop)
74         echo -n "Shutting down ${VPNCLIENT}: "
75         if [ "$WHOAMI" != "uid=0" ] ; then
76                 echo "Failed (super user access required)"
77                 exit 1
78         fi
79     killall cvpnd > /dev/null 2>&1
80
81         /sbin/lsmod | grep -q "${VPNMOD}"
82     if [ "$?" != "0" ] ; then
83                 echo "module ${VPNMOD} is not running."
84                 exit 1
85         fi
86         /sbin/ifconfig $VPNDEV down
87         if [ "$?" != "0" ] ; then
88                 echo "Failed (ifconfig)"
89                 exit 1
90         fi
91         /sbin/rmmod ${VPNMOD}
92         if [ "$?" != "0" ] ; then
93                 echo "Failed (rmmod)"
94                 exit 1
95         fi
96         echo "Done"
97         ;;
98   status)
99         /sbin/lsmod | egrep 'Module'
100         /sbin/lsmod | egrep "${VPNMOD}"
101         if [ "$?" != "0" ] ; then
102                         echo
103                         echo "Status Failed (lsmod ${VPNMOD}) - The VPN module is not loaded."
104     fi
105         echo
106         /sbin/ifconfig $VPNDEV
107         if [ "$?" != "0" ] ; then
108                 echo
109                 echo "Status Failed (ifconfig ${VPNDEV}) - The virtual interface is not present."
110                 exit 1
111         fi
112         ;;
113   restart|reload)
114         $0 stop
115         $0 start
116         ;;
117   *)
118         echo "Usage: $0 {start|stop|restart|reload|status}"
119         exit 1
120 esac
121
122 exit 0
This page took 0.057879 seconds and 3 git commands to generate.