[32698] branches/release_1_6/base/portmgr/dmg/postflight

jmpp at macports.org jmpp at macports.org
Fri Jan 11 08:55:33 PST 2008


Revision: 32698
          http://trac.macosforge.org/projects/macports/changeset/32698
Author:   jmpp at macports.org
Date:     2008-01-11 08:55:31 -0800 (Fri, 11 Jan 2008)

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

Re-reorder variable and functions declarations again, so that:

 * Shell finding heuristics are next to shell configuration file selection;
 * $BINPATH is defined before it is used in 'update_macports';

Also, don't export $PATH in 'update_macports'; instead, use the full path to the port(1) command.

Modified Paths:
--------------
    branches/release_1_6/base/portmgr/dmg/postflight

Modified: branches/release_1_6/base/portmgr/dmg/postflight
===================================================================
--- branches/release_1_6/base/portmgr/dmg/postflight	2008-01-11 16:25:00 UTC (rev 32697)
+++ branches/release_1_6/base/portmgr/dmg/postflight	2008-01-11 16:55:31 UTC (rev 32698)
@@ -32,11 +32,19 @@
 # $Id$
 
 
+# Abstraction variables:
+PREFIX=/opt/local
+BINPATH=${PREFIX}/bin
+SBINPATH=${PREFIX}/sbin
+MANPAGES=${PREFIX}/share/man
+BACKUP_SUFFIX=mpsaved_"$(date +"%Y-%m-%d_at_%H:%M:%S")"
+OUR_STRING="MacPorts setting on $(date +"%Y-%m-%d at %H:%M:%S"):"
+
+
 # Command to update the MacPorts installation through "selfupdate":
 function update_macports {
-    export PATH=$BINPATH:$PATH
     echo "Synchronizing the MacPorts installation with the project's rsync server..."
-    if ! port -v selfupdate; then 
+    if ! ${BINPATH}/port -v selfupdate; then 
         echo "An attempt to synchronize your recent MacPorts installation with the project's rsync server failed!"
         echo "Please run 'port -d selfupdate' manually to find out the cause of the error."
     else
@@ -44,21 +52,6 @@
     fi
 }
 
-
-# Abstraction variables:
-PREFIX=/opt/local
-BINPATH=$PREFIX/bin
-SBINPATH=$PREFIX/sbin
-MANPAGES=$PREFIX/share/man
-USHELL="$(basename "$SHELL" 2>/dev/null)" || {
-    echo "An attempt to determine your shell name failed! Please set your MacPorts compatible environment manually."
-    update_macports
-    exit 1
-}
-BACKUP_SUFFIX=mpsaved_"$(date +"%Y-%m-%d_at_%H:%M:%S")"
-OUR_STRING="MacPorts setting on $(date +"%Y-%m-%d at %H:%M:%S"):"
-
-
 # Through this command we write an environment variable to an appropriate shell configuration file,
 # backing up the original only if it exists and if it doesn't contain the $OUR_STRING identification string,
 # which hints that we've already tweaked it and therefore already baked it up.
@@ -100,8 +93,16 @@
 }
 
 
+echo "Checking the shell environment for user \"$USER\"..."
+
+
 # Determine the user's shell, in order to choose an appropriate configuration file we'll be tweaking.
 # Exit nicely if the shell is any other than bash or tcsh, as that's considered non-standard.
+USHELL="$(basename "$SHELL" 2>/dev/null)" || {
+    echo "An attempt to determine your shell name failed! Please set your MacPorts compatible environment manually."
+    update_macports
+    exit 1
+}
 case "$USHELL" in
     tcsh)
         CONF_FILE=tcshrc
@@ -119,8 +120,6 @@
 esac
 
 
-echo "Checking the shell environment for user \"$USER\"..."
-
 # Adding our setting to the PATH variable if not already there:
 if $SHELL $LOGIN_FLAG -c "/usr/bin/printenv PATH" | grep $PREFIX > /dev/null 2>&1; then
     echo "Your shell already has the right PATH environment variable for use with MacPorts!"

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


More information about the macports-changes mailing list