Subject: Re: Has anyone tried building -current as non-root from scratch recently?
To: Andrew van der Stock <ajv@greebo.net>
From: Simon Burge <simonb@wasabisystems.com>
List: current-users
Date: 03/25/2001 20:34:16
"Andrew van der Stock" wrote:

> However, for the security freaks amongst us:
> 
> I don't like doing anything as a privileged user unless I must. I don't mind
> installing as a privileged user, but it should be possible (and the default)
> to build as non-root, and then to ask for root when it's time to do the
> install.

I use the trailing patch and have PRIV=priv in my /etc/mk.conf
(subsititue priv for sudo or whatever else you prefer).  I'm not quite
sure what the "Right Way" to do this properly and keep everybody happy
is, so I haven't chased it up any further...

There is also the UNPRIVILEGED make variable, but that's only really
useful for proving the "make build" compiles and not much more (for
now...).

Simon.
--
Simon Burge                            <simonb@wasabisystems.com>
NetBSD CDs, Support and Service:    http://www.wasabisystems.com/


Index: Makefile
===================================================================
RCS file: /cvsroot/basesrc/Makefile,v
retrieving revision 1.121
diff -d -p -u -r1.121 Makefile
--- Makefile	2000/10/07 17:18:17	1.121
+++ Makefile	2001/03/25 10:30:44
@@ -94,12 +94,12 @@ beforeinstall:
 .ifndef NODISTRIBDIRS
 .ifndef DESTDIR
 .if exists(share/mk)
-	(cd ${.CURDIR}/etc && ${MAKE} -m ${.CURDIR}/share/mk DESTDIR=/ distrib-dirs)
+	(cd ${.CURDIR}/etc && ${PRIV} ${MAKE} -m ${.CURDIR}/share/mk DESTDIR=/ distrib-dirs)
 .else
-	(cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs)
+	(cd ${.CURDIR}/etc && ${PRIV} ${MAKE} DESTDIR=/ distrib-dirs)
 .endif
 .else
-	(cd ${.CURDIR}/etc && ${MAKE} distrib-dirs)
+	(cd ${.CURDIR}/etc && ${PRIV} ${MAKE} distrib-dirs)
 .endif
 .endif
 
@@ -109,7 +109,7 @@ afterinstall:
 .endif
 
 whatis.db:
-	(cd ${.CURDIR}/share/man && ${MAKE} ${_M} makedb)
+	(cd ${.CURDIR}/share/man && ${PRIV} ${MAKE} ${_M} makedb)
 
 # wrt info/dir below:  It's safe to move this over top of /usr/share/info/dir,
 # as the build will automatically remove/replace the non-pkg entries there.
@@ -126,7 +126,7 @@ build: buildmsg beforeinstall
 	@false
 .endif
 .if ${MKSHARE} != "no"
-	(cd ${.CURDIR}/share/mk && ${MAKE} install)
+	(cd ${.CURDIR}/share/mk && ${PRIV} ${MAKE} install)
 .endif
 .if !defined(UPDATE) && !defined(NOCLEANDIR)
 	${MAKE} ${_J} ${_M} cleandir
@@ -151,14 +151,14 @@ build: buildmsg beforeinstall
 .endif
 	(cd ${.CURDIR}/lib/csu && \
 	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
-	    ${MAKE} ${_M} MKSHARE=no install)
+	    ${PRIV} ${MAKE} ${_M} MKSHARE=no install)
 	(cd ${.CURDIR}/lib && \
 	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
-	    ${MAKE} ${_M} MKSHARE=no install)
+	    ${PRIV} ${MAKE} ${_M} MKSHARE=no install)
 	(cd ${.CURDIR}/gnu/lib && \
 	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
-	    ${MAKE} ${_M} MKSHARE=no install)
-	${MAKE} ${_M} ${_J} dependall && ${MAKE} ${_M} _BUILD= install
+	    ${PRIV} ${MAKE} ${_M} MKSHARE=no install)
+	${MAKE} ${_M} ${_J} dependall && ${PRIV} ${MAKE} ${_M} _BUILD= install
 .if defined(DOMESTIC) && !defined(EXPORTABLE_SYSTEM)
 	(cd ${.CURDIR}/${DOMESTIC} && ${MAKE} ${_M} ${_J} _SLAVE_BUILD= build)
 .endif