svn commit: r231792 - in stable/9/etc: . defaults rc.d
Doug Barton
dougb at FreeBSD.org
Wed Feb 15 22:59:15 UTC 2012
Author: dougb
Date: Wed Feb 15 22:59:15 2012
New Revision: 231792
URL: http://svn.freebsd.org/changeset/base/231792
Log:
MFC r231667:
Fix various issues with the NFS and RPC related scripts.
Add new functionality to the force_depend method.
Modified:
stable/9/etc/defaults/rc.conf
stable/9/etc/rc.d/amd
stable/9/etc/rc.d/apmd
stable/9/etc/rc.d/keyserv
stable/9/etc/rc.d/lockd
stable/9/etc/rc.d/mountd
stable/9/etc/rc.d/nfsd
stable/9/etc/rc.d/statd
stable/9/etc/rc.d/ypbind
stable/9/etc/rc.d/yppasswdd
stable/9/etc/rc.d/ypserv
stable/9/etc/rc.d/ypset
stable/9/etc/rc.d/ypupdated
stable/9/etc/rc.d/ypxfrd
stable/9/etc/rc.subr
Directory Properties:
stable/9/etc/ (props changed)
Modified: stable/9/etc/defaults/rc.conf
==============================================================================
--- stable/9/etc/defaults/rc.conf Wed Feb 15 22:49:25 2012 (r231791)
+++ stable/9/etc/defaults/rc.conf Wed Feb 15 22:59:15 2012 (r231792)
@@ -29,6 +29,8 @@ early_late_divider="FILESYSTEMS" # Scrip
# stages of the boot process. Make sure you know
# the ramifications if you change this.
# See rc.conf(5) for more details.
+always_force_depends="NO" # Set to check that indicated dependencies are
+ # running during boot (can increase boot time).
swapfile="NO" # Set to name of swapfile if aux swapfile desired.
apm_enable="NO" # Set to YES to enable APM BIOS functions (or NO).
Modified: stable/9/etc/rc.d/amd
==============================================================================
--- stable/9/etc/rc.d/amd Wed Feb 15 22:49:25 2012 (r231791)
+++ stable/9/etc/rc.d/amd Wed Feb 15 22:59:15 2012 (r231792)
@@ -19,15 +19,8 @@ extra_commands="reload"
amd_precmd()
{
- if ! checkyesno nfs_client_enable; then
- force_depend nfsclient || return 1
- fi
-
- if ! checkyesno rpcbind_enable && \
- ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
- then
- force_depend rpcbind || return 1
- fi
+ force_depend nfsclient nfs_client || return 1
+ force_depend rpcbind || return 1
case ${amd_map_program} in
[Nn][Oo] | '')
@@ -49,7 +42,6 @@ amd_precmd()
command_args="> /var/run/amd.pid 2> /dev/null"
;;
esac
- return 0
}
load_rc_config $name
Modified: stable/9/etc/rc.d/apmd
==============================================================================
--- stable/9/etc/rc.d/apmd Wed Feb 15 22:49:25 2012 (r231791)
+++ stable/9/etc/rc.d/apmd Wed Feb 15 22:59:15 2012 (r231792)
@@ -19,24 +19,18 @@ apmd_prestart()
{
case `${SYSCTL_N} hw.machine_arch` in
i386)
- # Enable apm if it is not already enabled
- if ! checkyesno apm_enable && \
- ! /etc/rc.d/apm forcestatus 1>/dev/null 2>&1
- then
- force_depend apm || return 1
- fi
+ force_depend apm || return 1
# Warn user about acpi apm compatibility support which
# does not work with apmd.
if [ ! -e /dev/apmctl ]; then
- warn "/dev/apmctl not found; kernel is missing apm(4)"
+ warn "/dev/apmctl not found; kernel is missing apm(4)"
fi
;;
*)
return 1
;;
esac
- return 0
}
load_rc_config $name
Modified: stable/9/etc/rc.d/keyserv
==============================================================================
--- stable/9/etc/rc.d/keyserv Wed Feb 15 22:49:25 2012 (r231791)
+++ stable/9/etc/rc.d/keyserv Wed Feb 15 22:59:15 2012 (r231792)
@@ -19,13 +19,7 @@ start_precmd="keyserv_prestart"
keyserv_prestart()
{
- if ! checkyesno rpcbind_enable && \
- ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
- then
- force_depend rpcbind || return 1
- fi
-
- return 0
+ force_depend rpcbind || return 1
}
load_rc_config $name
Modified: stable/9/etc/rc.d/lockd
==============================================================================
--- stable/9/etc/rc.d/lockd Wed Feb 15 22:49:25 2012 (r231791)
+++ stable/9/etc/rc.d/lockd Wed Feb 15 22:59:15 2012 (r231792)
@@ -15,28 +15,16 @@ name="lockd"
rcvar=rpc_lockd_enable
command="/usr/sbin/rpc.${name}"
start_precmd='lockd_precmd'
-stop_precmd='checkyesno nfs_server_enable || checkyesno nfs_client_enable'
-status_precmd=$stop_precmd
# Make sure that we are either an NFS client or server, and that we get
# the correct flags from rc.conf(5).
#
lockd_precmd()
{
- local ret
- ret=0
-
- if ! checkyesno nfs_server_enable && ! checkyesno nfs_client_enable
- then
- ret=1
- fi
- if ! checkyesno rpcbind_enable && \
- ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
- then
- force_depend rpcbind || ret=1
- fi
+ force_depend rpcbind || return 1
+ force_depend statd rpc_statd || return 1
+
rc_flags=${rpc_lockd_flags}
- return ${ret}
}
load_rc_config $name
Modified: stable/9/etc/rc.d/mountd
==============================================================================
--- stable/9/etc/rc.d/mountd Wed Feb 15 22:49:25 2012 (r231791)
+++ stable/9/etc/rc.d/mountd Wed Feb 15 22:59:15 2012 (r231792)
@@ -19,11 +19,7 @@ extra_commands="reload"
mountd_precmd()
{
- if ! checkyesno rpcbind_enable && \
- ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
- then
- force_depend rpcbind || return 1
- fi
+ force_depend rpcbind || return 1
# mountd flags will differ depending on rc.conf settings
#
@@ -48,8 +44,8 @@ mountd_precmd()
fi
rm -f /var/db/mountdtab
- ( umask 022 ; > /var/db/mountdtab )
- return 0
+ ( umask 022 ; > /var/db/mountdtab ) ||
+ err 1 'Cannot create /var/db/mountdtab'
}
load_rc_config $name
Modified: stable/9/etc/rc.d/nfsd
==============================================================================
--- stable/9/etc/rc.d/nfsd Wed Feb 15 22:49:25 2012 (r231791)
+++ stable/9/etc/rc.d/nfsd Wed Feb 15 22:59:15 2012 (r231792)
@@ -48,31 +48,15 @@ nfsd_precmd()
if checkyesno nfsv4_server_enable; then
sysctl vfs.nfsd.server_max_nfsvers=4 > /dev/null
- if ! checkyesno nfsuserd_enable && \
- ! /etc/rc.d/nfsuserd forcestatus 1>/dev/null 2>&1
- then
- if ! force_depend nfsuserd; then
- err 1 "Cannot run nfsuserd"
- fi
- fi
+ force_depend nfsuserd || err 1 "Cannot run nfsuserd"
else
echo 'NFSv4 is disabled'
sysctl vfs.nfsd.server_max_nfsvers=3 > /dev/null
fi
fi
- if ! checkyesno rpcbind_enable && \
- ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
- then
- force_depend rpcbind || return 1
- fi
-
- if ! checkyesno mountd_enable && \
- ! /etc/rc.d/mountd forcestatus 1>/dev/null 2>&1
- then
- force_depend mountd || return 1
- fi
- return 0
+ force_depend rpcbind || return 1
+ force_depend mountd || return 1
}
run_rc_command "$1"
Modified: stable/9/etc/rc.d/statd
==============================================================================
--- stable/9/etc/rc.d/statd Wed Feb 15 22:49:25 2012 (r231791)
+++ stable/9/etc/rc.d/statd Wed Feb 15 22:59:15 2012 (r231792)
@@ -15,28 +15,15 @@ name="statd"
rcvar=rpc_statd_enable
command="/usr/sbin/rpc.${name}"
start_precmd='statd_precmd'
-stop_precmd='checkyesno nfs_server_enable || checkyesno nfs_client_enable'
-status_precmd=$stop_precmd
# Make sure that we are either an NFS client or server, and that we get
# the correct flags from rc.conf(5).
#
statd_precmd()
{
- local ret
- ret=0
-
- if ! checkyesno nfs_server_enable && ! checkyesno nfs_client_enable
- then
- ret=1
- fi
- if ! checkyesno rpcbind_enable && \
- ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
- then
- force_depend rpcbind || ret=1
- fi
+ force_depend rpcbind || return 1
+
rc_flags=${rpc_statd_flags}
- return ${ret}
}
load_rc_config $name
Modified: stable/9/etc/rc.d/ypbind
==============================================================================
--- stable/9/etc/rc.d/ypbind Wed Feb 15 22:49:25 2012 (r231791)
+++ stable/9/etc/rc.d/ypbind Wed Feb 15 22:59:15 2012 (r231792)
@@ -11,22 +11,20 @@
. /etc/rc.subr
name="ypbind"
-command="/usr/sbin/${name}"
-start_precmd="ypbind_precmd"
+rcvar="nis_client_enable"
load_rc_config $name
-rcvar="nis_client_enable"
+
+command="/usr/sbin/${name}"
command_args="${nis_client_flags}"
+start_precmd="ypbind_precmd"
+
ypbind_precmd()
{
local _domain
- if ! checkyesno rpcbind_enable && \
- ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
- then
- force_depend rpcbind || return 1
- fi
+ force_depend rpcbind || return 1
_domain=`domainname`
if [ -z "$_domain" ]; then
Modified: stable/9/etc/rc.d/yppasswdd
==============================================================================
--- stable/9/etc/rc.d/yppasswdd Wed Feb 15 22:49:25 2012 (r231791)
+++ stable/9/etc/rc.d/yppasswdd Wed Feb 15 22:59:15 2012 (r231792)
@@ -11,27 +11,22 @@
. /etc/rc.subr
name="yppasswdd"
-command="/usr/sbin/rpc.${name}"
-start_precmd="yppasswdd_precmd"
+rcvar="nis_yppasswdd_enable"
load_rc_config $name
-rcvar="nis_yppasswdd_enable"
+
+command="/usr/sbin/rpc.${name}"
command_args="${nis_yppasswdd_flags}"
+start_precmd="yppasswdd_precmd"
+
yppasswdd_precmd()
{
local _domain
- if ! checkyesno rpcbind_enable && \
- ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
- then
- force_depend rpcbind || return 1
- fi
- if ! checkyesno nis_server_enable && \
- ! /etc/rc.d/ypserv forcestatus 1>/dev/null 2>&1
- then
- force_depend ypserv || return 1
- fi
+ force_depend rpcbind || return 1
+ force_depend ypserv nis_server || return 1
+
_domain=`domainname`
if [ -z "$_domain" ]; then
warn "NIS domainname(1) is not set."
Modified: stable/9/etc/rc.d/ypserv
==============================================================================
--- stable/9/etc/rc.d/ypserv Wed Feb 15 22:49:25 2012 (r231791)
+++ stable/9/etc/rc.d/ypserv Wed Feb 15 22:59:15 2012 (r231792)
@@ -11,21 +11,20 @@
name="ypserv"
rcvar="nis_server_enable"
-command="/usr/sbin/${name}"
-start_precmd="ypserv_prestart"
load_rc_config $name
+
+command="/usr/sbin/${name}"
command_args="${nis_server_flags}"
+start_precmd="ypserv_prestart"
+
ypserv_prestart()
{
local _domain
- if ! checkyesno rpcbind_enable && \
- ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
- then
- force_depend rpcbind || return 1
- fi
+ force_depend rpcbind || return 1
+
_domain=`domainname`
if [ -z "$_domain" ]; then
warn "NIS domainname(1) is not set."
Modified: stable/9/etc/rc.d/ypset
==============================================================================
--- stable/9/etc/rc.d/ypset Wed Feb 15 22:49:25 2012 (r231791)
+++ stable/9/etc/rc.d/ypset Wed Feb 15 22:59:15 2012 (r231792)
@@ -11,25 +11,20 @@
name="ypset"
rcvar="nis_ypset_enable"
-command="/usr/sbin/${name}"
-start_precmd="ypset_precmd"
+
load_rc_config $name
+
+command="/usr/sbin/${name}"
command_args="${nis_ypset_flags}"
+start_precmd="ypset_precmd"
+
ypset_precmd()
{
local _domain
- if ! checkyesno rpcbind_enable && \
- ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
- then
- force_depend rpcbind || return 1
- fi
- if ! checkyesno nis_client_enable && \
- ! /etc/rc.d/ypbind forcestatus 1>/dev/null 2>&1
- then
- force_depend ypbind || return 1
- fi
+ force_depend rpcbind || return 1
+ force_depend ypbind nis_client || return 1
_domain=`domainname`
if [ -z "$_domain" ]; then
Modified: stable/9/etc/rc.d/ypupdated
==============================================================================
--- stable/9/etc/rc.d/ypupdated Wed Feb 15 22:49:25 2012 (r231791)
+++ stable/9/etc/rc.d/ypupdated Wed Feb 15 22:59:15 2012 (r231792)
@@ -11,6 +11,9 @@
name="ypupdated"
rcvar="rpc_ypupdated_enable"
+
+load_rc_config $name
+
command="/usr/sbin/rpc.${name}"
start_precmd="rpc_ypupdated_precmd"
@@ -18,16 +21,8 @@ rpc_ypupdated_precmd()
{
local _domain
- if ! checkyesno rpcbind_enable && \
- ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
- then
- force_depend rpcbind || return 1
- fi
- if ! checkyesno nis_server_enable && \
- ! /etc/rc.d/ypserv forcestatus 1>/dev/null 2>&1
- then
- force_depend ypserv || return 1
- fi
+ force_depend rpcbind || return 1
+ force_depend ypserv nis_server || return 1
_domain=`domainname`
if [ -z "$_domain" ]; then
@@ -36,5 +31,4 @@ rpc_ypupdated_precmd()
fi
}
-load_rc_config $name
run_rc_command "$1"
Modified: stable/9/etc/rc.d/ypxfrd
==============================================================================
--- stable/9/etc/rc.d/ypxfrd Wed Feb 15 22:49:25 2012 (r231791)
+++ stable/9/etc/rc.d/ypxfrd Wed Feb 15 22:59:15 2012 (r231792)
@@ -11,25 +11,20 @@
name="ypxfrd"
rcvar="nis_ypxfrd_enable"
-command="/usr/sbin/rpc.${name}"
-start_precmd="ypxfrd_precmd"
+
load_rc_config $name
+
+command="/usr/sbin/rpc.${name}"
command_args="${nis_ypxfrd_flags}"
+start_precmd="ypxfrd_precmd"
+
ypxfrd_precmd()
{
local _domain
- if ! checkyesno rpcbind_enable && \
- ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
- then
- force_depend rpcbind || return 1
- fi
- if ! checkyesno nis_server_enable && \
- ! /etc/rc.d/ypserv forcestatus 1>/dev/null 2>&1
- then
- force_depend ypserv || return 1
- fi
+ force_depend rpcbind || return 1
+ force_depend ypserv nis_server || return 1
_domain=`domainname`
if [ -z "$_domain" ]; then
Modified: stable/9/etc/rc.subr
==============================================================================
--- stable/9/etc/rc.subr Wed Feb 15 22:49:25 2012 (r231791)
+++ stable/9/etc/rc.subr Wed Feb 15 22:59:15 2012 (r231792)
@@ -113,22 +113,29 @@ set_rcvar_obsolete()
}
#
-# force_depend script
+# force_depend script [rcvar]
# Force a service to start. Intended for use by services
-# to resolve dependency issues. It is assumed the caller
-# has check to make sure this call is necessary
+# to resolve dependency issues.
# $1 - filename of script, in /etc/rc.d, to run
+# $2 - name of the script's rcvar (minus the _enable)
#
force_depend()
{
+ local _depend _dep_rcvar
+
_depend="$1"
+ _dep_rcvar="${2:-$1}_enable"
+
+ [ -n "$rc_fast" ] && ! checkyesno always_force_depends &&
+ checkyesno $_dep_rcvar && return 0
+
+ /etc/rc.d/${_depend} forcestatus >/dev/null 2>&1 && return 0
info "${name} depends on ${_depend}, which will be forced to start."
if ! /etc/rc.d/${_depend} forcestart; then
warn "Unable to force ${_depend}. It may already be running."
return 1
fi
- return 0
}
#
More information about the svn-src-stable-9
mailing list