From owner-freebsd-current Wed Dec 2 04:21:48 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id EAA14226 for freebsd-current-outgoing; Wed, 2 Dec 1998 04:21:48 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from zippy.cdrom.com (zippy.cdrom.com [204.216.27.228]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id EAA14218 for ; Wed, 2 Dec 1998 04:21:44 -0800 (PST) (envelope-from jkh@zippy.cdrom.com) Received: from zippy.cdrom.com (jkh@localhost.cdrom.com [127.0.0.1]) by zippy.cdrom.com (8.9.1/8.9.1) with ESMTP id EAA07407; Wed, 2 Dec 1998 04:23:13 -0800 (PST) To: John Birrell cc: dillon@apollo.backplane.com, current@FreeBSD.ORG Subject: Re: Uh oh... In-reply-to: Your message of "Wed, 02 Dec 1998 22:58:38 +1100." <199812021158.WAA08572@cimlogic.com.au> Date: Wed, 02 Dec 1998 04:23:12 -0800 Message-ID: <7403.912601392@zippy.cdrom.com> From: "Jordan K. Hubbard" Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > ... and group. We should test for each user and group defined in the > src/etc files and add them if they don't exist in the installed system. > This would make bootstrapping FreeBSD sources on a NetBSD system easier > too. [Uh oh, I guess they're going to yell at me again. They seem to react > badly when I say these things. 8-)] Hmmm. Just off the top of my head (and my shell wizardry skills are a bit rusty so please excuse the roughness of this), are you suggesting something like this: Index: Makefile.inc1 =================================================================== RCS file: /home/ncvs/src/Makefile.inc1,v retrieving revision 1.46 diff -u -u -r1.46 Makefile.inc1 --- Makefile.inc1 1998/11/28 13:14:58 1.46 +++ Makefile.inc1 1998/12/02 12:17:34 @@ -260,6 +260,12 @@ .endif @echo @echo "--------------------------------------------------------------" + @echo ">>> Making required new users and groups" + @echo "--------------------------------------------------------------" + @awk -F: '{printf("if ! grep -q ^%s: /etc/master.passwd; then pw useradd %s -u %d -g %d; fi\n", $1, $1, $3, $4); }' ${.CURDIR}/etc/master.passwd | sh + @awk -F: '{printf("if ! grep -q ^%s: /etc/group; then pw groupadd %s -g %d; fi\n", $1, $1, $4); }' ${.CURDIR}/etc/group | sh + @echo + @echo "--------------------------------------------------------------" @echo ">>> Making hierarchy" @echo "--------------------------------------------------------------" mkdir -p ${WORLDTMP} ? If so, I'd be interested in seeing a more polished version of the above committed by somebody in this discussion (it can be me, if necessary, I'm just giving others ample opportunity for it to be them instead :-). The "fix" above has some immediate problems with it, most notably the hardcoded references to awk and sh as well as the missing ${DESTDIR} in front of /etc/master.passwd and /etc/group. That's a casualty of the single quotes around awk's command line arg which would prevent a ${DESTDIR} in the obvious places from expanding, and I am too tired at the moment to even contemplate the more advanced shell wizardry required to cons up more suitable arguments to awk. .. and I'm sure the perl weenies could easily figure out some way to do it in even less characters. :-) - Jordan To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message