blob: 4c5c27fcd97da5e1ad2758ca2eb80ba554f7e986 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#!/bin/sh
# PROVIDE: dhcp6c
# REQUIRE: netif
# BEFORE: NETWORKING
# KEYWORD: shutdown
# Add the following lines to
# /etc/rc.conf.d/dhcp6c /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# dhcp6c_enable (bool): Set to NO by default.
# Set it to YES to enable dhcp6c.
# dhcp6c_config (path): Set to %%PREFIX%%/etc/dhcp6c.conf
# by default.
# dhcp6c_dhcp6cctlkey (path): Set to %%PREFIX%%/etc/dhcp6cctlkey
# by default.
# dhcp6c_pidfile (path): Set to /var/run/dhcp6c.pid
# by default.
# dhcp6c_interfaces (NIC list): Not defined by default.
# Set it to the network interface(s) where dhcp6c should work on.
# dhcp6c_flags (additional arguments): Not defined by default.
#
. /etc/rc.subr
name="dhcp6c"
rcvar=dhcp6c_enable
command="%%PREFIX%%/sbin/${name}"
start_precmd="${name}_precmd"
load_rc_config $name
: ${dhcp6c_enable="NO"}
: ${dhcp6c_config="%%PREFIX%%/etc/${name}.conf"}
: ${dhcp6c_dhcp6cctlkey="%%PREFIX%%/etc/dhcp6cctlkey"}
: ${dhcp6c_pidfile="/var/run/${name}.pid"}
required_files="${dhcp6c_config}"
pidfile="${dhcp6c_pidfile}"
command_args="-c ${dhcp6c_config} -p ${dhcp6c_pidfile} ${dhcp6c_interfaces}"
dhcp6c_precmd()
{
if [ -z ${dhcp6c_interfaces} ]; then
warn "dhcp6c_interfaces is not set."
return 1
fi
if [ ! -s ${dhcp6c_dhcp6cctlkey} ]; then
echo "Creating ${dhcp6c_dhcp6cctlkey}"
(umask 077 ; openssl rand -base64 48 > ${dhcp6c_dhcp6cctlkey})
fi
}
run_rc_command "$1"
|