]> git.pld-linux.org Git - packages/freeswan.git/blob - freeswan-init.patch
c05475f8f261e034169f2640e535a27db4651574
[packages/freeswan.git] / freeswan-init.patch
1 --- freeswan-1.97/utils/setup   Wed Jun 20 17:55:13 2001
2 +++ freeswan-1.97/utils/setup.org       Wed May  1 18:38:35 2002
3 @@ -30,10 +30,28 @@
4  # description: IPsec provides encrypted and authenticated communications; \
5  # KLIPS is the kernel half of it, Pluto is the user-level management daemon.
6  
7 -me='ipsec setup'               # for messages
8 +# Source function library
9 +. /etc/rc.d/init.d/functions
10 +
11 +# Get network config
12 +. /etc/sysconfig/network
13 +
14 +# Check that networking is up.
15 +if is_yes "${NETWORKING}"; then
16 +       if [ ! -f /var/lock/subsys/network ]; then
17 +               # nls "ERROR: Networking is down. %s can't be run." ipsec
18 +               msg_network_down ipsec
19 +               exit 1
20 +       fi
21 +else
22 +       exit 0
23 +fi
24  
25  
26  
27 +me='ipsec setup'               # for messages
28 +
29 +
30  if test " $IPSEC_DIR" = " "    # if we were not called by the ipsec command
31  then
32         # we must establish a suitable PATH ourselves
33 @@ -54,7 +72,7 @@
34  if ! test "$found"
35  then
36         echo "cannot find ipsec command -- \`$1' aborted" |
37 -               logger -s -p daemon.error -t ipsec_setup
38 +               logger -p daemon.error -t ipsec_setup
39         exit 1
40  fi
41  
42 @@ -65,7 +83,7 @@
43  if test " $IPSEC_confreadstatus" != " "
44  then
45         echo "$IPSEC_confreadstatus -- \`$1' aborted" |
46 -               logger -s -p daemon.error -t ipsec_setup
47 +               logger -p daemon.error -t ipsec_setup
48         exit 1
49  fi
50  IPSECsyslog=${IPSECsyslog-daemon.error}
51 @@ -78,23 +96,73 @@
52  
53  # do it
54  case "$1" in
55 -  start|--start|stop|--stop|_autostop|_autostart)
56 -       if test " `id -u`" != " 0"
57 -       then
58 -               echo "permission denied (must be superuser)" |
59 -                       logger -s -p $IPSECsyslog -t ipsec_setup 2>&1
60 +  start|--start|_autostart)
61 +       # Check if the service is already running?
62 +       if [ ! -f /var/lock/subsys/ipsec ]; then
63 +               # show "Starting %s service" ipsec
64 +               msg_starting ipsec
65 +               busy
66 +               if test " `id -u`" != " 0"
67 +               then
68 +                   echo "permission denied (must be superuser)" |
69 +                       logger -p $IPSECsyslog -t ipsec_setup 2>&1
70 +                   fail
71 +                   exit 1
72 +               fi
73 +               {
74 +                   ipsec _realsetup $1 ;
75 +                   RETVAL=$?;
76 +               } 2>&1 | logger -p $IPSECsyslog -t ipsec_setup 2>&1
77 +
78 +               if [ "$RETVAL" -eq 0 ];
79 +               then
80 +                   touch /var/lock/subsys/ipsec
81 +                   ok
82 +                   exit $RETVAL;
83 +               fi
84 +               fail
85 +               exit $RETVAL
86 +
87 +       else
88 +               # show "%s service is already running." ipsec
89 +               msg_already_running ipsec
90 +               
91                 exit 1
92         fi
93 -       tmp=/var/run/ipsec_setup.st
94 -       (
95 -               ipsec _realsetup $1
96 -               echo "$?" >$tmp
97 -       ) 2>&1 | logger -s -p $IPSECsyslog -t ipsec_setup 2>&1
98 -       st=`cat $tmp`
99 -       rm -f $tmp
100 -       exit $st
101 -       ;;
102 +       ;;
103  
104 +  stop|--stop|_autostop)
105 +        # Stop daemons.
106 +        # show "Stopping %s service" ipsec
107 +       if [ -f /var/lock/subsys/ipsec ]; then
108 +               msg_stopping ipsec
109 +               busy
110 +               if test " `id -u`" != " 0"
111 +               then
112 +                   echo "permission denied (must be superuser)" |
113 +                       logger -p $IPSECsyslog -t ipsec_setup 2>&1
114 +                   fail
115 +                   exit 1
116 +               fi
117 +               {
118 +                   ipsec _realsetup $1 ;
119 +                   RETVAL=$?;
120 +               } 2>&1 | logger -p $IPSECsyslog -t ipsec_setup 2>&1
121 +
122 +               rm -f /var/lock/subsys/ipsec
123 +
124 +               if [ "$RETVAL" -eq 0 ];
125 +               then
126 +                   ok
127 +                   exit $RETVAL;
128 +               fi
129 +               fail
130 +               exit $RETVAL
131 +       else
132 +               # show "%s service is not running." ipsec
133 +               msg_not_running ipsec
134 +               exit 1
135 +       fi
136 +       ;;
137    restart|--restart)
138         $0 stop
139         $0 start
This page took 0.065911 seconds and 2 git commands to generate.