2006-04-28 12:03:38 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
|
2007-08-09 13:06:12 +00:00
|
|
|
# PROVIDE: nscd
|
2006-04-28 12:03:38 +00:00
|
|
|
# REQUIRE: DAEMON
|
|
|
|
# BEFORE: LOGIN
|
2008-07-16 19:50:29 +00:00
|
|
|
# KEYWORD: shutdown
|
2006-04-28 12:03:38 +00:00
|
|
|
|
|
|
|
#
|
2007-09-28 10:38:08 +00:00
|
|
|
# Add the following lines to /etc/rc.conf to enable nscd:
|
2006-04-28 12:03:38 +00:00
|
|
|
#
|
2007-08-09 13:06:12 +00:00
|
|
|
# nscd_enable="YES"
|
2006-04-28 12:03:38 +00:00
|
|
|
#
|
2007-08-09 13:06:12 +00:00
|
|
|
# See nscd(8) for flags
|
2006-04-28 12:03:38 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
2009-05-30 21:51:38 +00:00
|
|
|
name="nscd"
|
2012-01-14 02:18:41 +00:00
|
|
|
rcvar="nscd_enable"
|
2006-04-28 12:03:38 +00:00
|
|
|
|
2007-08-09 13:06:12 +00:00
|
|
|
command=/usr/sbin/nscd
|
2006-06-06 15:34:50 +00:00
|
|
|
extra_commands="flush"
|
|
|
|
flush_cmd="${command} -I all"
|
2006-04-28 12:03:38 +00:00
|
|
|
|
2007-09-28 10:38:08 +00:00
|
|
|
# usage: _nscd_set_option <option name> <default value>
|
|
|
|
#
|
|
|
|
_nscd_set_option() {
|
|
|
|
local _optname _defoptval _nscd_opt_val _cached_opt_val
|
|
|
|
_optname=$1
|
|
|
|
_defoptval=$2
|
|
|
|
|
|
|
|
_nscd_opt_val=$(eval "echo \$nscd_${_optname}")
|
|
|
|
_cached_opt_val=$(eval "echo \$cached_${_optname}")
|
2010-05-14 04:53:57 +00:00
|
|
|
|
2007-09-28 10:38:08 +00:00
|
|
|
if [ -n "$_cached_opt_val" -a "$_nscd_opt_val" != "$_defoptval" ]; then
|
|
|
|
warn "You should use nscd_${_optname} instead of" \
|
|
|
|
"cached_${_optname}"
|
|
|
|
setvar "nscd_${_optname}" "$_cached_opt_val"
|
|
|
|
else
|
|
|
|
setvar "nscd_${_optname}" "${_nscd_opt_val:-$_defoptval}"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2006-04-28 12:03:38 +00:00
|
|
|
|
|
|
|
load_rc_config $name
|
2007-09-28 10:38:08 +00:00
|
|
|
_nscd_set_option "enable" "NO"
|
|
|
|
_nscd_set_option "pidfile" "/var/run/nscd.pid"
|
|
|
|
_nscd_set_option "flags" ""
|
2006-04-28 12:03:38 +00:00
|
|
|
run_rc_command "$1"
|
2007-09-28 10:38:08 +00:00
|
|
|
|