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

jmpp at macports.org jmpp at macports.org
Tue Jan 15 08:25:45 PST 2008


Revision: 32970
          http://trac.macosforge.org/projects/macports/changeset/32970
Author:   jmpp at macports.org
Date:     2008-01-15 08:25:43 -0800 (Tue, 15 Jan 2008)

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

Even better than r32968: pass the new setting that we want to write to the custom 'write_setting' command as ${2},
which allows us to get rid of that case construct within it and thus truly abstract it away.

Now 'write_setting' takes two arguments: the environment variable that is to be tweaked (${1}) and how it should be
tweaked (${2}), which makes a lot more sense. 'write_setting' itself doesn't need to be adapted any more in case the
settings need to be changed, new ones added or even some deleted.

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-15 16:16:31 UTC (rev 32969)
+++ branches/release_1_6/base/portmgr/dmg/postflight	2008-01-15 16:25:43 UTC (rev 32970)
@@ -70,18 +70,7 @@
         echo -e "\n##\n# Your previous ${HOME}/.${CONF_FILE} file was backed up as ${HOME}/.${CONF_FILE}.${BACKUP_SUFFIX}\n##" >> ${HOME}/.${CONF_FILE}
     fi
     echo -e "\n# ${OUR_STRING} adding an appropriate ${1} variable for use with MacPorts." >> ${HOME}/.${CONF_FILE}
-    case ${1} in
-        PATH)
-            NEW_SETTING="${BINPATH}:${SBINPATH}:\$PATH"
-            ;;
-        MANPATH)
-            NEW_SETTING="${MANPAGES}:\$MANPATH"
-            ;;
-        DISPLAY)
-            NEW_SETTING=":0"
-            ;;
-    esac
-    echo "${ENV_COMMAND} ${1}${ASSIGN}${NEW_SETTING}" >> ${HOME}/.${CONF_FILE}
+    echo "${ENV_COMMAND} ${1}${ASSIGN}${2}" >> ${HOME}/.${CONF_FILE}
     echo -e "# Finished adapting your ${1} environment variable for use with MacPorts.\n" >> ${HOME}/.${CONF_FILE}
     chown ${USER} ${HOME}/.${CONF_FILE} || echo "Warning: unable to adapt permissions on your ${HOME}/.${CONF_FILE} shell configuration file!"
     echo "An appropriate ${1} variable has been added to your shell environment by the MacPorts installer."
@@ -123,7 +112,7 @@
 if ${SHELL} ${LOGIN_FLAG} -c "/usr/bin/printenv PATH" | grep ${PREFIX} > /dev/null; then
     echo "Your shell already has the right PATH environment variable for use with MacPorts!"
 else
-    write_setting PATH
+    write_setting PATH "${BINPATH}:${SBINPATH}:\$PATH"
 fi
 
 # We gather the path into a variable of our own for faster operation:
@@ -142,14 +131,14 @@
   [ -z "$(echo "${ORIGINAL_MANPATH}" | awk -F : '{print $NF}')" ]; then
     echo "Your shell already has the right MANPATH environment variable for use with MacPorts!"
 else
-    write_setting MANPATH
+    write_setting MANPATH "${MANPAGES}:\$MANPATH"
 fi
 
 # Adding a DISPLAY variable only if we're running on Tiger or less and if it doesn't already exist:
 if (($(sw_vers -productVersion | awk -F . '{print $2}') >= 5)) || ${SHELL} ${LOGIN_FLAG} -c "/usr/bin/env | grep DISPLAY" > /dev/null; then
     echo "Your shell already has the right DISPLAY environment variable for use with MacPorts!"
 else
-    write_setting DISPLAY
+    write_setting DISPLAY ":0"
 fi
 
 

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


More information about the macports-changes mailing list