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