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; continue;
case PLIST_CMD: 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; return -1;
printf("Executing '%s'\n", cmd); printf("Executing '%s'\n", cmd);
if (!Fake && system(cmd)) if (!Fake && system(cmd))

View file

@ -520,6 +520,7 @@ delete_package(Boolean ign_err, package_t *pkg, Boolean NoDeleteFiles,
int fail = SUCCESS; int fail = SUCCESS;
Boolean preserve; Boolean preserve;
char tmp[MaxPathSize]; char tmp[MaxPathSize];
char cmd[MaxPathSize];
const char *prefix = NULL, *name = NULL; const char *prefix = NULL, *name = NULL;
if (!pkgdb_open(ReadWrite)) { if (!pkgdb_open(ReadWrite)) {
@ -586,10 +587,12 @@ delete_package(Boolean ign_err, package_t *pkg, Boolean NoDeleteFiles,
case PLIST_UNEXEC: case PLIST_UNEXEC:
if (NoDeleteFiles) if (NoDeleteFiles)
break; break;
format_cmd(tmp, sizeof(tmp), p->name, prefix, last_file); (void) snprintf(tmp, sizeof(tmp), "%s%s%s",
printf("Executing `%s'\n", tmp); destdir ? destdir : "", destdir ? "/" : "", prefix);
if (!Fake && system(tmp)) { format_cmd(cmd, sizeof(cmd), p->name, tmp, last_file);
warnx("unexec command for `%s' failed", tmp); printf("Executing `%s'\n", cmd);
if (!Fake && system(cmd)) {
warnx("unexec command for `%s' failed", cmd);
fail = FAIL; fail = FAIL;
} }
break; break;