From owner-freebsd-ports Tue Apr 18 10:44:06 1995 Return-Path: ports-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id KAA12598 for ports-outgoing; Tue, 18 Apr 1995 10:44:06 -0700 Received: from gndrsh.aac.dev.com (gndrsh.aac.dev.com [198.145.92.241]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id KAA12588 ; Tue, 18 Apr 1995 10:44:00 -0700 Received: (from rgrimes@localhost) by gndrsh.aac.dev.com (8.6.11/8.6.9) id KAA12813; Tue, 18 Apr 1995 10:40:39 -0700 From: "Rodney W. Grimes" Message-Id: <199504181740.KAA12813@gndrsh.aac.dev.com> Subject: Re: cnews fails if user "news" doesn't exist To: asami@cs.berkeley.edu (Satoshi Asami | =?ISO-2022-JP?B?GyRCQHUbKEI=?= =?ISO-2022-JP?B?GyRCOCsbKEIgGyRCOC0bKEI=?=) Date: Tue, 18 Apr 1995 10:40:39 -0700 (PDT) Cc: adam@FreeBSD.org, pst@FreeBSD.org, ports@FreeBSD.org 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 X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 2013 Sender: ports-owner@FreeBSD.org Precedence: bulk > > * > 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