Call deinstall-script after files are removed:

deinstall <pkg-name> POST-DEINSTALL

(PKGTOOLS_REQD not bumped, as nothing in pkgsrc uses this so far)
This commit is contained in:
hubertf 1999-08-21 02:21:13 +00:00
parent 23e83a7ac7
commit 3fb135484d
2 changed files with 26 additions and 5 deletions

View File

@ -1,11 +1,11 @@
/* $NetBSD: perform.c,v 1.24 1999/08/19 19:37:21 hubertf Exp $ */
/* $NetBSD: perform.c,v 1.25 1999/08/21 02:21:13 hubertf Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.15 1997/10/13 15:03:52 jkh Exp";
#else
__RCSID("$NetBSD: perform.c,v 1.24 1999/08/19 19:37:21 hubertf Exp $");
__RCSID("$NetBSD: perform.c,v 1.25 1999/08/21 02:21:13 hubertf Exp $");
#endif
#endif
@ -597,6 +597,18 @@ pkg_do(char *pkg)
require_delete(home, 1);
}
if (!NoDeInstall && fexists(DEINSTALL_FNAME)) {
if (Fake)
printf("Would execute post-de-install script at this point.\n");
else {
vsystem("chmod +x %s", DEINSTALL_FNAME); /* make sure */
if (vsystem("./%s %s POST-DEINSTALL", DEINSTALL_FNAME, pkg)) {
warnx("post-deinstall script returned error status");
if (!Force)
return 1;
}
}
}
return 0;
}

View File

@ -1,4 +1,4 @@
.\" $NetBSD: pkg_delete.1,v 1.13 1999/08/19 19:37:21 hubertf Exp $
.\" $NetBSD: pkg_delete.1,v 1.14 1999/08/21 02:21:13 hubertf Exp $
.\"
.\" FreeBSD install - a package for the installation and maintainance
.\" of non-core utilities.
@ -171,7 +171,8 @@ option is specified.
.Pp
If a
.Cm deinstall
script exists for the package, it is executed before any files are removed.
script exists for the package, it is executed before and after
any files are removed.
It is this script's responsibility to clean up any additional messy details
around the package's installation, since all
.Nm
@ -184,8 +185,16 @@ script is called as:
.Ar <pkg-name>
.Ar DEINSTALL
.Ed
Passing the keyword
before deleting all files and as:
.Bd -filled -offset indent -compact
.Cm deinstall
.Ar <pkg-name>
.Ar POST-DEINSTALL
.Ed
after deleting them. Passing the keywords
.Ar DEINSTALL
and
.Ar POST-DEINSTALL
lets you potentially write only one program/script that handles all
aspects of installation and deletion.
.Pp