svn commit: r248335 - in stable/9: . etc

Brooks Davis brooks at FreeBSD.org
Fri Mar 15 18:49:40 UTC 2013


Author: brooks
Date: Fri Mar 15 18:49:39 2013
New Revision: 248335
URL: http://svnweb.freebsd.org/changeset/base/248335

Log:
  MFC:
  r241684,245316,245318,245440,245563,245565,245622,245754,246092,246096,246602
  
  r241684:
  Allow LOCAL_DIRS to install files in directories not found in the
  system mtree files via a LOCAL_MTREE variable which contains a list of
  mtree files to be applyed along with the base mtree files to the tmp
  root and DESTDIR.
  
  r245440:
  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
  
  r245565:
  Rework the mtree portion of etc/Makefile's distrib-dirs target to run
  mtree in a shell loop so there is only one mtree commandline.  Move the
  implementation of LOCAL_MTREE into etc/Makefile.
  
  Sponsored by:   DARPA, AFRL

Modified:
  stable/9/Makefile.inc1   (contents, props changed)
  stable/9/etc/Makefile
Directory Properties:
  stable/9/etc/   (props changed)

Modified: stable/9/Makefile.inc1
==============================================================================
--- stable/9/Makefile.inc1	Fri Mar 15 18:10:38 2013	(r248334)
+++ stable/9/Makefile.inc1	Fri Mar 15 18:49:39 2013	(r248335)
@@ -12,8 +12,12 @@
 #	-DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel
 #	-DNO_PORTSUPDATE do not update ports in ${MAKE} update
 #	-DNO_DOCUPDATE do not update doc 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_MTREE="list of mtree files" to process to allow local directories
+#	    to be created before files are installed
 #	TARGET="machine" to crossbuild world for a different machine type
 #	TARGET_ARCH= may be required when a TARGET supports multiple endians
 
@@ -326,12 +330,13 @@ LIB32WMAKE=	${LIB32WMAKEENV} ${MAKE} -DN
 		-DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO \
 		-DWITHOUT_HTML -DNO_CTF -DNO_LINT -ECC -ECXX -EAS -ELD \
 		DESTDIR=${LIB32TMP}
-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} \
@@ -340,6 +345,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}
@@ -395,6 +404,9 @@ _worldtmp:
 	mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \
 	    -p ${WORLDTMP}/usr/include >/dev/null
 .endif
+.for _mtree in ${LOCAL_MTREE}
+	mtree -deU -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null
+.endfor
 _legacy:
 	@echo
 	@echo "--------------------------------------------------------------"
@@ -583,9 +595,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:
@@ -596,6 +610,7 @@ installcheck_DESTDIR:
 .endif
 .endif
 
+.if !defined(DB_FROM_SRC)
 #
 # Check for missing UIDs/GIDs.
 #
@@ -623,6 +638,7 @@ installcheck_UGID:
 		false; \
 	fi
 .endfor
+.endif
 
 #
 # Required install tools to be saved in a scratch dir for safety.
@@ -634,10 +650,14 @@ _install-info=	install-info
 _zoneinfo=	zic tzsetup
 .endif
 
