From 88f7d3e22bfb37ad223b34c25e04c3f72d5557b1 Mon Sep 17 00:00:00 2001 From: Gordon Tetlow Date: Wed, 14 Aug 2002 05:44:32 +0000 Subject: [PATCH] Clean up the scripts to use the new variables: xntpd_* -> ntpd_* portmap_* -> rpcbind_* Also change single_mountd_enable -> mountd_enable Changing the mountd flags brings us closer to NetBSD. All of the old variable names are shimmed so you can continue to use the old variable name. Finally make /etc/rc.d/mountd no longer dependent on nfs as there are (apparently) other consumers of mountd. Submitted by: Mike Makonnen --- etc/rc.d/amd | 2 +- etc/rc.d/keyserv | 13 ++++++++++++- etc/rc.d/mountd | 16 ++-------------- etc/rc.d/nfsd | 13 ++++++++++++- etc/rc.d/ntpd | 15 ++++++--------- etc/rc.d/rpcbind | 17 +++-------------- etc/rc.d/yppasswdd | 16 +++++++++++++++- etc/rc.d/ypserv | 11 ++++++++++- etc/rc.d/ypset | 12 +++++++++++- etc/rc.d/ypupdated | 12 +++++++++++- etc/rc.d/ypxfrd | 12 +++++++++++- etc/rc.network | 12 ++++++------ 12 files changed, 100 insertions(+), 51 deletions(-) diff --git a/etc/rc.d/amd b/etc/rc.d/amd index 9faa86a4f520..971a1e7b4e1c 100755 --- a/etc/rc.d/amd +++ b/etc/rc.d/amd @@ -36,7 +36,7 @@ amd_precmd() force_depend nfsclient || return 1 fi - if ! checkyesno portmap_enable && \ + if ! checkyesno rpcbind_enable && \ ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1 then force_depend rpcbind || return 1 diff --git a/etc/rc.d/keyserv b/etc/rc.d/keyserv index 2f46908ddf7b..44194260ac69 100644 --- a/etc/rc.d/keyserv +++ b/etc/rc.d/keyserv @@ -16,7 +16,18 @@ name="keyserv" rcvar=`set_rcvar` command="/usr/sbin/${name}" -required_vars="portmap_enable" +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 +} load_rc_config $name run_rc_command "$1" diff --git a/etc/rc.d/mountd b/etc/rc.d/mountd index 6f0fe86eab6c..7de831bc684c 100755 --- a/etc/rc.d/mountd +++ b/etc/rc.d/mountd @@ -11,29 +11,17 @@ . /etc/rc.subr name="mountd" +rcvar=`set_rcvar` command="/usr/sbin/${name}" required_files="/etc/exports" start_precmd="mountd_precmd" extra_commands="reload" -case `${CMD_OSTYPE}` in -FreeBSD) - rcvar=`set_rcvar nfs_server` - ;; -NetBSD) - rcvar=`set_rcvar` - ;; -esac - mountd_precmd() { case `${CMD_OSTYPE}` in FreeBSD) - if ! sysctl vfs.nfsrv >/dev/null 2>&1; then - force_depend nfsserver || return 1 - fi - - if ! checkyesno portmap_enable && \ + if ! checkyesno rpcbind_enable && \ ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1 then force_depend rpcbind || return 1 diff --git a/etc/rc.d/nfsd b/etc/rc.d/nfsd index cf946ff491a6..0e05830b6e83 100755 --- a/etc/rc.d/nfsd +++ b/etc/rc.d/nfsd @@ -17,7 +17,6 @@ command="/usr/sbin/${name}" case `${CMD_OSTYPE}` in FreeBSD) command_args="${nfs_server_flags}" - required_vars="portmap_enable" start_precmd="nfsd_precmd" ;; NetBSD) @@ -32,6 +31,18 @@ nfsd_precmd() force_depend nfsserver || return 1 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 + if checkyesno nfs_reserved_port_only ; then echo -n ' NFS on reserved port only=YES' sysctl vfs.nfsrv.nfs_privport=1 > /dev/null diff --git a/etc/rc.d/ntpd b/etc/rc.d/ntpd index 81671a1d2a68..fa1726ef82f4 100755 --- a/etc/rc.d/ntpd +++ b/etc/rc.d/ntpd @@ -11,21 +11,18 @@ . /etc/rc.subr +name=ntpd +rcvar=`set_rcvar` +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" +required_files="/etc/ntp.conf" + case `${CMD_OSTYPE}` in -FreeBSD) - name="xntpd" - ;; NetBSD) - name="ntpd" start_precmd="ntpd_precmd" ;; esac -rcvar=`set_rcvar` -command="/usr/sbin/ntpd" -pidfile="/var/run/ntpd.pid" -required_files="/etc/ntp.conf" - ntpd_precmd() { if [ -z "$ntpd_chrootdir" ]; then diff --git a/etc/rc.d/rpcbind b/etc/rc.d/rpcbind index 191d6deba277..a11da1f82ade 100755 --- a/etc/rc.d/rpcbind +++ b/etc/rc.d/rpcbind @@ -11,25 +11,14 @@ . /etc/rc.subr name="rpcbind" - -# XXX - Executable may be in a different location. The $name variable -# is different from the variable in rc.conf(5) so the -# subroutines in rc.subr won't catch it. -# -load_rc_config $name +rcvar=`set_rcvar` +command="/usr/sbin/${name}" case `${CMD_OSTYPE}` in -FreeBSD) - pidfile= - rcvar="portmap_enable" - command="${portmap_program:-/usr/sbin/${name}}" - eval ${name}_flags=\"${portmap_flags}\" - ;; NetBSD) - rcvar=$name - command="/usr/sbin/${name}" pidfile="/var/run/${name}.pid" ;; esac +load_rc_config $name run_rc_command "$1" diff --git a/etc/rc.d/yppasswdd b/etc/rc.d/yppasswdd index 3cb98076b046..13928f330be9 100755 --- a/etc/rc.d/yppasswdd +++ b/etc/rc.d/yppasswdd @@ -18,7 +18,6 @@ start_precmd="yppasswdd_precmd" case `${CMD_OSTYPE}` in FreeBSD) rcvar="nis_yppasswdd_enable" - required_vars="portmap_enable nis_server_enable" command_args="${nis_yppasswdd_flags}" ;; NetBSD) @@ -29,6 +28,21 @@ esac yppasswdd_precmd() { + case `${CMD_OSTYPE}` in + FreeBSD) + 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 + ;; + esac + _domain=`domainname` if [ -z "$_domain" ]; then warn "domainname(1) is not set." diff --git a/etc/rc.d/ypserv b/etc/rc.d/ypserv index 99c8d9da6d75..29ec31625ac2 100755 --- a/etc/rc.d/ypserv +++ b/etc/rc.d/ypserv @@ -17,7 +17,6 @@ start_precmd="ypserv_precmd" case `${CMD_OSTYPE}` in FreeBSD) rcvar="nis_server_enable" - required_vars="portmap_enable" command_args="${nis_server_flags}" ;; NetBSD) @@ -28,6 +27,16 @@ esac ypserv_precmd() { + case `${CMD_OSTYPE}` in + FreeBSD) + if ! checkyesno rpcbind_enable && \ + ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1 + then + force_depend rpcbind || return 1 + fi + ;; + esac + _domain=`domainname` if [ -z "$_domain" ]; then warn "domainname(1) is not set." diff --git a/etc/rc.d/ypset b/etc/rc.d/ypset index 175a63492bfe..577b5450fd79 100644 --- a/etc/rc.d/ypset +++ b/etc/rc.d/ypset @@ -13,11 +13,21 @@ name="ypset" rcvar="nis_ypset_enable" command="/usr/sbin/${name}" command_args="${nis_ypset_flags}" -required_vars="portmap_enable nis_client_enable" start_precmd="ypset_precmd" ypset_precmd() { + 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 + _domain=`domainname` if [ -z "$_domain" ]; then warn "domainname(1) is not set." diff --git a/etc/rc.d/ypupdated b/etc/rc.d/ypupdated index 1b3e2b19723e..6e8b193485df 100644 --- a/etc/rc.d/ypupdated +++ b/etc/rc.d/ypupdated @@ -12,11 +12,21 @@ name="ypupdated" rcvar="rpc_ypupdated_enable" command="/usr/sbin/rpc.${name}" -required_vars="portmap_enable nis_server_enable" start_precmd="rpc_ypupdated_precmd" rpc_ypupdated_precmd() { + 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 + _domain=`domainname` if [ -z "$_domain" ]; then warn "domainname(1) is not set." diff --git a/etc/rc.d/ypxfrd b/etc/rc.d/ypxfrd index 9b325322abf4..cf873fbfaa7f 100644 --- a/etc/rc.d/ypxfrd +++ b/etc/rc.d/ypxfrd @@ -13,11 +13,21 @@ name="ypxfrd" rcvar="nis_ypxfrd_enable" command="/usr/sbin/rpc.${name}" command_args="${nis_ypxfrd_flags}" -required_vars="portmap_enable nis_server_enable" start_precmd="ypxfrd_precmd" ypxfrd_precmd() { + 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 + _domain=`domainname` if [ -z "$_domain" ]; then warn "domainname(1) is not set." diff --git a/etc/rc.network b/etc/rc.network index febaf839a3e7..95f92a4607bb 100644 --- a/etc/rc.network +++ b/etc/rc.network @@ -561,9 +561,9 @@ network_pass2() { ;; esac - case ${xntpd_enable} in + case ${ntpd_enable} in [Yy][Ee][Ss]) - echo -n ' ntpd'; ${xntpd_program:-ntpd} ${xntpd_flags} + echo -n ' ntpd'; ${ntpd_program:-ntpd} ${ntpd_flags} ;; esac @@ -573,10 +573,10 @@ network_pass2() { ;; esac - case ${portmap_enable} in + case ${rpcbind_enable} in [Yy][Ee][Ss]) - echo -n ' rpcbind'; ${portmap_program:-/usr/sbin/rpcbind} \ - ${portmap_flags} + echo -n ' rpcbind'; ${rpcbind_program:-/usr/sbin/rpcbind} \ + ${rpcbind_flags} # Start ypserv if we're an NIS server. # Run rpc.ypxfrd and rpc.yppasswdd only on the NIS master server. @@ -645,7 +645,7 @@ network_pass2() { network_pass3() { echo -n 'Starting final network daemons:' - case ${portmap_enable} in + case ${rpcbind_enable} in [Yy][Ee][Ss]) case ${nfs_server_enable} in [Yy][Ee][Ss])