Fix INSTALL_AS_USER with external nsswitch databases
The INSTALL_AS_USER option tells "install" to use the current user name as the owner of the installed file. The "install" command executed by the build is statically linked, so it does not load nsswitch modules, such as nss_ldap.so, so it fails when the user is only defined in such a database. Fix it to use the current UID instead of user name. This works for all users. I expect it is also slightly more efficient. Reviewed by: sjg MFC after: 3 days Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D10862
This commit is contained in:
parent
cafe808c23
commit
9a2a2c228b
@ -24,20 +24,12 @@ _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}
|
||||
$xOWN= ${_uid}
|
||||
$xGRP= ${_gid}
|
||||
.endfor
|
||||
.endif
|
||||
|
Loading…
Reference in New Issue
Block a user