[31486] trunk/base/portmgr/dmg/postflight

jmpp at macports.org jmpp at macports.org
Sun Nov 25 08:17:20 PST 2007


Revision: 31486
          http://trac.macosforge.org/projects/macports/changeset/31486
Author:   jmpp at macports.org
Date:     2007-11-25 08:17:19 -0800 (Sun, 25 Nov 2007)

Log Message:
-----------

Don't output anything to a temporary file to then try to read from it, as there is a non-zero chance that mktemp call may fail (even if very small).
Instead, grep out path from the output of "/usr/bin/printenv PATH" directly.  Thanks to asigel at apple.com for the suggestion, closes #8401.

Modified Paths:
--------------
    trunk/base/portmgr/dmg/postflight

Modified: trunk/base/portmgr/dmg/postflight
===================================================================
--- trunk/base/portmgr/dmg/postflight	2007-11-25 15:36:14 UTC (rev 31485)
+++ trunk/base/portmgr/dmg/postflight	2007-11-25 16:17:19 UTC (rev 31486)
@@ -36,14 +36,9 @@
 
 BINPATH=/opt/local/bin
 SBINPATH=/opt/local/sbin
-TMP=`/usr/bin/mktemp /tmp/mp.$$`
-$SHELL -l <<EOF > $TMP
-    /usr/bin/printenv PATH
-    exit
-EOF
 
-if grep $BINPATH $TMP >/dev/null 2>&1; then
-	echo "You already have the right PATH - l337!"
+if $SHELL -c "/usr/bin/printenv PATH" | grep -c $BINPATH > /dev/null; then
+    echo "You already have the right PATH - l337!"
 else
     USHELL=`basename $SHELL`
    echo "Setting the PATH of $USHELL for $USER in ${HOME:=/Users/$USER}..."

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20071125/ea1f81ed/attachment.html


More information about the macports-changes mailing list