diff options
author | jmmv <jmmv@pkgsrc.org> | 2005-05-29 17:12:15 +0000 |
---|---|---|
committer | jmmv <jmmv@pkgsrc.org> | 2005-05-29 17:12:15 +0000 |
commit | dfccdb269ff617f5f2b26733263f16cde41f137e (patch) | |
tree | 81a5cf7a6ce31406d1aa4d4967b20409f4b3d58c | |
parent | c81353ac2ab622a0b5d5d624e2ac11570c4847a5 (diff) | |
download | pkgsrc-dfccdb269ff617f5f2b26733263f16cde41f137e.tar.gz |
Simplify unprivileged builds by adding a new variable, UNPRIVILEGED, that,
when set to YES, changes multiple defaults to let this work properly.
-rw-r--r-- | doc/CHANGES | 4 | ||||
-rw-r--r-- | mk/bsd.pkg.mk | 5 | ||||
-rw-r--r-- | mk/unprivileged.mk | 56 |
3 files changed, 63 insertions, 2 deletions
diff --git a/doc/CHANGES b/doc/CHANGES index 4705fa83f43..8642c4d6add 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -1,4 +1,4 @@ -$NetBSD: CHANGES,v 1.10241 2005/05/29 16:11:49 jschauma Exp $ +$NetBSD: CHANGES,v 1.10242 2005/05/29 17:12:15 jmmv Exp $ Changes to the packages collection and infrastructure in 2005: @@ -2650,3 +2650,5 @@ Changes to the packages collection and infrastructure in 2005: Added net/autonet version 0.13 [abs 2005-05-29] Updated lang/python21 to 2.1.3nb7 [minskim 2005-05-29] Updated mail/sylpheed-devel to 1.9.12 [chris 2005-05-29] + mk/bsd.pkg.mk: Added support for unprivileged builds through the + UNPRIVILEGED variable [jmmv 2005-05-29] diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk index d8d22f2bb72..c3107eba1a3 100644 --- a/mk/bsd.pkg.mk +++ b/mk/bsd.pkg.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.pkg.mk,v 1.1678 2005/05/26 11:15:30 rillig Exp $ +# $NetBSD: bsd.pkg.mk,v 1.1679 2005/05/29 17:12:16 jmmv Exp $ # # This file is in the public domain. # @@ -890,6 +890,9 @@ PKGSRC_USE_TOOLS+= gzip # Tools .include "../../mk/tools/bsd.tools.mk" +# Unprivileged builds +.include "../../mk/unprivileged.mk" + # If NO_BUILD is defined, default to not needing a compiler. .if defined(NO_BUILD) USE_LANGUAGES?= # empty diff --git a/mk/unprivileged.mk b/mk/unprivileged.mk new file mode 100644 index 00000000000..7baf511ed7b --- /dev/null +++ b/mk/unprivileged.mk @@ -0,0 +1,56 @@ +# $NetBSD: unprivileged.mk,v 1.1 2005/05/29 17:12:16 jmmv Exp $ +# +# Ease configuration of unprivileged (non-root) builds. +# +# UNPRIVILEGED If set to 'yes', enable unprivileged builds. +# Disabled by default. +# +# UNPRIVILEGED_GROUP Specifies the group name (or gid) that will be used +# to install files. Guessed if empty. +# +# UNPRIVILEGED_USER Specifies the user name (or uid) that will be used +# to install files. Guessed if empty. + +.if defined(UNPRIVILEGED) && !empty(UNPRIVILEGED:M[Yy][Ee][Ss]) + +# Guess which user/group has to be used. +. if !defined(UNPRIVILEGED_USER) || empty(UNPRIVILEGED_USER) +UNPRIVILEGED_USER!= ${ID} -n -u +. endif +. if !defined(UNPRIVILEGED_GROUP) || empty(UNPRIVILEGED_GROUP) +UNPRIVILEGED_GROUP!= ${ID} -n -g +. endif + +# Override super-user account. +ROOT_GROUP= ${UNPRIVILEGED_GROUP} +ROOT_USER= ${UNPRIVILEGED_USER} + +# Override user/group pairs used to install files. +BINGRP= ${UNPRIVILEGED_GROUP} +BINOWN= ${UNPRIVILEGED_USER} +GAMEGRP= ${UNPRIVILEGED_GROUP} +GAMEOWN= ${UNPRIVILEGED_USER} +MANGRP= ${UNPRIVILEGED_GROUP} +MANOWN= ${UNPRIVILEGED_USER} +SHAREGRP= ${UNPRIVILEGED_GROUP} +SHAREOWN= ${UNPRIVILEGED_USER} + +# Override installation modes. As a regular user, we may have problems +# when overwriting files if they are not writable. +BINMODE= 755 +NONBINMODE= 644 + +# mtree is useless as a regular user because it won't set directory +# ownerships correctly. +NO_MTREE= # defined + +# As a regular user, creation of other users and groups won't work, so +# disable this step by default. +PKG_CREATE_USERGROUP?= NO + +# Override commands that won't work as a regular user. +CHGRP= ${TRUE} +CHOWN= ${TRUE} +SU_CMD= ${SH} -c + +.endif |