]> Zhao Yanbai Git Server - minix.git/commitdiff
pkg_install: DESTDIR support.
authorBen Gras <ben@minix3.org>
Thu, 5 Aug 2010 14:51:46 +0000 (14:51 +0000)
committerBen Gras <ben@minix3.org>
Thu, 5 Aug 2010 14:51:46 +0000 (14:51 +0000)
commands/pkg_install/add/perform.c
commands/pkg_install/lib/plist.c

index c43f4365731dd4b4dc731ab5d3adcf58af2d24a5..c56fdfba40e1081277181d4271f697274be91aa3 100644 (file)
@@ -715,7 +715,7 @@ extract_files(struct pkg_task *pkg)
                        continue;
 
                case PLIST_CMD:
-                       if (format_cmd(cmd, sizeof(cmd), p->name, pkg->prefix, last_file))
+                       if (format_cmd(cmd, sizeof(cmd), p->name, pkg->install_prefix, last_file))
                                return -1;
                        printf("Executing '%s'\n", cmd);
                        if (!Fake && system(cmd))
index 9b41933b45ab58c2095137907294a0576b482ca6..6719a5b3878e8e245f8a4cb99c0d94fffb20732b 100644 (file)
@@ -520,6 +520,7 @@ delete_package(Boolean ign_err, package_t *pkg, Boolean NoDeleteFiles,
        int     fail = SUCCESS;
        Boolean preserve;
        char    tmp[MaxPathSize];
+       char    cmd[MaxPathSize];
        const char *prefix = NULL, *name = NULL;
 
        if (!pkgdb_open(ReadWrite)) {
@@ -586,10 +587,12 @@ delete_package(Boolean ign_err, package_t *pkg, Boolean NoDeleteFiles,
                case PLIST_UNEXEC:
                        if (NoDeleteFiles)
                                break;
-                       format_cmd(tmp, sizeof(tmp), p->name, prefix, last_file);
-                       printf("Executing `%s'\n", tmp);
-                       if (!Fake && system(tmp)) {
-                               warnx("unexec command for `%s' failed", tmp);
+                       (void) snprintf(tmp, sizeof(tmp), "%s%s%s",
+                                       destdir ? destdir : "", destdir ? "/" : "", prefix);
+                       format_cmd(cmd, sizeof(cmd), p->name, tmp, last_file);
+                       printf("Executing `%s'\n", cmd);
+                       if (!Fake && system(cmd)) {
+                               warnx("unexec command for `%s' failed", cmd);
                                fail = FAIL;
                        }
                        break;