+.if exists(/usr/sbin/nmtree)
+_nmtree_itools=	nmtree
+.endif
+
 ITOOLS=	[ awk cap_mkdb cat chflags chmod chown \
 	date echo egrep find grep ${_install-info} \
-	ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
-	test true uname wc ${_zoneinfo}
+	ln lockf make mkdir mtree ${_nmtree_itools} mv pwd_mkdb \
+	rm sed sh sysctl test true uname wc ${_zoneinfo}
 
 #
 # distributeworld
@@ -692,7 +712,7 @@ distributeworld installworld: installche
 .endfor
 	-mkdir ${DESTDIR}/${DISTDIR}/base
 	${_+_}cd ${.CURDIR}; ${IMAKE} distrib-dirs \
-	    DESTDIR=${DESTDIR}/${DISTDIR}/base
+	    LOCAL_MTREE=${LOCAL_MTREE} DESTDIR=${DESTDIR}/${DISTDIR}/base
 .endif
 	${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
 	    ${IMAKEENV} rm -rf ${INSTALLTMP}
@@ -719,7 +739,8 @@ reinstall:
 	@echo "--------------------------------------------------------------"
 	@echo ">>> Making hierarchy"
 	@echo "--------------------------------------------------------------"
-	${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
+	${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \
+	    LOCAL_MTREE=${LOCAL_MTREE} hierarchy
 	@echo
 	@echo "--------------------------------------------------------------"
 	@echo ">>> Installing everything"
@@ -740,7 +761,8 @@ redistribute:
 .endif
 
 distrib-dirs distribution:
-	cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} ${.TARGET}
+	cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
+	    ${IMAKE_INSTALL} ${IMAKE_MTREE} ${.TARGET}
 
 #
 # buildkernel and installkernel
@@ -892,7 +914,7 @@ reinstallkernel reinstallkernel.debug: i
 	@echo "--------------------------------------------------------------"
 	cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
 	    ${CROSSENV} PATH=${TMPPATH} \
-	    ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
+	    ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
 
 distributekernel distributekernel.debug:
 .if empty(INSTALLKERNEL)
@@ -1057,6 +1079,11 @@ _lex=		usr.bin/lex
 _yacc=		usr.bin/yacc
 .endif
 
+.if ${BOOTSTRAPPING} < 1000026
+_nmtree=	lib/libnetbsd \
+		usr.sbin/nmtree
+.endif
+
 .if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041
 _awk=		usr.bin/awk
 .endif
@@ -1114,7 +1141,8 @@ bootstrap-tools:
     usr.bin/xinstall \
     ${_gensnmptree} \
     usr.sbin/config \
-    ${_crunchgen}
+    ${_crunchgen} \
+    ${_nmtree}
 	${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
 		cd ${.CURDIR}/${_tool}; \
 		${MAKE} DIRPRFX=${_tool}/ obj; \
@@ -1227,7 +1255,7 @@ cross-tools:
 # hierarchy - ensure that all the needed directories are present
 #
 hierarchy:
-	cd ${.CURDIR}/etc;		${MAKE} distrib-dirs
+	cd ${.CURDIR}/etc; ${MAKE} LOCAL_MTREE=${LOCAL_MTREE} distrib-dirs
 
 #
 # libraries - build all libraries, and install them under ${DESTDIR}.

Modified: stable/9/etc/Makefile
==============================================================================
--- stable/9/etc/Makefile	Fri Mar 15 18:10:38 2013	(r248334)
+++ stable/9/etc/Makefile	Fri Mar 15 18:49:39 2013	(r248335)
@@ -288,26 +288,39 @@ distribution:
 		${DESTDIR}/etc/nsswitch.conf
 .endif
 
-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 \
-		-p ${DESTDIR}/usr/include
+MTREE_CMD?=	mtree
+
+MTREES=		mtree/BSD.root.dist		/		\
+		mtree/BSD.var.dist		/var		\
+		mtree/BSD.usr.dist		/usr		\
+		mtree/BSD.include.dist		/usr/include
 .if ${MK_BIND_LIBS} != "no"
-	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BIND.include.dist \
-	    -p ${DESTDIR}/usr/include
+MTREES+=	mtree/BIND.include.dist		/usr/include
 .endif
 .if ${MK_BIND_MTREE} != "no"
-	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BIND.chroot.dist \
-	    -p ${DESTDIR}/var/named
+MTREES+=	mtree/BIND.chroot.dist		/var/named
 .endif
 .if ${MK_GROFF} != "no"
-	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.groff.dist -p ${DESTDIR}/usr
+MTREES+=	mtree/BSD.groff.dist		/usr
 .endif
 .if ${MK_SENDMAIL} != "no"
-	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.sendmail.dist -p ${DESTDIR}/
+MTREES+=	mtree/BSD.sendmail.dist		/
 .endif
+.for mtree in ${LOCAL_MTREE}
+MTREES+=	../${mtree}			/
+.endfor
+
+distrib-dirs:
+	@set ${MTREES}; \
+	while test $$# -ge 2; do \
+		m=${.CURDIR}/$$1; \
+		shift; \
+		d=${DESTDIR}$$1; \
+		shift; \
+		${ECHO} ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} \
+		    -f $$m -p $$d; \
+		${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
+	done; true
 	cd ${DESTDIR}/; rm -f ${DESTDIR}/sys; ln -s usr/src/sys sys
 	cd ${DESTDIR}/usr/share/man/en.ISO8859-1; ln -sf ../man* .
 	cd ${DESTDIR}/usr/share/man/en.UTF-8; ln -sf ../man* .


More information about the svn-src-stable-9 mailing list