pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk Include some more magic to set ownership of package...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/5428fc1da4d3
branches:  trunk
changeset: 520114:5428fc1da4d3
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Sun Oct 15 16:20:34 2006 +0000

description:
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:

 mk/bsd.pkg.mk      |   4 +++-
 mk/plist/plist.mk  |  13 +++++++++++--
 mk/unprivileged.mk |   4 +++-
 3 files changed, 17 insertions(+), 4 deletions(-)

diffs (77 lines):

diff -r b278838caa1b -r 5428fc1da4d3 mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Sun Oct 15 16:08:08 2006 +0000
+++ b/mk/bsd.pkg.mk     Sun Oct 15 16:20:34 2006 +0000
@@ -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 @@
 
 # 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 -r b278838caa1b -r 5428fc1da4d3 mk/plist/plist.mk
--- a/mk/plist/plist.mk Sun Oct 15 16:08:08 2006 +0000
+++ b/mk/plist/plist.mk Sun Oct 15 16:20:34 2006 +0000
@@ -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 @@
 .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 @@
                [ "$$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 @@
                ${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 -r b278838caa1b -r 5428fc1da4d3 mk/unprivileged.mk
--- a/mk/unprivileged.mk        Sun Oct 15 16:08:08 2006 +0000
+++ b/mk/unprivileged.mk        Sun Oct 15 16:20:34 2006 +0000
@@ -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 @@
 
 .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.



Home | Main Index | Thread Index | Old Index