| @@ -1,27 +1,27 @@ | | | @@ -1,27 +1,27 @@ |
1 | /* $NetBSD: perform.c,v 1.23.2.8 2008/08/05 20:41:04 joerg Exp $ */ | | 1 | /* $NetBSD: perform.c,v 1.23.2.9 2008/08/05 22:25:54 joerg Exp $ */ |
2 | | | 2 | |
3 | #if HAVE_CONFIG_H | | 3 | #if HAVE_CONFIG_H |
4 | #include "config.h" | | 4 | #include "config.h" |
5 | #endif | | 5 | #endif |
6 | #include <nbcompat.h> | | 6 | #include <nbcompat.h> |
7 | #if HAVE_SYS_CDEFS_H | | 7 | #if HAVE_SYS_CDEFS_H |
8 | #include <sys/cdefs.h> | | 8 | #include <sys/cdefs.h> |
9 | #endif | | 9 | #endif |
10 | #ifndef lint | | 10 | #ifndef lint |
11 | #if 0 | | 11 | #if 0 |
12 | static const char *rcsid = "from FreeBSD Id: perform.c,v 1.15 1997/10/13 15:03:52 jkh Exp"; | | 12 | static const char *rcsid = "from FreeBSD Id: perform.c,v 1.15 1997/10/13 15:03:52 jkh Exp"; |
13 | #else | | 13 | #else |
14 | __RCSID("$NetBSD: perform.c,v 1.23.2.8 2008/08/05 20:41:04 joerg Exp $"); | | 14 | __RCSID("$NetBSD: perform.c,v 1.23.2.9 2008/08/05 22:25:54 joerg Exp $"); |
15 | #endif | | 15 | #endif |
16 | #endif | | 16 | #endif |
17 | | | 17 | |
18 | /* | | 18 | /* |
19 | * FreeBSD install - a package for the installation and maintainance | | 19 | * FreeBSD install - a package for the installation and maintainance |
20 | * of non-core utilities. | | 20 | * of non-core utilities. |
21 | * | | 21 | * |
22 | * Redistribution and use in source and binary forms, with or without | | 22 | * Redistribution and use in source and binary forms, with or without |
23 | * modification, are permitted provided that the following conditions | | 23 | * modification, are permitted provided that the following conditions |
24 | * are met: | | 24 | * are met: |
25 | * 1. Redistributions of source code must retain the above copyright | | 25 | * 1. Redistributions of source code must retain the above copyright |
26 | * notice, this list of conditions and the following disclaimer. | | 26 | * notice, this list of conditions and the following disclaimer. |
27 | * 2. Redistributions in binary form must reproduce the above copyright | | 27 | * 2. Redistributions in binary form must reproduce the above copyright |
| @@ -730,27 +730,28 @@ pkg_do(char *pkg) | | | @@ -730,27 +730,28 @@ pkg_do(char *pkg) |
730 | target = "VIEW-DEINSTALL"; | | 730 | target = "VIEW-DEINSTALL"; |
731 | text = "view deinstall"; | | 731 | text = "view deinstall"; |
732 | } else { | | 732 | } else { |
733 | target = "DEINSTALL"; | | 733 | target = "DEINSTALL"; |
734 | text = "deinstall"; | | 734 | text = "deinstall"; |
735 | } | | 735 | } |
736 | free(fname2); | | 736 | free(fname2); |
737 | | | 737 | |
738 | if (Fake) { | | 738 | if (Fake) { |
739 | printf("Would execute %s script at this point " | | 739 | printf("Would execute %s script at this point " |
740 | "(arg: %s).\n", text, target); | | 740 | "(arg: %s).\n", text, target); |
741 | } else { | | 741 | } else { |
742 | pkgdir = xasprintf("%s/%s", _pkgdb_getPKGDB_DIR(), pkg); | | 742 | pkgdir = xasprintf("%s/%s", _pkgdb_getPKGDB_DIR(), pkg); |
743 | (void) fexec(CHMOD_CMD, "+x", fname, NULL); /* make sure */ | | 743 | if (chmod(fname, 0555)) |
| | | 744 | warn("chmod of %s failed", fname); |
744 | if (fcexec(pkgdir, fname, pkg, target, NULL)) { | | 745 | if (fcexec(pkgdir, fname, pkg, target, NULL)) { |
745 | warnx("%s script returned error status", text); | | 746 | warnx("%s script returned error status", text); |
746 | if (!Force) { | | 747 | if (!Force) { |
747 | free(pkgdir); | | 748 | free(pkgdir); |
748 | return 1; | | 749 | return 1; |
749 | } | | 750 | } |
750 | } | | 751 | } |
751 | free(pkgdir); | | 752 | free(pkgdir); |
752 | } | | 753 | } |
753 | } | | 754 | } |
754 | free(fname); | | 755 | free(fname); |
755 | | | 756 | |
756 | if (!Fake) { | | 757 | if (!Fake) { |
| @@ -794,27 +795,28 @@ pkg_do(char *pkg) | | | @@ -794,27 +795,28 @@ pkg_do(char *pkg) |
794 | require_delete(1); | | 795 | require_delete(1); |
795 | } | | 796 | } |
796 | | | 797 | |
797 | fname = pkgdb_pkg_file(pkg, DEINSTALL_FNAME); | | 798 | fname = pkgdb_pkg_file(pkg, DEINSTALL_FNAME); |
798 | if (!NoDeInstall && fexists(fname)) { | | 799 | if (!NoDeInstall && fexists(fname)) { |
799 | char *fname2; | | 800 | char *fname2; |
800 | | | 801 | |
801 | fname2 = pkgdb_pkg_file(pkg, DEPOT_FNAME); | | 802 | fname2 = pkgdb_pkg_file(pkg, DEPOT_FNAME); |
802 | if (!fexists(fname2)) { | | 803 | if (!fexists(fname2)) { |
803 | if (Fake) | | 804 | if (Fake) |
804 | printf("Would execute post-de-install script at this point (arg: POST-DEINSTALL).\n"); | | 805 | printf("Would execute post-de-install script at this point (arg: POST-DEINSTALL).\n"); |
805 | else { | | 806 | else { |
806 | pkgdir = xasprintf("%s/%s", _pkgdb_getPKGDB_DIR(), pkg); | | 807 | pkgdir = xasprintf("%s/%s", _pkgdb_getPKGDB_DIR(), pkg); |
807 | (void) fexec(CHMOD_CMD, "+x", fname, NULL); /* make sure */ | | 808 | if (chmod(fname, 0555)) |
| | | 809 | warn("chmod of %s failed", fname); |
808 | if (fcexec(pkgdir, fname, pkg, "POST-DEINSTALL", NULL)) { | | 810 | if (fcexec(pkgdir, fname, pkg, "POST-DEINSTALL", NULL)) { |
809 | warnx("post-deinstall script returned error status"); | | 811 | warnx("post-deinstall script returned error status"); |
810 | if (!Force) { | | 812 | if (!Force) { |
811 | free(pkgdir); | | 813 | free(pkgdir); |
812 | free(fname); | | 814 | free(fname); |
813 | free(fname2); | | 815 | free(fname2); |
814 | return 1; | | 816 | return 1; |
815 | } | | 817 | } |
816 | } | | 818 | } |
817 | free(pkgdir); | | 819 | free(pkgdir); |
818 | } | | 820 | } |
819 | } | | 821 | } |
820 | free(fname2); | | 822 | free(fname2); |