Merge pull request #297 from t-b/upgrade_msys_openssl_101m
[msysgit.git] / etc / profile
blob8c378d70c055fe6b4183c3d632646fa00ae435e1
1 # Copyright (C) 2001, 2002  Earnie Boyd  <earnie@users.sf.net>
2 # This file is part of the Minimal SYStem.
3 #   http://www.mingw.org/msys.shtml
5 #         File: profile
6 #  Description: Shell environment initialization script
7 # Last Revised: 2002.05.04
9 MSYSTEM=MSYS
10 # work around (old) Visual Studio setting this variable
11 unset LIB
13 # My decision to add a . to the PATH and as the first item in the path list
14 # is to mimick the Win32 method of finding executables.
16 # I filter the PATH value setting in order to get ready for self hosting the
17 # MSYS runtime and wanting different paths searched first for files.
18 if [ $MSYSTEM == MINGW32 ]; then
19   export PATH=".:/usr/local/bin:/mingw/bin:/bin:$PATH"
20 else
21   export PATH=".:/usr/local/bin:/bin:/mingw/bin:$PATH"
24 # check msys-1.0.dll
25 if test -f /etc/msys-1.0.dll.md5
26 then
27         # if check succeeds, let's avoid checking again
28         test "$(md5sum /bin/msys-1.0.dll)" = "$(cat /etc/msys-1.0.dll.md5)" &&
29         rm -f /etc/msys-1.0.dll.md5 ||
30         printf "\n\033[31mERROR: Your msys-1.0.dll is out-of-date!\033[m\n\n"
33 if [ -z "$USERNAME" ]; then
34   LOGNAME="`id -un`"
35 else
36   LOGNAME="$USERNAME"
39 # Set up USER's home directory
40 if [ -z "$HOME" -o ! -d "$HOME" ]; then
41   HOME="$HOMEDRIVE$HOMEPATH"
44 if [ ! -d "$HOME" ]; then
45         printf "\n\033[31mERROR: HOME directory '$HOME' doen't exist!\033[m\n\n"
46         echo "This is an error which might be related to msysGit issue 108."
47         echo "You might want to set the environment variable HOME explicitely."
48         printf "\nFalling back to \033[31m/ ($(cd / && pwd -W))\033[m.\n\n"
49         HOME=/
52 # normalize HOME to unix path
53 HOME="$(cd "$HOME" ; pwd)"
55 export PATH="$HOME/bin:$PATH"
57 export GNUPGHOME=~/.gnupg
59 if [ "x$HISTFILE" == "x/.bash_history" ]; then
60   HISTFILE=$HOME/.bash_history
63 if [ -e ~/.inputrc ]; then
64     export INPUTRC=~/.inputrc
65 else
66     export INPUTRC=/etc/inputrc
69 export HOME LOGNAME MSYSTEM HISTFILE
71 for i in /etc/profile.d/*.sh ; do
72   if [ -f $i ]; then
73     . $i
74   fi
75 done
77 export MAKE_MODE=unix
79 # Git specific stuff
80 test -e /bin/git.exe -o -e /git/git.exe || {
81         echo
82         echo -------------------------------------------------------
83         echo "Building and Installing Git"
84         echo -------------------------------------------------------
86         cd /git &&
87         make install
89         case $? in
90         0)
91                 MESSAGE="You are in the git working tree, and all is ready for you to hack."
92         ;;
93         *)
94                 MESSAGE="Your build failed...  Please fix it, and give feedback on the Git list."
95         esac
97         test -d /installer-tmp && rm -rf /installer-tmp
99         cat <<EOF
102 -------------------------
103 Hello, dear Git developer.
105 This is a minimal MSYS environment to work on Git.
107 $MESSAGE
112 # when called from "Git Bash Here", there is a "!C:=..." or similar in env
113 if ! env | grep -q '^!'
114 then
115         cd "$HOME"
118 # let's make sure that the post-checkout hook is installed
119 test -d /.git && test ! -x /.git/hooks/post-checkout &&
120 test -x /share/msysGit/post-checkout-hook &&
121 mkdir -p /.git/hooks &&
122 cp /share/msysGit/post-checkout-hook /.git/hooks/post-checkout
124 test -f /etc/motd && sed "s/\$MESSAGE/$MESSAGE/" < /etc/motd
126 case ":$PATH:" in
127 *:/cmd:*|*:/bin:*) ;;
129         cat << EOF
131 In order to use Git from cmd.exe:
132 1. Add c:\msysgit\cmd to cmd's PATH
133 2. DON'T add c:\msysgit\bin or c:\msysgit\mingw\bin to cmd's PATH
134 Commands like 'git add' will work from cmd.exe now.
135 Commands like 'git-add' will NOT work. Add more wrappers as appropriate.
137 esac
140 . /git/contrib/completion/git-completion.bash
141 . /git/contrib/completion/git-prompt.sh
142 PS1='\[\033]0;$MSYSTEM:\w\007
143 \033[32m\]\u@\h \[\033[33m\w$(__git_ps1)\033[0m\]
144 $ '
146 # set default options for 'less'
147 export LESS=-FRSX
148 export LESSCHARSET=utf-8
150 # set default protocol for 'plink'
151 export PLINK_PROTOCOL=ssh
153 # read user-specific settings, possibly overriding anything above
154 if [ -e ~/.bashrc ]; then
155     . ~/.bashrc
156 elif [ -e ~/.bash_profile ]; then
157     . ~/.bash_profile
158 elif [ -e /etc/bash_profile ]; then
159     . /etc/bash_profile