Add gcc40 build hooks. Gcc40 isn't built per default, you will have to
[dragonfly.git] / etc / rc.d / ipsec
1 #!/bin/sh
2 #
3 # $NetBSD: ipsec,v 1.7 2002/03/22 04:33:58 thorpej Exp $
4 # $FreeBSD: src/etc/rc.d/ipsec,v 1.5 2003/02/16 20:46:08 mtm Exp $
5 # $DragonFly: src/etc/rc.d/ipsec,v 1.4 2005/04/22 08:30:25 joerg Exp $
6 #
7
8 # PROVIDE: ipsec
9 # REQUIRE: root mountcritlocal tty
10 # BEFORE:  DAEMON
11 # KEYWORD: DragonFly 
12
13 . /etc/rc.subr
14
15 name="ipsec"
16 rcvar=`set_rcvar`
17 start_precmd="ipsec_prestart"
18 start_cmd="ipsec_start"
19 stop_precmd="test -f /etc/ipsec.conf"
20 stop_cmd="ipsec_stop"
21 reload_cmd="ipsec_reload"
22 extra_commands="reload"
23 ipsec_program="/usr/sbin/setkey"
24 # ipsec_file is set by rc.conf
25
26 ipsec_prestart()
27 {
28         if [ ! -f "$ipsec_file" ]; then
29                 warn "$ipsec_file not readable; ipsec start aborted."
30                         #
31                         # If booting directly to multiuser, send SIGTERM to
32                         # the parent (/etc/rc) to abort the boot
33                         #
34                 if [ "$autoboot" = yes ]; then
35                         echo "ERROR: ABORTING BOOT (sending SIGTERM to parent)!"
36                         kill -TERM $$
37                         exit 1
38                 fi
39                 return 1
40         fi
41         return 0
42 }
43
44 ipsec_start()
45 {
46         echo "Installing ipsec manual keys/policies."
47         ${ipsec_program} -f $ipsec_file
48 }
49
50 ipsec_stop()
51 {
52         echo "Clearing ipsec manual keys/policies."
53
54         # still not 100% sure if we would like to do this.
55         # it is very questionable to do this during shutdown session, since
56         # it can hang any of remaining IPv4/v6 session.
57         #
58         ${ipsec_program} -F
59         ${ipsec_program} -FP
60 }
61
62 ipsec_reload()
63 {
64         echo "Reloading ipsec manual keys/policies."
65         ${ipsec_program} -F
66         ${ipsec_program} -FP
67         ${ipsec_program} -f "$ipsec_file"
68 }
69
70 load_rc_config $name
71 run_rc_command "$1"