summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorsjg <sjg@FreeBSD.org>2013-10-16 16:03:01 +0000
committersjg <sjg@FreeBSD.org>2013-10-16 16:03:01 +0000
commitb8d13cc6d3a313e63f1bdc5c2b211a2219853868 (patch)
tree39d60032c87d1e1e060b8fee5047346fa35c91a2 /etc
parent248b44aff9d9e7e60ed4dfbd636568c974d84d9b (diff)
downloadFreeBSD-src-b8d13cc6d3a313e63f1bdc5c2b211a2219853868.zip
FreeBSD-src-b8d13cc6d3a313e63f1bdc5c2b211a2219853868.tar.gz
We use distrib-dirs to populate stage tree.
But that depends on up-to-date passwd and group files in /etc. If MK_INSTALL_AS_USER==yes and we are not root, filter the mtree input to avoid problems with [gu]name and [gu]id settings.
Diffstat (limited to 'etc')
-rw-r--r--etc/Makefile15
1 files changed, 13 insertions, 2 deletions
diff --git a/etc/Makefile b/etc/Makefile
index ff8efc5..0740338 100644
--- a/etc/Makefile
+++ b/etc/Makefile
@@ -307,6 +307,15 @@ distribution:
MTREE_CMD?= mtree
+.if ${MK_INSTALL_AS_USER} != "no" && ${_uid} != 0
+MTREE_FILTER= sed -e 's,(uname=)[^ ]* ,\1${BINOWN},' \
+ -e 's,(gname=)[^ ]* ,\1${BINGRP},' \
+ -e 's,(uid=)[^ ]* ,\1${_uid},' \
+ -e 's,(gid=)[^ ]* ,\1${_gid},'
+.else
+MTREE_FILTER= cat
+.endif
+
MTREES= mtree/BSD.root.dist / \
mtree/BSD.var.dist /var \
mtree/BSD.usr.dist /usr \
@@ -333,7 +342,8 @@ distrib-dirs: ${MTREES:N/*}
shift; \
${ECHO} ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} \
-f $$m -p $$d; \
- ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
+ ${MTREE_FILTER} $$m | \
+ ${MTREE_CMD} -deU ${MTREE_FOLLOWS_SYMLINKS} -p $$d; \
done; true
.if defined(NO_ROOT)
@set ${MTREES}; \
@@ -346,7 +356,8 @@ distrib-dirs: ${MTREES:N/*}
shift; \
${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K uname,gname | " \
"sed s#^\.#.$$d# | ${METALOG.add}" ; \
- ${MTREE_CMD:N-W} -C -f $$m -K uname,gname | sed s#^\.#.$$d# | \
+ ${MTREE_FILTER} $$m | \
+ ${MTREE_CMD:N-W} -C -K uname,gname | sed s#^\.#.$$d# | \
${METALOG.add} ; \
done; true
.endif
OpenPOWER on IntegriCloud