Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Apr 1995 10:40:39 -0700 (PDT)
From:      "Rodney W. Grimes" <rgrimes@gndrsh.aac.dev.com>
To:        asami@cs.berkeley.edu (Satoshi Asami | =?ISO-2022-JP?B?GyRCQHUbKEI=?= =?ISO-2022-JP?B?GyRCOCsbKEIgGyRCOC0bKEI=?=)
Cc:        adam@FreeBSD.org, pst@FreeBSD.org, ports@FreeBSD.org
Subject:   Re: cnews fails if user "news" doesn't exist
Message-ID:  <199504181740.KAA12813@gndrsh.aac.dev.com>
In-Reply-To: <199504180839.BAA03357@silvia.HIP.Berkeley.EDU> from "Satoshi Asami | =?ISO-2022-JP?B?GyRCQHUbKEI=?= =?ISO-2022-JP?B?GyRCOCsbKEIgGyRCOC0bKEI=?=" at Apr 18, 95 01:39:33 am

next in thread | previous in thread | raw e-mail | index | archive | help
> 
>  * > But a "make world" doesn't update master.passwd, so we still need to
>  * > do something about this from the ports standpoint (for people who did
>  * > a source upgrade).  Any ideas?
>  * 
>  * Use grep -q to find out if the user and the group exists, if it does not
>  * fail the make and tell the user to add the news accounts???
> 
> I was thinking more about using "id".  The grep idea (I assume you are
> saying we should search /etc/passwd, right?) may fail when the site is
> using NIS.
> 
> I guess we can put this in the pre-fetch target for all our news ports 
> (so the user can solve the problem first).  Something like:
> 
> #!/bin/sh
> if ! id -u news > /dev/null 2>&1; then
>   echo "You need an account \"news\" to install this package."
>   if [ `id -u` != 0 ]; then
>     echo "Please become root and either use \"adduser\" or try \"make\" again."
>     exit 1
>   fi
>   echo "Let me start an adduser for you...."
>   sleep 5
>   adduser
>   if ! id -u news > /dev/null 2>&1; then
>     echo "Hey!  I told you to add an account \"news\"!"
>     echo "Well, I'm giving up now, but please try again, okay."
>     exit 1
>   fi
> fi
> 
> What do you guys think?

I think the first part is fine about telling the person to add the
user ``news''.  And I can even live with the automatic call to adduser,
since it does not actually go and do it all on it's own.  You should
probably add to the first echo so that it is more like this:
if ! id -u news > /dev/null 2>&1; then
  echo "You need to add the well known account \"news\" to install"
  echo "this package.  It normally has a uid of 8 and a gid of 8."
  echo "To maintain compatibility with future releases of FreeBSD it"
  echo "is highly recommended that you add this line to your passwd file:"
  echo "news:*:8:8::0:0:News Subsystem,,,:/:/nonexistent"
...

> 
> Satoshi
> 


-- 
Rod Grimes                                      rgrimes@gndrsh.aac.dev.com
Accurate Automation Company                   Custom computers for FreeBSD



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199504181740.KAA12813>