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

jmpp at macports.org jmpp at macports.org
Tue Dec 11 14:26:38 PST 2007


Revision: 31914
          http://trac.macosforge.org/projects/macports/changeset/31914
Author:   jmpp at macports.org
Date:     2007-12-11 14:26:37 -0800 (Tue, 11 Dec 2007)

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

Change the way in which the path to the configuration file is built: don't include the . in its definition but, instead,
in the various path constructions. This allows for more flexibility in using the $CONF_FILE variable.

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	2007-12-11 22:20:42 UTC (rev 31913)
+++ branches/release_1_6/base/portmgr/dmg/postflight	2007-12-11 22:26:37 UTC (rev 31914)
@@ -42,10 +42,10 @@
 }
 case "$USHELL" in
     tcsh)
-        CONF_FILE=.cshrc
+        CONF_FILE=cshrc
         ;;
     bash)
-        CONF_FILE=.profile
+        CONF_FILE=profile
         ;;
     *)
         echo "Unknown shell! Please set your MacPorts compatible environment manually."
@@ -59,32 +59,32 @@
 # 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.
 function write_setting () {
-    if [ -f $HOME/$CONF_FILE ] && ! grep "$OUR_STRING" $HOME/$CONF_FILE; then
-        /bin/cp -fp $HOME/$CONF_FILE "$HOME/$CONF_FILE.$BACKUP_SUFFIX" || {
+    if [ -f $HOME/.$CONF_FILE ] && ! grep "$OUR_STRING" $HOME/.$CONF_FILE; then
+        /bin/cp -fp $HOME/.$CONF_FILE "$HOME/.$CONF_FILE.$BACKUP_SUFFIX" || {
             echo "An attempt to backup your original configuration file failed! Please set your MacPorts compatible environment manually."
             exit 1
         }
-        echo -e "\n#\n# Your previous $HOME/$CONF_FILE file was backed up as $HOME/$CONF_FILE.$BACKUP_SUFFIX\n#" >> $HOME/$CONF_FILE
+        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
+    echo -e "\n# $OUR_STRING adding an appropriate $1 variable for use with MacPorts." >> $HOME/.$CONF_FILE
     case $1 in
         PATH)
-            if [ "$CONF_FILE" == ".profile" ]; then
-                echo "export PATH=$BINPATH:$SBINPATH:\$PATH" >> $HOME/$CONF_FILE
-            elif [ "$CONF_FILE" == ".cshrc" ]; then
-                echo "set path=($BINPATH $SBINPATH" '$path'")" >> $HOME/$CONF_FILE
+            if [ "$CONF_FILE" == "profile" ]; then
+                echo "export PATH=$BINPATH:$SBINPATH:\$PATH" >> $HOME/.$CONF_FILE
+            elif [ "$CONF_FILE" == "cshrc" ]; then
+                echo "set path=($BINPATH $SBINPATH" '$path'")" >> $HOME/.$CONF_FILE
             fi
             ;;
         MANPATH)
-            if [ "$CONF_FILE" == ".profile" ]; then
-                echo "export MANPATH=$MANPAGES:\$MANPATH" >> $HOME/$CONF_FILE
-            elif [ "$CONF_FILE" == ".cshrc" ]; then
-                echo "set manpath=($MANPAGES" '$manpath'")" >> $HOME/$CONF_FILE
+            if [ "$CONF_FILE" == "profile" ]; then
+                echo "export MANPATH=$MANPAGES:\$MANPATH" >> $HOME/.$CONF_FILE
+            elif [ "$CONF_FILE" == "cshrc" ]; then
+                echo "set manpath=($MANPAGES" '$manpath'")" >> $HOME/.$CONF_FILE
             fi
         ;;
     esac
-    chown $USER $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 -e "# Finished adapting your $1 environment variable for use with MacPorts.\n" >> $HOME/.$CONF_FILE
 }
 
 

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


More information about the macports-changes mailing list