diff options
author | vangyzen <vangyzen@FreeBSD.org> | 2017-05-31 21:15:05 +0000 |
---|---|---|
committer | vangyzen <vangyzen@FreeBSD.org> | 2017-05-31 21:15:05 +0000 |
commit | b6940fdb9ca213809f16974fbd80d083b52e934b (patch) | |
tree | 391607f27abe6f9246f02e5f25f2e948845af167 | |
parent | 910205fbf14e426c93912c88c3d1d163821b3145 (diff) | |
download | FreeBSD-src-b6940fdb9ca213809f16974fbd80d083b52e934b.zip FreeBSD-src-b6940fdb9ca213809f16974fbd80d083b52e934b.tar.gz |
MFC r319020
Fix INSTALL_AS_USER
Move INSTALL_AS_USER into bsd.init.mk to maximize the chance that
it has final authority over fooOWN and fooGRP.
Reviewed by: sjg
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D10810
-rw-r--r-- | share/mk/bsd.init.mk | 27 | ||||
-rw-r--r-- | share/mk/bsd.own.mk | 25 |
2 files changed, 27 insertions, 25 deletions
diff --git a/share/mk/bsd.init.mk b/share/mk/bsd.init.mk index 5947322..2877999 100644 --- a/share/mk/bsd.init.mk +++ b/share/mk/bsd.init.mk @@ -16,6 +16,33 @@ __<bsd.init.mk>__: .include <bsd.own.mk> .MAIN: all +# Handle INSTALL_AS_USER here to maximize the chance that +# it has final authority over fooOWN and fooGRP. +.if ${MK_INSTALL_AS_USER} != "no" +.if !defined(_uid) +_uid!= id -u +.export _uid +.endif +.if ${_uid} != 0 +.if !defined(USER) +# Avoid exporting USER +.if !defined(_USER) +_USER!= id -un +.export _USER +.endif +USER= ${_USER} +.endif +.if !defined(_gid) +_gid!= id -g +.export _gid +.endif +.for x in BIN CONF DOC DTB INFO KMOD LIB MAN NLS SHARE +$xOWN= ${USER} +$xGRP= ${_gid} +.endfor +.endif +.endif + # Some targets need to know when something may build. This is used to # optimize targets that are only needed when building something, such as # (not) reading in depend files. For DIRDEPS_BUILD, it will only calculate diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk index 778a88c..ce41919 100644 --- a/share/mk/bsd.own.mk +++ b/share/mk/bsd.own.mk @@ -135,31 +135,6 @@ CTFCONVERT_CMD= CTFCONVERT_CMD= @: .endif -.if ${MK_INSTALL_AS_USER} != "no" -.if !defined(_uid) -_uid!= id -u -.export _uid -.endif -.if ${_uid} != 0 -.if !defined(USER) -# Avoid exporting USER -.if !defined(_USER) -_USER!= id -un -.export _USER -.endif -USER= ${_USER} -.endif -.if !defined(_gid) -_gid!= id -g -.export _gid -.endif -.for x in BIN CONF DOC DTB INFO KMOD LIB MAN NLS SHARE -$xOWN= ${USER} -$xGRP= ${_gid} -.endfor -.endif -.endif - .endif # !_WITHOUT_SRCCONF # Binaries |