summaryrefslogtreecommitdiff
path: root/misc/rpm/DEINSTALL
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/DEINSTALL
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/DEINSTALL')
-rw-r--r--misc/rpm/DEINSTALL29
1 files changed, 17 insertions, 12 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