[33639] branches/release_1_6/base/portmgr/dmg/postflight
jmpp at macports.org
jmpp at macports.org
Fri Feb 1 23:16:37 PST 2008
Revision: 33639
http://trac.macosforge.org/projects/macports/changeset/33639
Author: jmpp at macports.org
Date: 2008-02-01 23:16:35 -0800 (Fri, 01 Feb 2008)
Log 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.
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-02-02 02:25:51 UTC (rev 33638)
+++ branches/release_1_6/base/portmgr/dmg/postflight 2008-02-02 07:16:35 UTC (rev 33639)
@@ -84,26 +84,28 @@
# 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}")" || {
+USHELL=$(dscl . -read /users/${USER} shell | awk -F'/' '{print $NF}') || {
echo "An attempt to determine your shell name failed! Please set your MacPorts compatible environment manually."
update_macports
exit 1
}
case "${USHELL}" in
tcsh)
+ echo "Detected the tcsh shell."
LOGIN_FLAG=""
ENV_COMMAND="setenv"
ASSIGN=" "
CONF_FILE=tcshrc
;;
bash)
+ echo "Detected the bash shell."
LOGIN_FLAG="-l"
ENV_COMMAND="export"
ASSIGN="="
CONF_FILE=profile
;;
*)
- echo "Unknown shell! Please set your MacPorts compatible environment manually."
+ echo "Unknown shell ($USHELL)! Please set your MacPorts compatible environment manually."
update_macports
exit 0
;;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080201/0037fbc7/attachment.html
More information about the macports-changes
mailing list