summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2002-10-04 23:46:26 +0000
committerjlam <jlam@pkgsrc.org>2002-10-04 23:46:26 +0000
commit561ca1b8b7fd84b59c991487a184066040d324e8 (patch)
tree05d13a1c2ca6a91794aca716a345bd5dc138b9df /mk
parent67a10bfe8a6e6e8376f01570e105dac2c03c8605 (diff)
downloadpkgsrc-561ca1b8b7fd84b59c991487a184066040d324e8.tar.gz
Add new bsd.pkg.install.mk tunable variable: SPECIAL_PERMS.
SPECIAL_PERMS are lists that look like: file user group mode At post-install time, file (it may be a directory) is changed to be owned by user:group with mode permissions. SPECIAL_PERMS should be used primarily to change permissions of files or directories listed in the PLIST. This may be used to make certain files set-uid or to change the ownership or a directory. Packages that install setuid executables should list them in SPECIAL_PERMS so that the correct user and group will be used for file ownership, even if the uid/gid changes between the package creation and the package installation.
Diffstat (limited to 'mk')
-rw-r--r--mk/bsd.pkg.install.mk15
-rw-r--r--mk/install/install19
2 files changed, 32 insertions, 2 deletions
diff --git a/mk/bsd.pkg.install.mk b/mk/bsd.pkg.install.mk
index a0702cdf94e..ec82216a66a 100644
--- a/mk/bsd.pkg.install.mk
+++ b/mk/bsd.pkg.install.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.install.mk,v 1.30 2002/09/26 21:04:11 jlam Exp $
+# $NetBSD: bsd.pkg.install.mk,v 1.31 2002/10/04 23:46:26 jlam Exp $
#
# This Makefile fragment is included by package Makefiles to use the common
# INSTALL/DEINSTALL scripts. To use this Makefile fragment, simply:
@@ -102,6 +102,18 @@ USE_USERADD= YES
USE_USERGROUP= YES
.endif
+# SPECIAL_PERMS are lists that look like:
+# file user group mode
+# At post-install time, file (it may be a directory) is changed to be
+# owned by user:group with mode permissions.
+#
+# SPECIAL_PERMS should be used primarily to change permissions of files or
+# directories listed in the PLIST. This may be used to make certain files
+# set-uid or to change the ownership or a directory.
+#
+SPECIAL_PERMS?= # empty
+FILES_SUBST+= SPECIAL_PERMS=${SPECIAL_PERMS:Q}
+
# CONF_FILES are pairs of example and true config files, used much like
# MLINKS in the base system. At post-install time, if the true config
# file doesn't exist, then the example one is copied into place. At
@@ -209,6 +221,7 @@ FILES_SUBST+= CP=${CP:Q}
FILES_SUBST+= DIRNAME=${DIRNAME:Q}
FILES_SUBST+= ECHO=${ECHO:Q}
FILES_SUBST+= EGREP=${EGREP:Q}
+FILES_SUBST+= EXPR=${EXPR:Q}
FILES_SUBST+= FALSE=${FALSE:Q}
FILES_SUBST+= GREP=${GREP:Q}
FILES_SUBST+= GROUPADD=${GROUPADD:Q}
diff --git a/mk/install/install b/mk/install/install
index 78323de6f92..70db7f40f48 100644
--- a/mk/install/install
+++ b/mk/install/install
@@ -1,6 +1,6 @@
# start of install
#
-# $NetBSD: install,v 1.14 2002/10/04 23:35:51 jlam Exp $
+# $NetBSD: install,v 1.15 2002/10/04 23:46:27 jlam Exp $
case ${STAGE} in
PRE-INSTALL)
@@ -262,6 +262,23 @@ EOF
fi
fi
done
+ _print_special_header=1
+ eval set -- ${SPECIAL_PERMS}
+ while [ $# -gt 0 ]; do
+ file="$1"; owner="$2"; group="$3"; mode="$4"
+ shift; shift; shift; shift
+
+ if [ ${_print_special_header} -gt 0 ]; then
+ _print_special_header=0
+ msgadd ""
+ msgadd "The following files and directories have special permissions:"
+ msgadd ""
+ fi
+ msgadd "#${file} (o=${owner}, g=${group}, m=${mode})"
+ ${CHOWN} "${owner}" "${file}"
+ ${CHGRP} "${group}" "${file}"
+ ${CHMOD} ${mode} "${file}"
+ done
if ! msgempty; then
${ECHO} "==========================================================================="
msgprint