From owner-svn-src-all@FreeBSD.ORG Tue Jan 15 00:12:35 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0005CF3C; Tue, 15 Jan 2013 00:12:34 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E62B76FF; Tue, 15 Jan 2013 00:12:34 +0000 (UTC) Received: from svn.freebsd.org (svn.FreeBSD.org [8.8.178.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0F0CYrH087248; Tue, 15 Jan 2013 00:12:34 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0F0CYU5087246; Tue, 15 Jan 2013 00:12:34 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201301150012.r0F0CYU5087246@svn.freebsd.org> From: Brooks Davis Date: Tue, 15 Jan 2013 00:12:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r245440 - in head: . etc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jan 2013 00:12:35 -0000 Author: brooks Date: Tue Jan 15 00:12:34 2013 New Revision: 245440 URL: http://svnweb.freebsd.org/changeset/base/245440 Log: Add an option DB_FROM_SRC to use src/etc's user/group databases when installing. This allows things like running installworld for 10-CURRENT on a 9.0-RELEASE system without adding extra users and groups to the passwd and group files. To prevent potentially risky uid/gid mismatches on systems with non-standard local values, require that DESTDIR be set if DB_FROM_SRC is set. Sponsored by: DARPA, AFRL Reviewed by: peter Modified: head/Makefile.inc1 head/etc/Makefile Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Mon Jan 14 22:00:43 2013 (r245439) +++ head/Makefile.inc1 Tue Jan 15 00:12:34 2013 (r245440) @@ -13,6 +13,8 @@ # -DNO_PORTSUPDATE do not update ports in ${MAKE} update # -DNO_DOCUPDATE do not update doc in ${MAKE} update # -DNO_WWWUPDATE do not update www in ${MAKE} update +# -DDB_FROM_SRC use the user/group databases in src/etc instead of +# the system database when installing. # -DNO_CTF do not run the DTrace CTF conversion tools on built objects # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list # LOCAL_LIB_DIRS="list of dirs" to add additional dirs to libraries target @@ -340,12 +342,13 @@ LIB32WMAKEFLAGS+= \ LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \ -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO -DWITHOUT_HTML -LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS +LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS \ + ${IMAKE_INSTALL} .endif -# install stage IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*} -IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 +IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \ + ${IMAKE_INSTALL} ${IMAKE_MTREE} .if empty(.MAKEFLAGS:M-n) IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \ LD_LIBRARY_PATH=${INSTALLTMP} \ @@ -354,6 +357,10 @@ IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh .else IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP} .endif +.if defined(DB_FROM_SRC) +IMAKE_INSTALL= INSTALL="install -N ${.CURDIR}/etc" +IMAKE_MTREE= MTREE_CMD="nmtree -N ${.CURDIR}/etc" +.endif # kernel stage KMAKEENV= ${WMAKEENV} @@ -595,9 +602,11 @@ kernel-toolchain: ${TOOLCHAIN_TGTS:N_inc installcheck: # -# Require DESTDIR to be set if installing for a different architecture. +# Require DESTDIR to be set if installing for a different architecture or +# using the user/group database in the source tree. # -.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} +.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \ + defined(DB_FROM_SRC) .if !make(distributeworld) installcheck: installcheck_DESTDIR installcheck_DESTDIR: @@ -608,6 +617,7 @@ installcheck_DESTDIR: .endif .endif +.if !defined(DB_FROM_SRC) # # Check for missing UIDs/GIDs. # @@ -635,6 +645,7 @@ installcheck_UGID: false; \ fi .endfor +.endif # # Required install tools to be saved in a scratch dir for safety. @@ -692,6 +703,7 @@ distributeworld installworld: installche done); \ cp $$libs $$progs ${INSTALLTMP} cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale + rm -f ${METALOG} .if make(distributeworld) .for dist in ${EXTRA_DISTRIBUTIONS} -mkdir ${DESTDIR}/${DISTDIR}/${dist} @@ -753,7 +765,8 @@ redistribute: .endif distrib-dirs distribution: - cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} ${.TARGET} + cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \ + ${IMAKE_INSTALL} ${.TARGET} # # buildkernel and installkernel @@ -1059,6 +1072,11 @@ _lex= usr.bin/lex _yacc= usr.bin/yacc .endif +.if defined(DB_FROM_SRC) && ${BOOTSTRAPPING} < 1000026 +_nmtree= lib/libnetbsd \ + usr.sbin/nmtree +.endif + .if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041 _awk= usr.bin/awk .endif @@ -1120,7 +1138,8 @@ bootstrap-tools: ${_lex} \ usr.bin/xinstall \ ${_gensnmptree} \ - usr.sbin/config + usr.sbin/config \ + ${_nmtree} ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ cd ${.CURDIR}/${_tool}; \ ${MAKE} DIRPRFX=${_tool}/ obj; \ Modified: head/etc/Makefile ============================================================================== --- head/etc/Makefile Mon Jan 14 22:00:43 2013 (r245439) +++ head/etc/Makefile Tue Jan 15 00:12:34 2013 (r245440) @@ -291,25 +291,27 @@ distribution: ${DESTDIR}/etc/nsswitch.conf .endif +MTREE_CMD?= mtree + distrib-dirs: - mtree -eU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.root.dist -p ${DESTDIR}/ - mtree -eU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.var.dist -p ${DESTDIR}/var - mtree -eU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.usr.dist -p ${DESTDIR}/usr - mtree -eU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.include.dist \ + ${MTREE_CMD} -eU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.root.dist -p ${DESTDIR}/ + ${MTREE_CMD} -eU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.var.dist -p ${DESTDIR}/var + ${MTREE_CMD} -eU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.usr.dist -p ${DESTDIR}/usr + ${MTREE_CMD} -eU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.include.dist \ -p ${DESTDIR}/usr/include .if ${MK_BIND_LIBS} != "no" - mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BIND.include.dist \ + ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BIND.include.dist \ -p ${DESTDIR}/usr/include .endif .if ${MK_BIND_MTREE} != "no" - mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BIND.chroot.dist \ + ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BIND.chroot.dist \ -p ${DESTDIR}/var/named .endif .if ${MK_GROFF} != "no" - mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.groff.dist -p ${DESTDIR}/usr + ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.groff.dist -p ${DESTDIR}/usr .endif .if ${MK_SENDMAIL} != "no" - mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.sendmail.dist -p ${DESTDIR}/ + ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.sendmail.dist -p ${DESTDIR}/ .endif cd ${DESTDIR}/; rm -f ${DESTDIR}/sys; ln -s usr/src/sys sys cd ${DESTDIR}/usr/share/man/en.ISO8859-1; ln -sf ../man* .