summaryrefslogtreecommitdiff
path: root/misc/rpm
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2002-10-20 23:09:27 +0000
committerjlam <jlam@pkgsrc.org>2002-10-20 23:09:27 +0000
commit8e60140f361eb944fdb537f2218405e9125b01b9 (patch)
treeed8f84769ee9d9b8c15401988db38545fe7980d9 /misc/rpm
parent5ca5c0d2c46d8004348abafef3548047400c0e43 (diff)
downloadpkgsrc-8e60140f361eb944fdb537f2218405e9125b01b9.tar.gz
* Use bsd.pkg.install.mk instead of homegrown INSTALL/DEINSTALL script
creation. * Enhance INSTALL/DEINSTALL scripts so that they may remove the RPM databases on deinstallation if RPM was never used. * Allow new knob RPM_DB_PREFIX that defaults to "/var/pkg" that is the prefix for the path to the RPM databases. The databases are kept in ${RPM_DB_PREFIX}/lib/rpm.
Diffstat (limited to 'misc/rpm')
-rw-r--r--misc/rpm/DEINSTALL29
-rwxr-xr-xmisc/rpm/INSTALL26
-rw-r--r--misc/rpm/Makefile30
3 files changed, 43 insertions, 42 deletions
diff --git a/misc/rpm/DEINSTALL b/misc/rpm/DEINSTALL
index d2dd758940b..7112c5d4ded 100644
--- a/misc/rpm/DEINSTALL
+++ b/misc/rpm/DEINSTALL
@@ -1,21 +1,26 @@
-#!/bin/sh
+# DEINSTALL_TMPL replacement
#
-# $NetBSD: DEINSTALL,v 1.1 2001/11/01 01:29:25 zuntum Exp $
-#
-
-PKGNAME=$1
-STAGE=$2
-
-CAT="@CAT@"
+# $NetBSD: DEINSTALL,v 1.2 2002/10/20 23:09:27 jlam Exp $
-RPMDIR=/var/pkg/lib/rpm
+RPMDIR="@RPMDIR@"
case ${STAGE} in
DEINSTALL)
;;
POST-DEINSTALL)
- ${CAT} << EOF
+ for db in ${RPMDIR}/*.rpm; do
+ if [ ${RPMDIR}/.pre-timestamp -ot $db ] && \
+ [ ${RPMDIR}/.post-timestamp -nt $db ]; then
+ ${RM} -f $db
+ fi
+ done
+ ${RM} -f ${RPMDIR}/.pre-timestamp
+ ${RM} -f ${RPMDIR}/.post-timestamp
+
+ ${RMDIR} -p ${RPMDIR} 2>/dev/null || ${TRUE}
+ if [ -d ${RPMDIR} ]; then
+ ${CAT} << EOF
===========================================================================
If you won't be using ${PKGNAME} any longer, you may want to remove:
@@ -29,11 +34,11 @@ packages!
===========================================================================
EOF
+ fi
;;
*)
- echo "Unexpected argument: ${STAGE}"
+ ${ECHO} "Unexpected argument: ${STAGE}"
exit 1
;;
esac
-exit 0
diff --git a/misc/rpm/INSTALL b/misc/rpm/INSTALL
index f5b1799e914..6e59debf22f 100755
--- a/misc/rpm/INSTALL
+++ b/misc/rpm/INSTALL
@@ -1,15 +1,9 @@
-#!/bin/sh
+# INSTALL_TMPL replacement
#
-# $NetBSD: INSTALL,v 1.1 2001/11/01 01:29:26 zuntum Exp $
-#
-
-PKGNAME=$1
-STAGE=$2
-
-MKDIR="@MKDIR@"
+# $NetBSD: INSTALL,v 1.2 2002/10/20 23:09:27 jlam Exp $
-RPM=${PKG_PREFIX}/bin/rpm
-RPMDIR=/var/pkg/lib/rpm
+RPM="${PKG_PREFIX}/bin/rpm"
+RPMDIR="@RPMDIR@"
case ${STAGE} in
PRE-INSTALL)
@@ -17,16 +11,18 @@ PRE-INSTALL)
POST-INSTALL)
${MKDIR} ${RPMDIR}
- if ! ${RPM} -qa 2>/dev/null
- then
- echo "${PKGNAME}: initializing the RPM database..."
+ ${TOUCH} ${RPMDIR}/.pre-timestamp
+ sleep 1
+ if ! ${RPM} -qa 2>/dev/null; then
+ ${ECHO} "${PKGNAME}: initializing the RPM database..."
${RPM} --initdb
fi
+ sleep 1
+ ${TOUCH} ${RPMDIR}/.post-timestamp
;;
*)
- echo "Unexpected argument ${STAGE}"
+ ${ECHO} "Unexpected argument ${STAGE}"
exit 1
;;
esac
-exit 0
diff --git a/misc/rpm/Makefile b/misc/rpm/Makefile
index 668e45e1aba..5a9005b743e 100644
--- a/misc/rpm/Makefile
+++ b/misc/rpm/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.34 2002/08/25 18:39:29 jlam Exp $
+# $NetBSD: Makefile,v 1.35 2002/10/20 23:09:27 jlam Exp $
#
DISTNAME= rpm-2.5.4
@@ -10,32 +10,32 @@ MAINTAINER= mycroft@netbsd.org
HOMEPAGE= http://www.rpm.org/
COMMENT= The Red Hat Package Manager
-BUILD_USES_MSGFMT= yes
-
CONFLICTS+= rpm2cpio<1.0nb1
-GNU_CONFIGURE= yes
-USE_GMAKE= yes
+BUILD_USES_MSGFMT= yes
+
USE_BUILDLINK2= yes
+USE_GMAKE= yes
+GNU_CONFIGURE= yes
+
+DEINSTALL_TMPL= ${.CURDIR}/DEINSTALL
+INSTALL_TMPL= ${.CURDIR}/INSTALL
-DEINSTALL_FILE= ${WRKDIR}/DEINSTALL
-INSTALL_FILE= ${WRKDIR}/INSTALL
+# The rpm databases are kept under ${RPM_DB_PREFIX}/lib/rpm.
+RPM_DB_PREFIX?= ${LOCALBASE}
+CONFIGURE_ENV+= varprefix="${RPM_DB_PREFIX}"
-FILES_SUBST= CAT=${CAT:Q}
-FILES_SUBST+= MKDIR=${MKDIR:Q}
-FILES_SUBST_SED= ${FILES_SUBST:S/=/@!/:S/$/!g/:S/^/ -e s!@/}
+RPMDIR= ${RPM_DB_PREFIX}/lib/rpm
+FILES_SUBST+= RPMDIR=${RPMDIR}
post-configure:
cd ${WRKSRC}/po && ( ${MV} cz.mo cs.mo; ${MV} cz.po cs.po )
pre-install:
${INSTALL_DATA_DIR} ${PREFIX}/include/rpm
- ${SED} ${FILES_SUBST_SED} ${PKGDIR}/DEINSTALL > ${DEINSTALL_FILE}
- ${SED} ${FILES_SUBST_SED} ${PKGDIR}/INSTALL > ${INSTALL_FILE}
-
-post-install:
- PKG_PREFIX=${PREFIX} ${SH} ${INSTALL_FILE} ${PKGNAME} POST-INSTALL
.include "../../devel/gettext-lib/buildlink2.mk"
.include "../../devel/zlib/buildlink2.mk"
+
+.include "../../mk/bsd.pkg.install.mk"
.include "../../mk/bsd.pkg.mk"