summaryrefslogtreecommitdiff
path: root/mk/unprivileged.mk
diff options
context:
space:
mode:
authorjoerg <joerg>2006-10-09 12:25:44 +0000
committerjoerg <joerg>2006-10-09 12:25:44 +0000
commit70ea314088a4fe4c4bbcc3ccab10c4a1e47a18a5 (patch)
tree9814d8b785561d4625d3535aa344ea9c5b84ef85 /mk/unprivileged.mk
parent425c7ce9c7743b6870d601017456d062add968cb (diff)
downloadpkgsrc-70ea314088a4fe4c4bbcc3ccab10c4a1e47a18a5.tar.gz
Main infrastructure for DESTDIR support.
Packages may set PKG_DESTDIR_SUPPORT to either "destdir" or "user-destdir" to flag support for this, following the same rules as PKG_INSTALLATION_TYPES (e.g. define before first include of bsd.prefs.mk). The user activates it via USE_DESTDIR. When set to "yes", packages with "user-destdir" are handled as "destdir". The installation of the package will not go to ${LOCALBASE}, but a subdirectory of ${WRKDIR} instead. pre/post install scripts are not run and the package is not registered either. A binary package can be created instead to be installed normally with pkg_add. For "user-destdir" packages, everything is run as normal user and ownership is supposed to be correctled by pkg_create later. Since the current pkg_install code uses pax and it doesn't allow overwriting owners, this does not work yet. For "destdir" packages, installation, packaging and cleaning is run as root. This commit does not change the handling of DEPENDS_TARGET or bin-install to allow recursive usage.
Diffstat (limited to 'mk/unprivileged.mk')
-rw-r--r--mk/unprivileged.mk10
1 files changed, 8 insertions, 2 deletions
diff --git a/mk/unprivileged.mk b/mk/unprivileged.mk
index f04f25f8f9d..b50a9373936 100644
--- a/mk/unprivileged.mk
+++ b/mk/unprivileged.mk
@@ -1,4 +1,4 @@
-# $NetBSD: unprivileged.mk,v 1.5 2006/08/31 16:21:20 rillig Exp $
+# $NetBSD: unprivileged.mk,v 1.6 2006/10/09 12:25:44 joerg Exp $
#
# This file collects definitions that are useful when using pkgsrc as an
# unprivileged (non-root) user. It is included automatically by the
@@ -17,7 +17,7 @@
# Specifies the user name (or uid) that will be used to install
# files.
-.if defined(UNPRIVILEGED) && !empty(UNPRIVILEGED:M[Yy][Ee][Ss])
+.if (defined(UNPRIVILEGED) && !empty(UNPRIVILEGED:M[Yy][Ee][Ss])) || ${_USE_DESTDIR} == "user-destdir"
# Guess which user/group has to be used.
. if !defined(UNPRIVILEGED_USER) || empty(UNPRIVILEGED_USER)
@@ -27,6 +27,10 @@ UNPRIVILEGED_USER!= ${ID} -n -u
UNPRIVILEGED_GROUP!= ${ID} -n -g
. endif
+.if ${_USE_DESTDIR} == "user-destdir" && (!defined(UNPRIVILEGED) || empty(UNPRIVILEGED:M[Yy][Ee][Ss]))
+_SU_ROOT_USER:= ${ROOT_USER}
+.endif
+
# Override super-user account.
ROOT_GROUP= ${UNPRIVILEGED_GROUP}
ROOT_USER= ${UNPRIVILEGED_USER}
@@ -49,7 +53,9 @@ NONBINMODE= 644
# mtree is useless as a regular user because it won't set directory
# ownerships correctly.
NO_MTREE= yes
+.endif
+.if (defined(UNPRIVILEGED) && !empty(UNPRIVILEGED:M[Yy][Ee][Ss]))
# As a regular user, creation of other users and groups won't work, so
# disable this step by default.
PKG_CREATE_USERGROUP= NO