]> git.pld-linux.org Git - packages/freeswan.git/blob - freeswan-init.patch
- quote %{__cc}
[packages/freeswan.git] / freeswan-init.patch
1 --- freeswan-2.00-rc2/programs/setup/setup.in.org       Mon Mar 24 14:51:14 2003
2 +++ freeswan-2.00-rc2/programs/setup/setup.in   Mon Mar 24 15:19:32 2003
3 @@ -31,6 +31,24 @@
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 +
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  me='ipsec setup'               # for messages
26  
27  
28 @@ -63,7 +81,7 @@
29  if ! test "$found"
30  then
31         echo "cannot find ipsec command -- \`$1' aborted" |
32 -               logger -s -p daemon.error -t ipsec_setup
33 +               logger -p daemon.error -t ipsec_setup
34         exit 1
35  fi
36  
37 @@ -92,7 +110,7 @@
38  if test " $IPSEC_confreadstatus" != " "
39  then
40         echo "$IPSEC_confreadstatus -- \`$1' aborted" |
41 -               logger -s -p daemon.error -t ipsec_setup
42 +               logger -p daemon.error -t ipsec_setup
43         exit 1
44  fi
45  
46 @@ -108,26 +126,77 @@
47  
48  # do it
49  case "$1" in
50 -  start|--start|stop|--stop|_autostop|_autostart)
51 -       if test " `id -u`" != " 0"
52 -       then
53 -               echo "permission denied (must be superuser)" |
54 -                       logger -s -p $IPSECsyslog -t ipsec_setup 2>&1
55 -               exit 1
56 -       fi
57 -       tmp=/var/run/ipsec_setup.st
58 -       (
59 -               ipsec _realsetup $1
60 -               echo "$?" >$tmp
61 -       ) 2>&1 | logger -s -p $IPSECsyslog -t ipsec_setup 2>&1
62 -       st=$?
63 -       if test -f $tmp
64 -       then
65 -               st=`cat $tmp`
66 -               rm -f $tmp
67 +             start|--start|_autostart)
68 +                  # Check if the service is already running?
69 +                  if [ ! -f /var/lock/subsys/ipsec ]; then
70 +                          # show "Starting %s service" ipsec
71 +                          msg_starting ipsec
72 +                          busy
73 +                          if test " `id -u`" != " 0"
74 +                          then
75 +                              echo "permission denied (must be superuser)" |
76 +                                  logger -p $IPSECsyslog -t ipsec_setup 2>&1
77 +                              fail
78 +                              exit 1
79 +                          fi
80 +                          {
81 +                              ipsec _realsetup $1 ;
82 +                              RETVAL=$?;
83 +                          } | logger -p $IPSECsyslog -t ipsec_setup 2>&1
84 +
85 +                          if [ "$RETVAL" -eq 0 ];
86 +                          then
87 +                              touch /var/lock/subsys/ipsec
88 +                              ok
89 +                              exit $RETVAL;
90 +                          fi
91 +                          fail
92 +                          exit $RETVAL
93 +
94 +                  else
95 +                          # show "%s service is already running." ipsec
96 +                          msg_already_running ipsec
97 +
98 +
99 +
100 +               exit 1  
101         fi
102 -       exit $st
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 +
138 +
139  
140    restart|--restart)
141         $0 $IPSEC_setupflags stop
This page took 0.072272 seconds and 3 git commands to generate.