aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_install
diff options
context:
space:
mode:
authorEitan Adler <eadler@FreeBSD.org>2012-02-09 20:51:03 +0000
committerEitan Adler <eadler@FreeBSD.org>2012-02-09 20:51:03 +0000
commit839a18b056ddca32a4063437c56d7456f59398e6 (patch)
treed123027f81a0dececb25d7541797e1b1ef3e2cd2 /usr.sbin/pkg_install
parent7c88c0d0e1871d15e9c876013f8f0202927a6a52 (diff)
downloadsrc-839a18b056ddca32a4063437c56d7456f59398e6.tar.gz
src-839a18b056ddca32a4063437c56d7456f59398e6.zip
Permit the use of relative paths for the prefix argument.
Remove an unnecessary cwd from created plists when -p is specified PR: bin/145000 Submitted by: gcooper Approved by: portmgr (flo) MFC after: 1 month
Notes
Notes: svn path=/head/; revision=231300
Diffstat (limited to 'usr.sbin/pkg_install')
-rw-r--r--usr.sbin/pkg_install/create/perform.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.sbin/pkg_install/create/perform.c b/usr.sbin/pkg_install/create/perform.c
index 0834ecda9597..bfe4ac4dbd11 100644
--- a/usr.sbin/pkg_install/create/perform.c
+++ b/usr.sbin/pkg_install/create/perform.c
@@ -214,8 +214,12 @@ pkg_perform(char **pkgs)
read_plist(&plist, pkg_in);
/* Prefix should add an @cwd to the packing list */
- if (Prefix)
- add_plist_top(&plist, PLIST_CWD, Prefix);
+ if (Prefix) {
+ char resolved_prefix[PATH_MAX];
+ if (realpath(Prefix, resolved_prefix) != 0)
+ err(EXIT_FAILURE, "couldn't resolve path for prefix: %s", Prefix);
+ add_plist_top(&plist, PLIST_CWD, resolved_prefix);
+ }
/* Add the origin if asked, at the top */
if (Origin)
@@ -260,7 +264,9 @@ pkg_perform(char **pkgs)
/* mark_plist(&plist); */
/* Now put the release specific items in */
- add_plist(&plist, PLIST_CWD, ".");
+ if (!Prefix) {
+ add_plist(&plist, PLIST_CWD, ".");
+ }
write_file(COMMENT_FNAME, Comment);
add_plist(&plist, PLIST_IGNORE, NULL);
add_plist(&plist, PLIST_FILE, COMMENT_FNAME);