diff options
author | krion <krion@FreeBSD.org> | 2006-01-07 22:10:58 +0000 |
---|---|---|
committer | krion <krion@FreeBSD.org> | 2006-01-07 22:10:58 +0000 |
commit | 62a303f1e1f438d456ebe73b252a83c17de02ed5 (patch) | |
tree | e5c518889fdd186fddcfbdcde20ffa538eeab4cd /usr.sbin/pkg_install/lib | |
parent | e1a07793db64c060a0d1491248a1e7fc5e39bb7c (diff) | |
download | FreeBSD-src-62a303f1e1f438d456ebe73b252a83c17de02ed5.zip FreeBSD-src-62a303f1e1f438d456ebe73b252a83c17de02ed5.tar.gz |
When using @cwd %%FOO%%, we must ensure to return in the original
prefix later, but doing so with @cwd %%OLDPREFIX%% (having
PLIST_SUB+="OLDPREFIX=${PREFIX}") hardcodes the value in the packing
list. That's not really a problem when dealing with ports but that's
a problem with packages since pkg_add -p option only overrides the
first @cwd occurrence.
This patch allow us to use @cwd without any argument. If no
directory argument is given, it will set current working directory
to the first prefix given by the @cwd command.
PR: bin/77212
Submitted by: flz
Diffstat (limited to 'usr.sbin/pkg_install/lib')
-rw-r--r-- | usr.sbin/pkg_install/lib/plist.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.sbin/pkg_install/lib/plist.c b/usr.sbin/pkg_install/lib/plist.c index e5aa6dc..11e9d13 100644 --- a/usr.sbin/pkg_install/lib/plist.c +++ b/usr.sbin/pkg_install/lib/plist.c @@ -320,7 +320,7 @@ write_plist(Package *pkg, FILE *fp) break; case PLIST_CWD: - fprintf(fp, "%ccwd %s\n", CMD_CHAR, plist->name); + fprintf(fp, "%ccwd %s\n", CMD_CHAR, (plist->name == NULL) ? "" : plist->name); break; case PLIST_SRC: @@ -420,6 +420,7 @@ delete_package(Boolean ign_err, Boolean nukedirs, Package *pkg) Boolean fail = SUCCESS; Boolean preserve; char tmp[FILENAME_MAX], *name = NULL; + char *prefix = NULL; preserve = find_plist_option(pkg, "preserve") ? TRUE : FALSE; for (p = pkg->head; p; p = p->next) { @@ -433,7 +434,9 @@ delete_package(Boolean ign_err, Boolean nukedirs, Package *pkg) break; case PLIST_CWD: - Where = p->name; + if (!prefix) + prefix = p->name; + Where = (p->name == NULL) ? prefix : p->name; if (Verbose) printf("Change working directory to %s\n", Where); break; |