1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-28 16:43:09 +00:00

The precmd routine does not need to check whether the command should be

"forced". If some pre-condition is not met, it should fail as it normally
does and rc.subr(8) will make the appropriate decision. Incidentally, the
previous behaviour had a bug where the "force" flag was respected only
when checking rc.conf(5) knobs. The flag was ignored when verifying the
rpcbind(8) dependency.

MFC after: 2 weeks
This commit is contained in:
Mike Makonnen 2007-05-17 08:57:14 +00:00
parent cbfaeb5fe3
commit c76ad7642f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=169653
3 changed files with 30 additions and 24 deletions

View File

@ -14,20 +14,21 @@
# Save the (one) commandline argument in case it gets clobbered.
arg=$1
# Either NFS client or server must be enabled or this must be a 'forcestart'
# for either of the daemons to start.
# Either NFS client or server must be enabled and rpcbind(8) must be started.
#
nfslocking_precmd()
{
if ! checkyesno nfs_server_enable && ! checkyesno nfs_client_enable && \
[ -z "$rc_force" ]
local ret
ret=0
if ! checkyesno nfs_server_enable && ! checkyesno nfs_client_enable
then
return 1
ret=1
fi
if ! checkyesno rpcbind_enable && \
! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
then
force_depend rpcbind || return 1
force_depend rpcbind || ret=1
fi
if [ $name = "statd" ]
@ -37,11 +38,12 @@ nfslocking_precmd()
then
rc_flags=${rpc_lockd_flags}
fi
return ${ret}
}
start_precmd="nfslocking_precmd"
stop_precmd='checkyesno nfs_server_enable || checkyesno nfs_client_enable ||
[ -n "$rc_force" ]'
stop_precmd='checkyesno nfs_server_enable || checkyesno nfs_client_enable'
status_precmd=$stop_precmd
# rpc.statd

View File

@ -14,20 +14,21 @@
# Save the (one) commandline argument in case it gets clobbered.
arg=$1
# Either NFS client or server must be enabled or this must be a 'forcestart'
# for either of the daemons to start.
# Either NFS client or server must be enabled and rpcbind(8) must be started.
#
nfslocking_precmd()
{
if ! checkyesno nfs_server_enable && ! checkyesno nfs_client_enable && \
[ -z "$rc_force" ]
local ret
ret=0
if ! checkyesno nfs_server_enable && ! checkyesno nfs_client_enable
then
return 1
ret=1
fi
if ! checkyesno rpcbind_enable && \
! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
then
force_depend rpcbind || return 1
force_depend rpcbind || ret=1
fi
if [ $name = "statd" ]
@ -37,11 +38,12 @@ nfslocking_precmd()
then
rc_flags=${rpc_lockd_flags}
fi
return ${ret}
}
start_precmd="nfslocking_precmd"
stop_precmd='checkyesno nfs_server_enable || checkyesno nfs_client_enable ||
[ -n "$rc_force" ]'
stop_precmd='checkyesno nfs_server_enable || checkyesno nfs_client_enable'
status_precmd=$stop_precmd
# rpc.statd

View File

@ -14,20 +14,21 @@
# Save the (one) commandline argument in case it gets clobbered.
arg=$1
# Either NFS client or server must be enabled or this must be a 'forcestart'
# for either of the daemons to start.
# Either NFS client or server must be enabled and rpcbind(8) must be started.
#
nfslocking_precmd()
{
if ! checkyesno nfs_server_enable && ! checkyesno nfs_client_enable && \
[ -z "$rc_force" ]
local ret
ret=0
if ! checkyesno nfs_server_enable && ! checkyesno nfs_client_enable
then
return 1
ret=1
fi
if ! checkyesno rpcbind_enable && \
! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
then
force_depend rpcbind || return 1
force_depend rpcbind || ret=1
fi
if [ $name = "statd" ]
@ -37,11 +38,12 @@ nfslocking_precmd()
then
rc_flags=${rpc_lockd_flags}
fi
return ${ret}
}
start_precmd="nfslocking_precmd"
stop_precmd='checkyesno nfs_server_enable || checkyesno nfs_client_enable ||
[ -n "$rc_force" ]'
stop_precmd='checkyesno nfs_server_enable || checkyesno nfs_client_enable'
status_precmd=$stop_precmd
# rpc.statd