Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Mar 2012 23:59:02 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r233687 - stable/7/usr.sbin/pkg_install/create
Message-ID:  <201203292359.q2TNx24M015911@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eadler
Date: Thu Mar 29 23:59:02 2012
New Revision: 233687
URL: http://svn.freebsd.org/changeset/base/233687

Log:
  MFC r231300, r231328:
  	Permit the use of relative paths for the prefix argument.
  	Remove an unnecessary cwd from created plists when -p is specified
  
  Approved by:	cperciva (implicit)

Modified:
  stable/7/usr.sbin/pkg_install/create/perform.c
Directory Properties:
  stable/7/usr.sbin/pkg_install/   (props changed)

Modified: stable/7/usr.sbin/pkg_install/create/perform.c
==============================================================================
--- stable/7/usr.sbin/pkg_install/create/perform.c	Thu Mar 29 23:58:16 2012	(r233686)
+++ stable/7/usr.sbin/pkg_install/create/perform.c	Thu Mar 29 23:59:02 2012	(r233687)
@@ -208,8 +208,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) == NULL)
+	    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)
@@ -254,7 +258,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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203292359.q2TNx24M015911>