summaryrefslogtreecommitdiff
path: root/mk/bsd.pkg.install.mk
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2005-01-28 07:37:55 +0000
committerjlam <jlam@pkgsrc.org>2005-01-28 07:37:55 +0000
commitf9d620373a45314d4df95f89851b337fd35fda22 (patch)
treeda779c1f42c42d7da1f45cc1ee29911c272686ca /mk/bsd.pkg.install.mk
parent5aa13ad4ee16dd77a666dd4cf0afc2a1144efcbc (diff)
downloadpkgsrc-f9d620373a45314d4df95f89851b337fd35fda22.tar.gz
Continue with install script cleanup -- we now create a +USERGROUP
script that is unpacked by the +INSTALL script at PRE-INSTALL time before any other actions take place, and invoke +USERGROUP to create any necessary users and groups. Remove the now-unused code for PKG_USERS and PKG_GROUPS from the install and deinstall templates. We also reference count the users and groups and store the reference counts in ${PKG_DBDIR}/.refcount/{users,groups}. This allows multiple packages to register that they use same users and groups, and allows +USERGROUP to be invoked at any time to repair an installed package. Also fix the install and deinstall templates to invoke the CHECK-* actions with ${PKG_METADATA_DIR} so that the correct PKGNAME can be derived. This fixes the weird messages asking the user to create directories for ".pkgdb" during a "make install".
Diffstat (limited to 'mk/bsd.pkg.install.mk')
-rw-r--r--mk/bsd.pkg.install.mk41
1 files changed, 37 insertions, 4 deletions
diff --git a/mk/bsd.pkg.install.mk b/mk/bsd.pkg.install.mk
index 67cc65f58b7..90569408004 100644
--- a/mk/bsd.pkg.install.mk
+++ b/mk/bsd.pkg.install.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.install.mk,v 1.73 2005/01/28 06:30:58 jlam Exp $
+# $NetBSD: bsd.pkg.install.mk,v 1.74 2005/01/28 07:37:55 jlam Exp $
#
# This Makefile fragment is included by bsd.pkg.mk to use the common
# INSTALL/DEINSTALL scripts. To use this Makefile fragment, simply:
@@ -104,14 +104,12 @@ FILES_SUBST+= PKG_REFCOUNT_DBDIR=${_PKG_REFCOUNT_DBDIR:Q}
#
# Only the group is required; the groupid is optional.
#
+PKG_GROUPS?= # empty
PKG_USERS?= # empty
_PKG_USER_HOME?= /nonexistent
_PKG_USER_SHELL?= ${NOLOGIN}
-PKG_GROUPS?= # empty
-FILES_SUBST+= PKG_USERS=${PKG_USERS:Q}
FILES_SUBST+= PKG_USER_HOME=${_PKG_USER_HOME}
FILES_SUBST+= PKG_USER_SHELL=${_PKG_USER_SHELL}
-FILES_SUBST+= PKG_GROUPS=${PKG_GROUPS:Q}
# Interix is very Special in that users are groups cannot have the
# same name. Interix.mk tries to work around this by overriding
@@ -131,6 +129,41 @@ BROKEN:= "User and group '${user:C/:.*//}' cannot have the same name on Interix
DEPENDS+= ${_USER_DEPENDS}
.endif
+INSTALL_USERGROUP_FILE= ${WRKDIR}/.install-usergroup
+INSTALL_UNPACK_TMPL+= ${INSTALL_USERGROUP_FILE}
+
+${INSTALL_USERGROUP_FILE}: ../../mk/install/usergroup
+ ${_PKG_SILENT}${_PKG_DEBUG}{ \
+ ${ECHO} "# start of install-usergroup"; \
+ ${ECHO} "#"; \
+ ${ECHO} "# Generate a +USERGROUP script that reference counts users"; \
+ ${ECHO} "# and groups that are required for the proper functioning"; \
+ ${ECHO} "# of the package."; \
+ ${ECHO} "#"; \
+ ${ECHO} "case \$${STAGE} in"; \
+ ${ECHO} "PRE-INSTALL)"; \
+ ${ECHO} " \$${CAT} > ./+USERGROUP << 'EOF_USERGROUP'"; \
+ ${SED} ${FILES_SUBST_SED} ../../mk/install/usergroup; \
+ ${ECHO} ""; \
+ eval set -- ${PKG_GROUPS} ; \
+ while ${TEST} $$# -gt 0; do \
+ i="$$1"; shift; \
+ ${ECHO} "# GROUP: $$i"; \
+ done; \
+ eval set -- ${PKG_USERS} ; \
+ while ${TEST} $$# -gt 0; do \
+ i="$$1"; shift; \
+ ${ECHO} "# USER: $$i"; \
+ done; \
+ ${ECHO} "EOF_USERGROUP"; \
+ ${ECHO} " \$${CHMOD} +x ./+USERGROUP"; \
+ ${ECHO} " ;;"; \
+ ${ECHO} "esac"; \
+ ${ECHO} ""; \
+ ${ECHO} "# end of install-usergroup"; \
+ } > ${.TARGET}.tmp; \
+ ${MV} -f ${.TARGET}.tmp ${.TARGET}
+
# 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