New Ticket     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Changeset 33639

Show
Ignore:
Timestamp:
02/01/2008 23:16:35 (4 years ago)
Author:
jmpp@…
Message:
  • Use dscl(1) to detect the default shell for the installing user, rather than trying to infer it from the inherited environment (which did not reflect the user's at all, as it is entirely imposed by Installer.app when the pkg is used in real life). Thanks to Ryan on macports-dev for the original suggestion!
  • Provide a little more information about the shell we detected.

NOTE: I tested this edited script through a test pkg on Leopard and it works, both when used from an account with a bash shell and
from one with a tcsh shell. If anyone cares to test on Tiger and/or Panther, they should contact me so I can hand them the pkg, thanks!
In any case, I'm feeling confident it'll work consistently this time round to detect the shell type, given the nature of the dscl operation.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release_1_6/base/portmgr/dmg/postflight

    r33592 r33639  
    8585# Determine the user's shell, in order to choose an appropriate configuration file we'll be tweaking. 
    8686# Exit nicely if the shell is any other than bash or tcsh, as that's considered non-standard. 
    87 USHELL="$(basename "${SHELL}")" || { 
     87USHELL=$(dscl . -read /users/${USER} shell | awk -F'/' '{print $NF}') || { 
    8888    echo "An attempt to determine your shell name failed! Please set your MacPorts compatible environment manually." 
    8989    update_macports 
     
    9292case "${USHELL}" in 
    9393    tcsh) 
     94        echo "Detected the tcsh shell." 
    9495        LOGIN_FLAG="" 
    9596        ENV_COMMAND="setenv" 
     
    9899        ;; 
    99100    bash) 
     101        echo "Detected the bash shell." 
    100102        LOGIN_FLAG="-l" 
    101103        ENV_COMMAND="export" 
     
    104106        ;; 
    105107    *) 
    106         echo "Unknown shell! Please set your MacPorts compatible environment manually." 
     108        echo "Unknown shell ($USHELL)! Please set your MacPorts compatible environment manually." 
    107109        update_macports 
    108110        exit 0