]> git.pld-linux.org Git - packages/freeswan.git/blob - freeswan-init.patch
9d9e481f68983cb568dddba63e0655c4d37bb145
[packages/freeswan.git] / freeswan-init.patch
1 diff -Naur freeswan-1.95.orig/utils/setup freeswan-1.95/utils/setup
2 --- freeswan-1.95.orig/utils/setup      Mon Feb 18 12:48:24 2002
3 +++ freeswan-1.95/utils/setup   Mon Feb 18 13:45:46 2002
4 @@ -30,10 +30,27 @@
5  # description: IPsec provides encrypted and authenticated communications; \
6  # KLIPS is the kernel half of it, Pluto is the user-level management daemon.
7  
8 -me='ipsec setup'               # for messages
9 +# Source function library
10 +. /etc/rc.d/init.d/functions
11 +
12 +# Get network config
13 +. /etc/sysconfig/network
14 +
15 +# Check that networking is up.
16 +if is_yes "${NETWORKING}"; then
17 +       if [ ! -f /var/lock/subsys/network ]; then
18 +               # nls "ERROR: Networking is down. %s can't be run." <service>
19 +               msg_network_down <service>
20 +               exit 1
21 +       fi
22 +else
23 +       exit 0
24 +fi
25  
26  
27  
28 +me='ipsec setup'               # for messages
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 +71,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 +82,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,21 +95,51 @@
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 +               if test " `id -u`" != " 0"
66 +               then
67 +                   echo "permission denied (must be superuser)" |
68 +                       logger -p $IPSECsyslog -t ipsec_setup 2>&1
69 +                   exit 1
70 +               fi
71 +               (
72 +                   ipsec _realsetup $1 
73 +                   RETVAL=$?
74 +               ) 2>&1 | logger -p $IPSECsyslog -t ipsec_setup 2>&1
75 +               RETVAL=$?
76 +               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ipsec
77 +       else
78 +               # show "%s service is already running." ipsec
79 +               msg_already_running ipsec
80                 exit 1
81         fi
82 -       tmp=/var/run/ipsec_setup.st
83 -       (
84 -               ipsec _realsetup $1
85 -               echo "$?" >$tmp
86 -       ) 2>&1 | logger -s -p $IPSECsyslog -t ipsec_setup 2>&1
87 -       st=`cat $tmp`
88 -       rm -f $tmp
89 -       exit $st
90 +       ;;
91 +
92 +  stop|--stop|_autostop)
93 +        # Stop daemons.
94 +        # show "Stopping %s service" ipsec
95 +       if [ -f /var/lock/subsys/ipsec ]; then
96 +               msg_stopping ipsec
97 +               if test " `id -u`" != " 0"
98 +               then
99 +                   echo "permission denied (must be superuser)" |
100 +                       logger -p $IPSECsyslog -t ipsec_setup 2>&1
101 +                   exit 1
102 +               fi
103 +               (
104 +                   ipsec _realsetup $1 
105 +                   RETVAL=$?
106 +               ) 2>&1 | logger -p $IPSECsyslog -t ipsec_setup 2>&1
107 +               rm -f /var/lock/subsys/ipsec
108 +       else
109 +               # show "%s service is not running." ipsec
110 +               msg_not_running ipsec
111 +               exit 1
112 +       fi      
113         ;;
114  
115    restart|--restart)
This page took 0.090102 seconds and 3 git commands to generate.