From 561ca1b8b7fd84b59c991487a184066040d324e8 Mon Sep 17 00:00:00 2001 From: jlam Date: Fri, 4 Oct 2002 23:46:26 +0000 Subject: 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. --- mk/install/install | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'mk/install') 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 -- cgit v1.2.3