From f35282e355dd20863f2ea08f6f89d9fe7241b56a Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Fri, 12 Nov 2004 09:10:01 +0000 Subject: [PATCH] Add a 'preupgrade' target which creates any missing users and groups (relative to FreeBSD-4) that are required before installworld can be run. Adjust the installworld prechecks to bail if required users or groups do not exist, with a message pointing to the new preupgrade target. The 'make upgrade' target will automatically run the preupgrade target. Required users: smmsp, _pflogd, _ntp. Required groups: smmsp, authpf, _pflogd, _ntp Devon noted that the 'pw' program seems to do what we need here. --- Makefile | 9 ++++++++- Makefile.inc1 | 26 +++++++++----------------- etc/Makefile | 25 +++++++++++++++++++++++-- 3 files changed, 40 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index 864b2b5c16..3b65ee003e 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # # $FreeBSD: src/Makefile,v 1.234.2.19 2003/04/16 09:59:40 ru Exp $ -# $DragonFly: src/Makefile,v 1.8 2004/08/18 16:37:15 dillon Exp $ +# $DragonFly: src/Makefile,v 1.9 2004/11/12 09:09:56 dillon Exp $ # # The user-driven targets are: # @@ -23,6 +23,10 @@ # reinstallkernel - Reinstall the kernel and the kernel-modules. # kernel - buildkernel + installkernel. # update - Convenient way to update your source tree (cvs). +# preupgrade - Certain upgrades may have to be done before installworld. +# installworld will complain if they have not been done. This +# target will do those upgrades... typically the addition of +# new special groups and users used by installed utilities. # upgrade - Upgrade the files in /etc and also setup the rest # of the system for DragonFly. ex. two compilers # most - Build user commands, no libraries or include files. @@ -166,6 +170,9 @@ make: # Handle the upgrade of /etc # +preupgrade: + @cd ${.CURDIR}/etc; make preupgrade + upgrade: upgrade_etc # diff --git a/Makefile.inc1 b/Makefile.inc1 index c12b7cca1f..e33417689e 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1,6 +1,6 @@ # # $FreeBSD: src/Makefile.inc1,v 1.141.2.62 2003/04/06 19:54:00 dwmalone Exp $ -# $DragonFly: src/Makefile.inc1,v 1.46 2004/11/10 18:05:36 joerg Exp $ +# $DragonFly: src/Makefile.inc1,v 1.47 2004/11/12 09:09:56 dillon Exp $ # # Make command line options: # -DMAKE_KERBEROS5 to build Kerberos5 @@ -403,23 +403,15 @@ crossworld: _worldtmp _bootstrap-tools _obj _build-tools _cross-tools # installcheck: .if !defined(NO_SENDMAIL) - @if ! `id -u smmsp > /dev/null`; then \ - echo "ERROR: Required smmsp user is missing, see /usr/src/UPDATING."; \ - false; \ - fi - @if ! `id -g smmsp > /dev/null`; then \ - echo "ERROR: Required smmsp group is missing, see /usr/src/UPDATING."; \ - false; \ - fi + @pw usershow smmsp || (echo "You may need to run 'make preupgrade' first"; exit 1) + @pw groupshow smmsp || (echo "You may need to run 'make preupgrade' first"; exit 1) .endif -# -#Check that authpf user and group is installed -# - @if ! `grep -q '^authpf:' /etc/group`; then \ - echo "ERROR: Required authpf group is missing, see /usr/src/UPDATING."; \ - false; \ - fi -# + @pw usershow _pflogd || (echo "You may need to run 'make preupgrade' first"; exit 1) + @pw usershow _ntp || (echo "You may need to run 'make preupgrade' first"; exit 1) + @pw groupshow authpf || (echo "You may need to run 'make preupgrade' first"; exit 1) + @pw groupshow _pflogd || (echo "You may need to run 'make preupgrade' first"; exit 1) + @pw groupshow _ntp || (echo "You may need to run 'make preupgrade' first"; exit 1) + # distributeworld # # Distributes everything compiled by a `buildworld'. diff --git a/etc/Makefile b/etc/Makefile index 0ea7948621..002d6576a4 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -1,6 +1,6 @@ # from: @(#)Makefile 5.11 (Berkeley) 5/21/91 # $FreeBSD: src/etc/Makefile,v 1.219.2.38 2003/03/04 09:49:00 ru Exp $ -# $DragonFly: src/etc/Makefile,v 1.30 2004/10/21 18:49:51 dillon Exp $ +# $DragonFly: src/etc/Makefile,v 1.31 2004/11/12 09:10:01 dillon Exp $ .if !defined(NO_SENDMAIL) SUBDIR= sendmail @@ -67,7 +67,28 @@ FREEBSD=COPYRIGHT distribute: cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/${DISTRIBUTION} -upgrade_etc: +preupgrade: +.if !defined(NO_SENDMAIL) + (pw groupshow smmsp -q > /dev/null) || \ + pw groupadd smmsp -g 25 + (pw usershow smmsp -q > /dev/null) || \ + pw useradd smmsp -u 25 -c "Sendmail Submission User" \ + -d /var/spool/clientmqueue -s /sbin/nologin +.endif + (pw usershow _pflogd -q > /dev/null) || \ + pw useradd _pflogd -u 64 -c "pflogd privsep user" \ + -d /var/empty -s /sbin/nologin + (pw usershow _ntp -q > /dev/null) || \ + pw useradd _ntp -u 65 -c "ntpd privsep user" \ + -d /var/empty -s /sbin/nologin + (pw groupshow authpf -q > /dev/null) || \ + pw groupadd authpf -g 63 + (pw groupshow _pflogd -q > /dev/null) || \ + pw groupadd _pflogd -g 64 + (pw groupshow _ntp -q > /dev/null) || \ + pw groupadd _ntp -g 65 + +upgrade_etc: preupgrade cd ${.CURDIR}/../share/mk; ${MAKE} install cd ${.CURDIR}; \ ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \ -- 2.41.0