Wine: do not use intelligent Git prompt
[msysgit/kusma.git] / etc / profile
blobe8331a5438b2d39d5e673fe8952baa4e412bceac
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 if [ -z "$MSYSTEM" ]; then
10   MSYSTEM=MINGW32
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"
42   if [ -z "$HOME" -o ! -d "$HOME" ]; then
43     HOME="$USERPROFILE"
44   fi
47 if [ ! -d "$HOME" ]; then
48         printf "\n\033[31mERROR: HOME directory '$HOME' doesn't exist!\033[m\n\n"
49         echo "This is an error which might be related to msysGit issue 108."
50         echo "You might want to set the environment variable HOME explicitly."
51         printf "\nFalling back to \033[31m/ ($(cd / && pwd -W))\033[m.\n\n"
52         HOME=/
55 # normalize HOME to unix path
56 HOME="$(cd "$HOME" ; pwd)"
58 export PATH="$HOME/bin:$PATH"
60 export GNUPGHOME=~/.gnupg
62 if [ "x$HISTFILE" == "x/.bash_history" ]; then
63   HISTFILE=$HOME/.bash_history
66 if [ -e ~/.inputrc ]; then
67     export INPUTRC=~/.inputrc
68 else
69     export INPUTRC=/etc/inputrc
72 case "$LS_COLORS" in
73 *rs*)
74         # Our ls may ot handle LS_COLORS inherited in a Wine process
75         unset LS_COLORS;;
76 esac
78 export HOME LOGNAME MSYSTEM HISTFILE
80 for i in /etc/profile.d/*.sh ; do
81   if [ -f $i ]; then
82     . $i
83   fi
84 done
86 export MAKE_MODE=unix
88 # Git specific stuff
89 test -e /bin/git.exe -o -e /git/git.exe || {
90         echo
91         echo -------------------------------------------------------
92         echo "Building and Installing Git"
93         echo -------------------------------------------------------
95         cd /git &&
96         make install
98         case $? in
99         0)
100                 MESSAGE="You are in the git working tree, and all is ready for you to hack."
101         ;;
102         *)
103                 MESSAGE="Your build failed...  Please fix it, and give feedback on the Git list."
104         esac
106         test -d /installer-tmp && rm -rf /installer-tmp
108         cat <<EOF
111 -------------------------
112 Hello, dear Git developer.
114 This is a minimal MSYS environment to work on Git.
116 $MESSAGE
121 # let's make sure that the post-checkout hook is installed
122 test -d /.git && test ! -x /.git/hooks/post-checkout &&
123 test -x /share/msysGit/post-checkout-hook &&
124 mkdir -p /.git/hooks &&
125 cp /share/msysGit/post-checkout-hook /.git/hooks/post-checkout
127 test -f /etc/motd && sed "s/\$MESSAGE/$MESSAGE/" < /etc/motd
128 test -x /share/msysGit/initialize.sh -a ! -d /.git &&
129 cat << EOF
131 It appears that you installed msysGit using the full installer.
132 To set up the Git repositories, please run /share/msysGit/initialize.sh
135 case ":$PATH:" in
136 *:/cmd:*|*:/bin:*) ;;
138         cat << EOF
140 In order to use Git from cmd.exe:
141 1. Add c:\msysgit\cmd to cmd's PATH
142 2. DON'T add c:\msysgit\bin or c:\msysgit\mingw\bin to cmd's PATH
143 Commands like 'git add' will work from cmd.exe now.
144 Commands like 'git-add' will NOT work. Add more wrappers as appropriate.
146 esac
149 . /git/contrib/completion/git-completion.bash
150 if test -z "$WINELOADERNOEXEC"
151 then
152         PS1='\[\033]0;$MSYSTEM:\w\007
153 \033[32m\]\u@\h \[\033[33m\w$(__git_ps1)\033[0m\]
154 $ '
155 else
156         PS1='\[\033]0;$MSYSTEM:\w\007
157 \033[32m\]\u@\h \[\033[33m\w\033[0m\]
158 $ '
161 # set default options for 'less'
162 export LESS=-FRSX
163 # set default protocol for 'plink'
164 export PLINK_PROTOCOL=ssh
166 # read user-specific settings, possibly overriding anything above
167 if [ -e ~/.bashrc ]; then
168     . ~/.bashrc
169 elif [ -e ~/.bash_profile ]; then
170     . ~/.bash_profile
171 elif [ -e /etc/bash_profile ]; then
172     . /etc/bash_profile