summaryrefslogtreecommitdiff
path: root/misc/rpm
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2001-02-26 14:36:11 +0000
committerjlam <jlam@pkgsrc.org>2001-02-26 14:36:11 +0000
commit12a0b47217cb1291e3dbabd2255f1d69e90a6c7f (patch)
tree4a8b284f211d8d0114979234d79799f9d858712d /misc/rpm
parent088d0bc1f09bc63475682cabba919114459c7d7b (diff)
downloadpkgsrc-12a0b47217cb1291e3dbabd2255f1d69e90a6c7f.tar.gz
Automatically initialize RPM database on pkg_install if necessary. Also
correct DEINSTALL message to refer to the correct directory for the RPM database.
Diffstat (limited to 'misc/rpm')
-rw-r--r--misc/rpm/Makefile11
-rw-r--r--misc/rpm/pkg/DEINSTALL26
-rwxr-xr-xmisc/rpm/pkg/INSTALL46
3 files changed, 50 insertions, 33 deletions
diff --git a/misc/rpm/Makefile b/misc/rpm/Makefile
index db5f2682d32..ef168068005 100644
--- a/misc/rpm/Makefile
+++ b/misc/rpm/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.25 2001/02/25 04:18:02 hubertf Exp $
+# $NetBSD: Makefile,v 1.26 2001/02/26 14:36:11 jlam Exp $
#
DISTNAME= rpm-2.5.4
@@ -16,10 +16,17 @@ GNU_CONFIGURE= yes
USE_GMAKE= yes
USE_LIBINTL= yes
+DEINSTALL_FILE= ${WRKDIR}/DEINSTALL
+INSTALL_FILE= ${WRKDIR}/INSTALL
+
pre-install:
${INSTALL_DATA_DIR} ${PREFIX}/include/rpm
+ ${SED} -e "s|@CAT@|${CAT}|g" \
+ ${PKGDIR}/DEINSTALL > ${DEINSTALL_FILE}
+ ${SED} -e "s|@MKDIR@|${MKDIR}|g" \
+ ${PKGDIR}/INSTALL > ${INSTALL_FILE}
post-install:
- ${SH} ${PKGDIR}/INSTALL ${PKGNAME} POST-INSTALL
+ PKG_PREFIX=${PREFIX} ${SH} ${INSTALL_FILE} ${PKGNAME} POST-INSTALL
.include "../../mk/bsd.pkg.mk"
diff --git a/misc/rpm/pkg/DEINSTALL b/misc/rpm/pkg/DEINSTALL
index 299dcc5d2ec..62be3cfe208 100644
--- a/misc/rpm/pkg/DEINSTALL
+++ b/misc/rpm/pkg/DEINSTALL
@@ -1,29 +1,39 @@
#!/bin/sh
#
-# $NetBSD: DEINSTALL,v 1.1 2000/09/10 12:02:48 wiz Exp $
+# $NetBSD: DEINSTALL,v 1.2 2001/02/26 14:36:12 jlam Exp $
#
PKGNAME=$1
+STAGE=$2
-case $2 in
+CAT="@CAT@"
+
+RPMDIR=/var/pkg/lib/rpm
+
+case ${STAGE} in
DEINSTALL)
;;
+
POST-DEINSTALL)
- /bin/cat << EOF
+ ${CAT} << EOF
===========================================================================
-If you won't be using ${PKGNAME} any longer, you may want to remove the
-/var/pkg directory, where the rpm database is stored.
+If you won't be using ${PKGNAME} any longer, you may want to remove:
+
+ ${RPMDIR}
-Caution: you will lose any data ${PKGNAME} has about any installed packages!
+where the RPM database is stored.
+
+Caution: you will lose any data ${PKGNAME} has about any installed
+packages!
===========================================================================
EOF
;;
+
*)
- echo "Unexpected argument: $2"
+ echo "Unexpected argument: ${STAGE}"
exit 1
;;
esac
-
exit 0
diff --git a/misc/rpm/pkg/INSTALL b/misc/rpm/pkg/INSTALL
index 48db72a5a19..1f605596f9d 100755
--- a/misc/rpm/pkg/INSTALL
+++ b/misc/rpm/pkg/INSTALL
@@ -1,32 +1,32 @@
#!/bin/sh
#
-# $NetBSD: INSTALL,v 1.1 2000/09/10 12:02:48 wiz Exp $
+# $NetBSD: INSTALL,v 1.2 2001/02/26 14:36:12 jlam Exp $
#
-case $2 in
- PRE-INSTALL)
- ;;
- POST-INSTALL)
- # create database dir
- mkdir -p /var/pkg/lib/rpm
- echo ==============================================================
- echo
- echo If this is your first use of rpm, please initialize the
- echo database with:
- echo ' rpm --initdb'
- echo
- echo If you are unsure, try
- echo ' rpm -qa'
- echo If this produces an error like
- echo ' failed to open //var/pkg/lib/rpm/packages.rpm'
- echo then you should initialize the database.
- echo
- echo ==============================================================
+PKGNAME=$1
+STAGE=$2
+
+MKDIR="@MKDIR@"
+
+RPM=${PKG_PREFIX}/bin/rpm
+RPMDIR=/var/pkg/lib/rpm
+
+case ${STAGE} in
+PRE-INSTALL)
;;
- *)
- echo "Unexpected argument $2!"
+
+POST-INSTALL)
+ ${MKDIR} ${RPMDIR}
+ if ! ${RPM} -qa 2>/dev/null
+ then
+ echo "${PKGNAME}: initializing the RPM database..."
+ ${RPM} --initdb
+ fi
+ ;;
+
+*)
+ echo "Unexpected argument ${STAGE}"
exit 1
;;
esac
-
exit 0