summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_install
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2005-11-06 22:15:44 +0000
committerjlam <jlam@pkgsrc.org>2005-11-06 22:15:44 +0000
commitc0fc02789143689d7aadd9679cdf296cfa3f11ca (patch)
tree868a337a175af90df4a8fdfc6c5353160d3cf10d /pkgtools/pkg_install
parent49e24d63709bc4e7c790568a64a724942411c46d (diff)
downloadpkgsrc-c0fc02789143689d7aadd9679cdf296cfa3f11ca.tar.gz
Remove @exec from PLIST and put the action into an INSTALL script instead.
Also, simplify the package by making use of the PKGMANDIR-handling in pkgsrc to remove the custom MANDIR code from the package Makefile and the PLIST. Technically, this type of a change would require a PKGREVISION bump, but as this is the pkg_* tools package and there were no changes to the binaries, we refrain from doing so.
Diffstat (limited to 'pkgtools/pkg_install')
-rw-r--r--pkgtools/pkg_install/INSTALL19
-rw-r--r--pkgtools/pkg_install/Makefile55
-rw-r--r--pkgtools/pkg_install/PLIST31
3 files changed, 65 insertions, 40 deletions
diff --git a/pkgtools/pkg_install/INSTALL b/pkgtools/pkg_install/INSTALL
new file mode 100644
index 00000000000..5726b2a11fe
--- /dev/null
+++ b/pkgtools/pkg_install/INSTALL
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+# $NetBSD: INSTALL,v 1.1 2005/11/06 22:15:44 jlam Exp $
+
+PKGNAME="$1"
+STAGE="$2"
+
+PKG_DBDIR="@PKG_DBDIR@"
+MKDIR="@MKDIR@"
+
+case ${STAGE} in
+PRE-INSTALL)
+ [ -d ${PKG_DBDIR} ] || ${MKDIR} ${PKG_DBDIR}
+ ;;
+
+POST-INSTALL)
+ [ -f ${PKG_DBDIR}/pkgdb.byfile.db ] || ${PKG_PREFIX}/bin/pkg_admin rebuild
+ ;;
+esac
diff --git a/pkgtools/pkg_install/Makefile b/pkgtools/pkg_install/Makefile
index df60d9022d7..72bce9e6f4a 100644
--- a/pkgtools/pkg_install/Makefile
+++ b/pkgtools/pkg_install/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.116 2005/10/07 18:05:07 reed Exp $
+# $NetBSD: Makefile,v 1.117 2005/11/06 22:15:44 jlam Exp $
# Notes to package maintainers:
#
@@ -33,6 +33,7 @@ NO_PKGTOOLS_REQD_CHECK= # defined
NO_CHECKSUM= yes
NO_MTREE= yes
PKG_PRESERVE= # defined
+INSTALL_FILE= ${PKG_DB_TMPDIR}/+INSTALL
# These are needed to solve a chicken-and-egg problem where pkgsrc uses
# newer features of pkg_install, but older NetBSD installations won't
@@ -40,15 +41,13 @@ PKG_PRESERVE= # defined
# compiler to avoid problems with depending on pkgsrc GCC for building
# pkg_install. We also avoid building digest as that would involve
# using the newer pkg_install tools.
-# We also use the newly built pkg_delete since upgrading from
-# an older pkg_install might required features of the new program.
+#
+# We also use the newly built pkg_delete since upgrading from an older
+# pkg_install might required features of the new program.
#
USE_NATIVE_GCC= yes
USE_DIGEST= no
-PKG_DELETE= ${WRKSRC}/delete/pkg_delete
-
-PLIST_SUBST+= MANDIR=${MANDIR}
-PLIST_SUBST+= PKG_TOOLS_BIN=${PKG_TOOLS_BIN}
+PKG_DELETE= ${WRKSRC}/delete/pkg_delete
CPPFLAGS+= -DDEF_UMASK=${DEF_UMASK}
@@ -59,21 +58,37 @@ PKG_DBDIR?= /var/db/pkg
PKG_INFO= PKG_DBDIR=${PKG_DBDIR} ${PKG_INFO_CMD}
PKG_ADMIN= PKG_DBDIR=${PKG_DBDIR} ${PKG_ADMIN_CMD}
+PLIST_SUBST+= PKG_DBDIR=${PKG_DBDIR}
+
.include "../../mk/bsd.prefs.mk"
+PKG_TOOLS_PREFIX= ${PKG_TOOLS_BIN:C|/[^/]?bin$||}
VERSION!= ${AWK} -F '"' '/PKGTOOLS_VERSION/ {print $$2}' \
${FILESDIR}/lib/version.h
+# XXX This breaks for those who set their own LOCALBASE to "/usr" and also
+# XXX set PKGMANDIR to be other than "share/man".
+# XXX
+.if !empty(PKG_TOOLS_PREFIX:M/usr)
+PKGMANDIR= share/man
+.endif
+
do-extract:
@${CP} -R ${FILESDIR} ${WRKSRC}
-post-install:
- if [ ! -f ${PKG_DBDIR}/pkgdb.byfile.db ]; then \
- if [ ! -d ${PKG_DBDIR} ]; then \
- ${INSTALL_DATA_DIR} ${PKG_DBDIR}; \
- fi; \
- ${PKG_ADMIN} rebuild; \
- fi
+post-build:
+ ${SED} -e "s|@PKG_DBDIR@|${PKG_DBDIR}|g" \
+ -e "s|@MKDIR@|${MKDIR}|g" \
+ ${PKGDIR}/INSTALL > ${INSTALL_FILE}
+ ${CHMOD} +x ${INSTALL_FILE}
+
+pre-install-script:
+ cd ${PKG_DB_TMPDIR} && ${SETENV} ${INSTALL_SCRIPTS_ENV} \
+ ${INSTALL_FILE} ${PKGNAME} PRE-INSTALL
+
+post-install-script:
+ cd ${PKG_DB_TMPDIR} && ${SETENV} ${INSTALL_SCRIPTS_ENV} \
+ ${INSTALL_FILE} ${PKGNAME} POST-INSTALL
# XXX Reverse the order that update does things since
# XXX we need pkg_delete built before we can deinstall.
@@ -81,18 +96,10 @@ post-install:
update:
${MAKE}
${MAKE} deinstall UPDATE_RUNNING=YES
- ${MAKE} install
+ ${MAKE} update
${MAKE} clean
.include "../../pkgtools/libnbcompat/inplace.mk"
.include "../../mk/bsd.pkg.mk"
-PREFIX:= ${PKG_TOOLS_BIN:C|/[^/]?bin$||}
-.if ${PREFIX} == "/usr"
-# XXX This breaks for those who set their own LOCALBASE to /usr
-# XXX and also define PKGMANDIR to different than share/man.
-CONFIGURE_ARGS+= --mandir=${PREFIX}/share/man
-MANDIR= share/
-.else
-MANDIR= # empty
-.endif
+PREFIX:= ${PKG_TOOLS_PREFIX}
diff --git a/pkgtools/pkg_install/PLIST b/pkgtools/pkg_install/PLIST
index 61bd507b4b4..e343230eba3 100644
--- a/pkgtools/pkg_install/PLIST
+++ b/pkgtools/pkg_install/PLIST
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST,v 1.5 2003/10/11 07:29:29 grant Exp $
+@comment $NetBSD: PLIST,v 1.6 2005/11/06 22:15:44 jlam Exp $
sbin/linkfarm
sbin/pkg_add
sbin/pkg_admin
@@ -6,18 +6,17 @@ sbin/pkg_create
sbin/pkg_delete
sbin/pkg_info
sbin/pkg_view
-${MANDIR}man/cat1/linkfarm.0
-${MANDIR}man/cat1/pkg_add.0
-${MANDIR}man/cat1/pkg_admin.0
-${MANDIR}man/cat1/pkg_create.0
-${MANDIR}man/cat1/pkg_delete.0
-${MANDIR}man/cat1/pkg_info.0
-${MANDIR}man/cat1/pkg_view.0
-${MANDIR}man/man1/linkfarm.1
-${MANDIR}man/man1/pkg_add.1
-${MANDIR}man/man1/pkg_admin.1
-${MANDIR}man/man1/pkg_create.1
-${MANDIR}man/man1/pkg_delete.1
-${MANDIR}man/man1/pkg_info.1
-${MANDIR}man/man1/pkg_view.1
-@exec [ -f ${PKG_DBDIR:-/var/db/pkg}/pkgdb.byfile.db ] || ${PKG_TOOLS_BIN}/pkg_admin rebuild
+man/cat1/linkfarm.0
+man/cat1/pkg_add.0
+man/cat1/pkg_admin.0
+man/cat1/pkg_create.0
+man/cat1/pkg_delete.0
+man/cat1/pkg_info.0
+man/cat1/pkg_view.0
+man/man1/linkfarm.1
+man/man1/pkg_add.1
+man/man1/pkg_admin.1
+man/man1/pkg_create.1
+man/man1/pkg_delete.1
+man/man1/pkg_info.1
+man/man1/pkg_view.1