From: Ben Gras Date: Thu, 5 Aug 2010 14:51:46 +0000 (+0000) Subject: pkg_install: DESTDIR support. X-Git-Tag: v3.1.8~97 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=e1f30da613bc33ddc90c134caed32872d7309083;p=minix.git pkg_install: DESTDIR support. --- diff --git a/commands/pkg_install/add/perform.c b/commands/pkg_install/add/perform.c index c43f43657..c56fdfba4 100644 --- a/commands/pkg_install/add/perform.c +++ b/commands/pkg_install/add/perform.c @@ -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)) diff --git a/commands/pkg_install/lib/plist.c b/commands/pkg_install/lib/plist.c index 9b41933b4..6719a5b38 100644 --- a/commands/pkg_install/lib/plist.c +++ b/commands/pkg_install/lib/plist.c @@ -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;