pkg_install: DESTDIR support.

This commit is contained in:
Ben Gras 2010-08-05 14:51:46 +00:00
parent 56770462c2
commit e1f30da613
2 changed files with 8 additions and 5 deletions

View 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))

View 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;