summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2006-10-15 16:20:34 +0000
committerjoerg <joerg@pkgsrc.org>2006-10-15 16:20:34 +0000
commitaa237578e17c34a2bcb65e55644309eb4a51d6c4 (patch)
tree4caa3a115e9e38a66f1ec72f880d2fbd013d2b06 /mk
parentab966d6cf830d9378e674ec847e45f57f0a49eda (diff)
downloadpkgsrc-aa237578e17c34a2bcb65e55644309eb4a51d6c4.tar.gz
Include some more magic to set ownership of packages build with
use-destdir to ${ROOT_USER}:${ROOT_GROU}. This allows us to safely use it on all packages which don't install setuid/setgid binaries.
Diffstat (limited to 'mk')
-rw-r--r--mk/bsd.pkg.mk4
-rw-r--r--mk/plist/plist.mk13
-rw-r--r--mk/unprivileged.mk4
3 files changed, 17 insertions, 4 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk
index 2581b9833a5..3bf6552450d 100644
--- a/mk/bsd.pkg.mk
+++ b/mk/bsd.pkg.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.1887 2006/10/10 16:57:58 rillig Exp $
+# $NetBSD: bsd.pkg.mk,v 1.1888 2006/10/15 16:20:34 joerg Exp $
#
# This file is in the public domain.
#
@@ -88,6 +88,8 @@ WRKSRC?= ${WRKDIR}/${DISTNAME}
# Override for SU_CMD user check
_SU_ROOT_USER?= ${ROOT_USER}
+_INSTALL_ROOT_USER?= ${ROOT_USER}
+_INSTALL_ROOT_GROUP?= ${ROOT_GROUP}
.if (defined(INSTALL_UNSTRIPPED) && !empty(INSTALL_UNSTRIPPED:M[yY][eE][sS])) || defined(DEBUG_FLAGS)
_INSTALL_UNSTRIPPED= # set (flag used by platform/*.mk)
diff --git a/mk/plist/plist.mk b/mk/plist/plist.mk
index ed9948c4b40..25a05aa00e5 100644
--- a/mk/plist/plist.mk
+++ b/mk/plist/plist.mk
@@ -1,4 +1,4 @@
-# $NetBSD: plist.mk,v 1.16 2006/10/09 12:25:44 joerg Exp $
+# $NetBSD: plist.mk,v 1.17 2006/10/15 16:20:34 joerg Exp $
#
# This Makefile fragment handles the creation of PLISTs for use by
# pkg_create(8).
@@ -193,6 +193,13 @@ _PLIST_IGNORE_FILES+= ${PLIST_IGNORE_FILES}
.endif
_BUILD_DEFS+= _PLIST_IGNORE_FILES
+.if ${_USE_DESTDIR} == "user-destdir"
+_SET_OWNER_GROUP= ${ECHO} "@owner ${_INSTALL_ROOT_USER}"; \
+ ${ECHO} "@group ${_INSTALL_ROOT_GROUP}"
+.else
+_SET_OWNER_GROUP= :
+.endif
+
.if ${PLIST_TYPE} == "dynamic"
_PLIST_IGNORE_CMD= \
( while read i; do \
@@ -205,6 +212,7 @@ _PLIST_IGNORE_CMD= \
[ "$$ignore" = "yes" ] || ${ECHO} "$$i"; \
done )
_GENERATE_PLIST= \
+ ${_SET_OWNER_GROUP}; \
${FIND} ${DESTDIR}${PREFIX} \! -type d -print | ${SORT} | \
${SED} -e "s|^${DESTDIR}${PREFIX}/||" | \
${_PLIST_IGNORE_CMD}; \
@@ -214,7 +222,8 @@ _GENERATE_PLIST= \
${SED} -e "s|^${DESTDIR}${PREFIX}/|@unexec ${RMDIR} -p %D/|" \
-e "s,$$, 2>/dev/null || ${TRUE},";
.else
-_GENERATE_PLIST= ${CAT} ${PLIST_SRC}; \
+_GENERATE_PLIST= ${_SET_OWNER_GROUP}; \
+ ${CAT} ${PLIST_SRC}; \
${GENERATE_PLIST}
.endif
diff --git a/mk/unprivileged.mk b/mk/unprivileged.mk
index b50a9373936..4ad8282a538 100644
--- a/mk/unprivileged.mk
+++ b/mk/unprivileged.mk
@@ -1,4 +1,4 @@
-# $NetBSD: unprivileged.mk,v 1.6 2006/10/09 12:25:44 joerg Exp $
+# $NetBSD: unprivileged.mk,v 1.7 2006/10/15 16:20:34 joerg Exp $
#
# This file collects definitions that are useful when using pkgsrc as an
# unprivileged (non-root) user. It is included automatically by the
@@ -29,6 +29,8 @@ UNPRIVILEGED_GROUP!= ${ID} -n -g
.if ${_USE_DESTDIR} == "user-destdir" && (!defined(UNPRIVILEGED) || empty(UNPRIVILEGED:M[Yy][Ee][Ss]))
_SU_ROOT_USER:= ${ROOT_USER}
+_INSTALL_ROOT_USER:= ${ROOT_USER}
+_INSTALL_ROOT_GROUP:= ${ROOT_GROUP}
.endif
# Override super-user account.