Don't let pkg_delete remove the recorded location until everything has

absolutely, positively been successfully removed.
Reviewed by:
Submitted by:
Obtained from:
This commit is contained in:
Jordan K. Hubbard 1994-09-29 13:19:43 +00:00
parent c368d11dd2
commit 61f402e0c8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=3198
3 changed files with 15 additions and 9 deletions

View file

@ -1,5 +1,5 @@
#ifndef lint
static const char *rcsid = "$Id: perform.c,v 1.3 1993/10/08 01:19:35 jkh Exp $";
static const char *rcsid = "$Id: perform.c,v 1.4 1994/05/25 18:00:02 asami Exp $";
#endif
/*
@ -100,8 +100,8 @@ pkg_do(char *pkg)
}
if (chdir(home) == FAIL)
barf("Toto! This doesn't look like Kansas anymore!");
delete_package(FALSE, &Plist);
if (!Fake && vsystem("%s -r %s", REMOVE_CMD, LogDir)) {
if (!Fake && delete_package(FALSE, &Plist) != FAIL &&
vsystem("%s -r %s", REMOVE_CMD, LogDir)) {
whinge("Couldn't remove log entry in %s, de-install failed.", LogDir);
return 1;
}

View file

@ -1,4 +1,4 @@
/* $Id: lib.h,v 1.7 1994/05/25 18:00:04 asami Exp $ */
/* $Id: lib.h,v 1.8 1994/08/28 14:15:29 jkh Exp $ */
/*
* FreeBSD install - a package for the installation and maintainance
@ -141,7 +141,7 @@ void add_plist_top(Package *, plist_t, char *);
void write_plist(Package *, FILE *);
void read_plist(Package *, FILE *);
int plist_cmd(char *, char **);
void delete_package(Boolean, Package *);
int delete_package(Boolean, Package *);
/* For all */
void usage(const char *, const char *, ...);

View file

@ -1,5 +1,5 @@
#ifndef lint
static const char *rcsid = "$Id: plist.c,v 1.7 1994/07/11 01:11:14 jkh Exp $";
static const char *rcsid = "$Id: plist.c,v 1.8 1994/08/28 14:15:30 jkh Exp $";
#endif
/*
@ -296,11 +296,12 @@ write_plist(Package *pkg, FILE *fp)
}
/* Delete the results of a package installation, not the packaging itself */
void
int
delete_package(Boolean ign_err, Package *pkg)
{
PackingList p = pkg->head;
char *Where = ".", *last_file = "";
Boolean fail = SUCCESS;
while (p) {
if (p->type == PLIST_CWD) {
@ -314,8 +315,10 @@ delete_package(Boolean ign_err, Package *pkg)
format_cmd(cmd, p->name, Where, last_file);
if (Verbose)
printf("unexec command: %s\n", cmd);
if (!Fake && system(cmd))
if (!Fake && system(cmd)) {
whinge("unexec '%s' failed.", cmd);
fail = FAIL;
}
}
else if (p->type == PLIST_IGNORE)
p = p->next;
@ -326,12 +329,15 @@ delete_package(Boolean ign_err, Package *pkg)
if (Verbose)
printf("Delete: %s\n", full_name);
if (!Fake && delete_hierarchy(full_name, ign_err))
if (!Fake && delete_hierarchy(full_name, ign_err)) {
whinge("Unable to completely remove file '%s'", full_name);
fail = FAIL;
}
last_file = p->name;
}
p = p->next;
}
return fail;
}
/* Selectively delete a hierarchy */