| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: bsd.pkginstall.mk,v 1.42 2008/01/29 19:18:26 rillig Exp $ | | 1 | # $NetBSD: bsd.pkginstall.mk,v 1.43 2008/03/04 05:11:18 jlam Exp $ |
2 | # | | 2 | # |
3 | # This Makefile fragment is included by bsd.pkg.mk and implements the | | 3 | # This Makefile fragment is included by bsd.pkg.mk and implements the |
4 | # common INSTALL/DEINSTALL scripts framework. To use the pkginstall | | 4 | # common INSTALL/DEINSTALL scripts framework. To use the pkginstall |
5 | # framework, simply set the relevant variables to customize the install | | 5 | # framework, simply set the relevant variables to customize the install |
6 | # scripts to the package. | | 6 | # scripts to the package. |
7 | # | | 7 | # |
8 | # User-settable variables: | | 8 | # User-settable variables: |
9 | # | | 9 | # |
10 | # PKGINSTALL_VERBOSE | | 10 | # PKGINSTALL_VERBOSE |
11 | # A list of scriptlets that will be verbose and output a message | | 11 | # A list of scriptlets that will be verbose and output a message |
12 | # noting the actions taken. | | 12 | # noting the actions taken. |
13 | # | | 13 | # |
14 | # * "all" is a special value that implies all of the other items | | 14 | # * "all" is a special value that implies all of the other items |
| @@ -40,26 +40,27 @@ _PKG_VARS.pkginstall+= PKG_GID.${g} | | | @@ -40,26 +40,27 @@ _PKG_VARS.pkginstall+= PKG_GID.${g} |
40 | _PKG_VARS.pkginstall+= \ | | 40 | _PKG_VARS.pkginstall+= \ |
41 | SPECIAL_PERMS \ | | 41 | SPECIAL_PERMS \ |
42 | CONF_FILES REQD_FILES \ | | 42 | CONF_FILES REQD_FILES \ |
43 | CONF_FILES_MODE REQD_FILES_MODE \ | | 43 | CONF_FILES_MODE REQD_FILES_MODE \ |
44 | CONF_FILES_PERMS REQD_FILES_PERMS \ | | 44 | CONF_FILES_PERMS REQD_FILES_PERMS \ |
45 | RCD_SCRIPTS ${RCD_SCRIPTS:@s@RCD_SCRIPT_SRC.${s}@} \ | | 45 | RCD_SCRIPTS ${RCD_SCRIPTS:@s@RCD_SCRIPT_SRC.${s}@} \ |
46 | OWN_DIRS MAKE_DIRS REQD_DIRS \ | | 46 | OWN_DIRS MAKE_DIRS REQD_DIRS \ |
47 | OWN_DIRS_PERMS MAKE_DIRS_PERMS REQD_DIRS_PERMS \ | | 47 | OWN_DIRS_PERMS MAKE_DIRS_PERMS REQD_DIRS_PERMS \ |
48 | PKG_SYSCONFDIR_PERMS \ | | 48 | PKG_SYSCONFDIR_PERMS \ |
49 | PKG_SHELL \ | | 49 | PKG_SHELL \ |
50 | FONTS_DIRS.ttf FONTS_DIRS.type1 FONTS_DIRS.x11 \ | | 50 | FONTS_DIRS.ttf FONTS_DIRS.type1 FONTS_DIRS.x11 \ |
51 | _SYS_VARS.pkginstall= \ | | 51 | _SYS_VARS.pkginstall= \ |
52 | SETUID_ROOT_PERMS \ | | 52 | SETUID_ROOT_PERMS \ |
| | | 53 | SETGID_GAME_PERMS \ |
53 | SHLIB_TYPE \ | | 54 | SHLIB_TYPE \ |
54 | LDCONFIG_ADD_CMD \ | | 55 | LDCONFIG_ADD_CMD \ |
55 | LDCONFIG_REMOVE_CMD | | 56 | LDCONFIG_REMOVE_CMD |
56 | | | 57 | |
57 | # The Solaris /bin/sh does not know the ${foo#bar} shell substitution. | | 58 | # The Solaris /bin/sh does not know the ${foo#bar} shell substitution. |
58 | # This shell function serves a similar purpose, but is specialized on | | 59 | # This shell function serves a similar purpose, but is specialized on |
59 | # stripping ${PREFIX}/ from a pathname. | | 60 | # stripping ${PREFIX}/ from a pathname. |
60 | _FUNC_STRIP_PREFIX= \ | | 61 | _FUNC_STRIP_PREFIX= \ |
61 | strip_prefix() { \ | | 62 | strip_prefix() { \ |
62 | ${AWK} 'END { \ | | 63 | ${AWK} 'END { \ |
63 | plen = length(prefix); \ | | 64 | plen = length(prefix); \ |
64 | if (substr(s, 1, plen) == prefix) { \ | | 65 | if (substr(s, 1, plen) == prefix) { \ |
65 | s = substr(s, 1 + plen, length(s) - plen); \ | | 66 | s = substr(s, 1 + plen, length(s) - plen); \ |
| @@ -352,30 +353,36 @@ su-create-usergroup: ${_INSTALL_USERGROU | | | @@ -352,30 +353,36 @@ su-create-usergroup: ${_INSTALL_USERGROU |
352 | # At post-install time, file (it may be a directory) is changed to be | | 353 | # At post-install time, file (it may be a directory) is changed to be |
353 | # owned by user:group with mode permissions. If a file pathname | | 354 | # owned by user:group with mode permissions. If a file pathname |
354 | # is relative, then it is taken to be relative to ${PREFIX}. | | 355 | # is relative, then it is taken to be relative to ${PREFIX}. |
355 | # | | 356 | # |
356 | # SPECIAL_PERMS should be used primarily to change permissions of files or | | 357 | # SPECIAL_PERMS should be used primarily to change permissions of files or |
357 | # directories listed in the PLIST. This may be used to make certain files | | 358 | # directories listed in the PLIST. This may be used to make certain files |
358 | # set-uid or to change the ownership or a directory. | | 359 | # set-uid or to change the ownership or a directory. |
359 | # | | 360 | # |
360 | # SETUID_ROOT_PERMS is a convenience definition to note an executable is | | 361 | # SETUID_ROOT_PERMS is a convenience definition to note an executable is |
361 | # meant to be setuid-root, and should be used as follows: | | 362 | # meant to be setuid-root, and should be used as follows: |
362 | # | | 363 | # |
363 | # SPECIAL_PERMS+= /path/to/suidroot ${SETUID_ROOT_PERMS} | | 364 | # SPECIAL_PERMS+= /path/to/suidroot ${SETUID_ROOT_PERMS} |
364 | # | | 365 | # |
| | | 366 | # SETGID_GAME_PERMS is a convenience definition to note an executable is |
| | | 367 | # meant to be setgid-game, and should be used as follows: |
| | | 368 | # |
| | | 369 | # SPECIAL_PERMS+= /path/to/sgidgame ${SETGID_GAME_PERMS} |
| | | 370 | # |
365 | # Keywords: setuid setgid st_mode perms | | 371 | # Keywords: setuid setgid st_mode perms |
366 | # | | 372 | # |
367 | SPECIAL_PERMS?= # empty | | 373 | SPECIAL_PERMS?= # empty |
368 | SETUID_ROOT_PERMS?= ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 4511 | | 374 | SETUID_ROOT_PERMS?= ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 4511 |
| | | 375 | SETGID_GAME_PERMS?= ${GAMEOWN} ${GAMEGRP} 2755 |
369 | | | 376 | |
370 | _INSTALL_PERMS_FILE= ${_PKGINSTALL_DIR}/perms | | 377 | _INSTALL_PERMS_FILE= ${_PKGINSTALL_DIR}/perms |
371 | _INSTALL_PERMS_DATAFILE= ${_PKGINSTALL_DIR}/perms-data | | 378 | _INSTALL_PERMS_DATAFILE= ${_PKGINSTALL_DIR}/perms-data |
372 | _INSTALL_UNPACK_TMPL+= ${_INSTALL_PERMS_FILE} | | 379 | _INSTALL_UNPACK_TMPL+= ${_INSTALL_PERMS_FILE} |
373 | _INSTALL_DATA_TMPL+= ${_INSTALL_PERMS_DATAFILE} | | 380 | _INSTALL_DATA_TMPL+= ${_INSTALL_PERMS_DATAFILE} |
374 | | | 381 | |
375 | ${_INSTALL_PERMS_DATAFILE}: | | 382 | ${_INSTALL_PERMS_DATAFILE}: |
376 | ${RUN}${MKDIR} ${.TARGET:H} | | 383 | ${RUN}${MKDIR} ${.TARGET:H} |
377 | ${RUN}${_FUNC_STRIP_PREFIX}; \ | | 384 | ${RUN}${_FUNC_STRIP_PREFIX}; \ |
378 | set -- dummy ${SPECIAL_PERMS}; shift; \ | | 385 | set -- dummy ${SPECIAL_PERMS}; shift; \ |
379 | exec 1>>${.TARGET}; \ | | 386 | exec 1>>${.TARGET}; \ |
380 | while ${TEST} $$# -gt 0; do \ | | 387 | while ${TEST} $$# -gt 0; do \ |
381 | file="$$1"; owner="$$2"; group="$$3"; mode="$$4"; \ | | 388 | file="$$1"; owner="$$2"; group="$$3"; mode="$$4"; \ |