From 4a63ae115090c0b413d0532a291eac14bc6effe5 Mon Sep 17 00:00:00 2001 From: Brooks Davis Date: Tue, 22 Jan 2013 21:10:03 +0000 Subject: Introduce a new option -DNO_ROOT that allows install and distribution targets to be run without root privilege. Information about ownership, group, flags, and suid bits are stored in the file specified by METALOG which defaults to ${DESTDIR}/METALOG. This file can be used in conjunction with bsdtar or makefs to generate archives or file system images with correct permissions. The packageworld target has been altered to use this metadata allowing non-root releases (subject to further changes in release/Makefile.) Sponsored by: DARPA, AFRL Reviewed by: ian, ray --- etc/Makefile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'etc/Makefile') diff --git a/etc/Makefile b/etc/Makefile index 33b305a36512..164cbd4ba851 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -156,6 +156,9 @@ ETCMAIL=Makefile README mailer.conf access.sample virtusertable.sample \ # Special top level files for FreeBSD FREEBSD=COPYRIGHT +# Sanitize DESTDIR +DESTDIR:= ${DESTDIR:C://*:/:g} + afterinstall: .if ${MK_MAN} != "no" ${_+_}cd ${.CURDIR}/../share/man; ${MAKE} makedb @@ -324,6 +327,20 @@ distrib-dirs: -f $$m -p $$d; \ ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \ done; true +.if defined(NO_ROOT) + @set ${MTREES}; \ + while test $$# -ge 2; do \ + m=${.CURDIR}/$$1; \ + shift; \ + d=$$1; \ + test "$$d" == "/" && d=""; \ + d=${DISTBASE}$$d; \ + shift; \ + ${ECHO} "${MTREE_CMD} -C -f $$m | sed s#^\.#.$$d# >>" \ + "${METALOG}" ; \ + ${MTREE_CMD} -C -f $$m | sed s#^\.#.$$d# >> ${METALOG} ; \ + done; true +.endif ${INSTALL_SYMLINK} usr/src/sys ${DESTDIR}/sys cd ${DESTDIR}/usr/share/man; \ for mandir in man*; do \ -- cgit v1.2.3