1 # $NetBSD: install.mk,v 1.14 2009/04/24 14:02:41 joerg Exp $
3 # _pkgformat-check-conflicts:
4 # Checks for conflicts between the package and installed packages.
8 # _pkgformat-check-installed:
9 # Checks if the package (or an older version of it) is already
10 # installed on the system.
14 # _pkgformat-register:
15 # Populates the package database with the appropriate entries to
16 # register the package as being installed on the system.
18 # _pkgformat-install-clean:
19 # Removes the state files from the run of an ``install'' target.
22 _pkgformat-check-conflicts
: .PHONY error-check
23 ${RUN}${RM} -f
${WRKDIR}/.CONFLICTS
24 .for _conflict_ in
${CONFLICTS}
26 found
="`${_PKG_BEST_EXISTS} ${_conflict_:Q} || ${TRUE}`"; \
29 *) ${ECHO} "$$found" >> ${WRKDIR}/.CONFLICTS
;; \
33 ${TEST} -f
${WRKDIR}/.CONFLICTS || exit
0; \
34 exec
1>${ERROR_DIR}/${.TARGET
}; \
35 ${ECHO} "${PKGNAME} conflicts with installed package(s):"; \
36 ${CAT} ${WRKDIR}/.CONFLICTS |
${SED} -e
"s|^| |"; \
37 ${ECHO} "They install the same files into the same place."; \
38 ${ECHO} "Please remove conflicts first with pkg_delete(1)."; \
39 ${RM} -f
${WRKDIR}/.CONFLICTS
41 _pkgformat-check-installed
: .PHONY error-check
43 found
="`${_PKG_BEST_EXISTS} ${PKGWILDCARD:Q} || ${TRUE}`"; \
44 ${TEST} -n
"$$found" || exit
0; \
45 exec
1>${ERROR_DIR}/${.TARGET
}; \
46 ${ECHO} "$$found is already installed - perhaps an older version?"; \
47 ${ECHO} "If so, you may use either of:"; \
48 ${ECHO} " - \"pkg_delete $$found\" and \"${MAKE} reinstall\""; \
49 ${ECHO} " to upgrade properly"; \
50 ${ECHO} " - \"${MAKE} update\" to rebuild the package and all"; \
51 ${ECHO} " of its dependencies"; \
52 ${ECHO} " - \"${MAKE} replace\" to replace only the package without"; \
53 ${ECHO} " re-linking dependencies, risking various problems."
55 _REGISTER_DEPENDENCIES
= \
56 ${PKGSRC_SETENV} PKG_DBDIR
=${_PKG_DBDIR
:Q
} \
58 ${SH} ${PKGSRCDIR}/mk
/pkgformat
/pkg
/register-dependencies
60 _pkgformat-register
: .PHONY _pkgformat-generate-metadata
${_RDEPENDS_FILE}
61 @
${STEP_MSG} "Registering installation for ${PKGNAME}"
62 ${RUN}${RM} -fr
${_PKG_DBDIR}/${PKGNAME}
63 ${RUN}${MKDIR} ${_PKG_DBDIR}/${PKGNAME}
64 ${RUN}${CP} ${PKG_DB_TMPDIR}/* ${_PKG_DBDIR}/${PKGNAME}
65 ${RUN}${PKG_ADMIN} add
${PKGNAME}
67 case
${_AUTOMATIC
:Q
}"" in \
68 [yY
][eE
][sS
]) ${PKG_ADMIN} set automatic
=yes
${PKGNAME} ;; \
70 ${RUN}${_FULL_DEPENDS_CMD} | \
71 ${SORT} -u |
${_REGISTER_DEPENDENCIES} ${PKGNAME}
72 ${RUN}${GREP} '^@pkgdir ' < ${_PKG_DBDIR}/${PKGNAME}/+CONTENTS | \
73 while read tag
dir; do
${MKDIR} ${PREFIX}/$$dir; done
75 _pkgformat-install-clean
: .PHONY _pkgformat-clean-metadata