Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/pkg_install/delete Remove the LogDir (/var/db/pkg/f...



details:   https://anonhg.NetBSD.org/src/rev/bea57beee3ab
branches:  trunk
changeset: 476185:bea57beee3ab
user:      hubertf <hubertf%NetBSD.org@localhost>
date:      Thu Sep 09 01:36:30 1999 +0000

description:
Remove the LogDir (/var/db/pkg/foo-x.y) _after_ we've run the DEINSTALL
script a second time (else there's nothing left to run ;).

Noticed by Jim Wise.

diffstat:

 usr.sbin/pkg_install/delete/perform.c |  31 ++++++++++++++++++-------------
 1 files changed, 18 insertions(+), 13 deletions(-)

diffs (79 lines):

diff -r 0817abb9020e -r bea57beee3ab usr.sbin/pkg_install/delete/perform.c
--- a/usr.sbin/pkg_install/delete/perform.c     Thu Sep 09 01:31:44 1999 +0000
+++ b/usr.sbin/pkg_install/delete/perform.c     Thu Sep 09 01:36:30 1999 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: perform.c,v 1.27 1999/08/24 00:48:39 hubertf Exp $     */
+/*     $NetBSD: perform.c,v 1.28 1999/09/09 01:36:30 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.27 1999/08/24 00:48:39 hubertf Exp $");
+__RCSID("$NetBSD: perform.c,v 1.28 1999/09/09 01:36:30 hubertf Exp $");
 #endif
 #endif
 
@@ -562,7 +562,7 @@
        }
        if (!NoDeInstall && fexists(DEINSTALL_FNAME)) {
                if (Fake)
-                       printf("Would execute de-install script at this point.\n");
+                       printf("Would execute de-install script at this point (arg: DEINSTALL).\n");
                else {
                        vsystem("%s +x %s", CHMOD, DEINSTALL_FNAME);    /* make sure */
                        if (vsystem("./%s %s DEINSTALL", DEINSTALL_FNAME, pkg)) {
@@ -572,22 +572,14 @@
                        }
                }
        }
-       if (chdir(home) == FAIL) {
-               cleanup(0);
-               errx(2, "Toto! This doesn't look like Kansas anymore!");
-       }
        if (!Fake) {
                /* Some packages aren't packed right, so we need to just ignore delete_package()'s status.  Ugh! :-( */
                if (delete_package(FALSE, CleanDirs, &Plist) == FAIL)
                        warnx(
                            "couldn't entirely delete package (perhaps the packing list is\n"
                            "incorrectly specified?)");
-               if (vsystem("%s -r %s", REMOVE_CMD, LogDir)) {
-                       warnx("couldn't remove log entry in %s, deinstall failed", LogDir);
-                       if (!Force)
-                               return 1;
-               }
        }
+       /* Remove this package from the +REQUIRED_BY list of the packages this depends on */
        for (p = Plist.head; p; p = p->next) {
                if (p->type != PLIST_PKGDEP)
                        continue;
@@ -609,7 +601,7 @@
        }
        if (!NoDeInstall && fexists(DEINSTALL_FNAME)) {
                if (Fake)
-                       printf("Would execute post-de-install script at this point.\n");
+                       printf("Would execute post-de-install script at this point (arg: POST-DEINSTALL).\n");
                else {
                        vsystem("chmod +x %s", DEINSTALL_FNAME);        /* make sure */
                        if (vsystem("./%s %s POST-DEINSTALL", DEINSTALL_FNAME, pkg)) {
@@ -619,6 +611,19 @@
                        }
                }
        }
+       /* Change out of LogDir before we remove it */
+       if (chdir(home) == FAIL) {
+               cleanup(0);
+               errx(2, "Toto! This doesn't look like Kansas anymore!");
+       }
+       if (!Fake) {
+               /* Finally nuke the +-files and the pkgdb-dir (/var/db/pkg/foo) */
+               if (vsystem("%s -r %s", REMOVE_CMD, LogDir)) {
+                       warnx("couldn't remove log entry in %s, deinstall failed", LogDir);
+                       if (!Force)
+                               return 1;
+               }
+       }
        return 0;
 }
 



Home | Main Index | Thread Index | Old Index