cvs commit: src/etc/rc.d hostname ipfilter ipsec netif ttys

Bruce Evans bde at zeta.org.au
Sat Aug 2 06:07:25 PDT 2003


On Thu, 31 Jul 2003, Mike Makonnen wrote:

> On Thu, Jul 31, 2003 at 07:17:19PM +1000, Bruce Evans wrote:
> > Thanks.  Now `id' is the only command used before its file system
> > is mounted on my nfs clients.  id seems to be used only in rc.subr.
>
> What do you think of the following ?

I tested that it works for me.

% Index: etc/rc.subr
% ===================================================================
% RCS file: /home/ncvs/src/etc/rc.subr,v
% retrieving revision 1.14
% diff -u -r1.14 rc.subr
% --- etc/rc.subr	24 Jul 2003 18:17:21 -0000	1.14
% +++ etc/rc.subr	31 Jul 2003 15:54:58 -0000
% @@ -47,6 +47,8 @@
%  SYSCTL_N="${SYSCTL} -n"
%  CMD_OSTYPE="${SYSCTL_N} kern.ostype"
%  OSTYPE=`${CMD_OSTYPE}`
% +ID="/usr/bin/id"
% +IDCMD="if [ -x $ID ]; then $ID -un; fi"
%
%  case ${OSTYPE} in
%  FreeBSD)
% @@ -504,7 +506,7 @@
%  	    _group=\$${name}_group	_groups=\$${name}_groups
%
%  	if [ -n "$_user" ]; then	# unset $_user if running as that user
% -		if [ "$_user" = "$(id -un)" ]; then
% +		if [ "$_user" = "$(eval $IDCMD)" ]; then
%  			unset _user
%  		fi
%  	fi

I would put all the logic inline (id is only used once...).

${name}_user is documented to require /usr mounted.  Apparently something
is breaking the rules by setting it early.

Bruce


More information about the cvs-src mailing list