Adjust GitMe installer for recent changes
[git/jnareb-git.git] / share / GitMe / Installer / setup-msysgit.sh
blob67006e21d06c0fb77db6c69f38dbd73f5f2dea76
1 #!/bin/sh
3 # We're already in the install directory
4 INSTALL_PATH=`pwd`
5 export PATH=$INSTALL_PATH/installer-tmp/bin:$PATH
7 error () {
8 echo "* error: $*"
9 echo INSTALLATION ABORTED
10 read -e IGNORED_INPUT
11 trap - exit
12 exit 1
15 echo -------------------------------------------------------
16 echo Checking environment
17 echo -------------------------------------------------------
18 type cygpath >/dev/null 2>/dev/null && {
19 echo "Cygwin seems to be in your system path. This was detected"
20 echo "by trying to run cygpath, which was found by this shell."
21 echo ""
22 echo "Cygwin may cause severe problems, like crashes, if used in"
23 echo "combination with msysgit. Please remove Cygwin from you system"
24 echo "PATH environment variable."
25 echo ""
26 echo "For assistance on how to control your environment variables"
27 echo "you should consult Microsoft's knowlege base:"
28 echo " Windows XP: http://support.microsoft.com/kb/310519"
29 echo " Windows NT: http://support.microsoft.com/kb/100843"
30 echo ""
31 error "Can not install msysgit when Cygwin is in PATH."
33 echo "Environment is clean. Can install msysgit."
35 echo
36 echo -------------------------------------------------------
37 echo Fetching the latest MSys environment
38 echo -------------------------------------------------------
39 MSYSGIT_REPO_GIT=repo.or.cz/msysgit.git
40 MSYSGIT_REPO_HTTP=repo.or.cz/r/msysgit.git
42 git init &&
43 git config remote.origin.url git://$MSYSGIT_REPO_GIT &&
44 git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*' &&
45 git config remote.mob.url \
46 ssh://mob@$MSYSGIT_REPO_GIT &&
47 git config remote.mob.fetch +refs/remote/mob:refs/remotes/origin/mob &&
48 git config remote.mob.push master:mob &&
50 cp $INSTALL_PATH/installer-tmp/bin/git.exe $INSTALL_PATH/installer-tmp/bin/git-unpack-objects.exe
52 (git fetch ||
53 (git config remote.origin.url \
54 http://$MSYSGIT_REPO_HTTP &&
55 git fetch))
57 # This following works, but would not fall back on curl if git:// protocol couldn't be used
58 #git-clone -n $MSYSGIT_REPO /msysgit-tmp ||
59 #mv /msysgit-tmp/.git $INSTALL_PATH/.git
60 #rm -rf /msysgit-tmp ||
61 # error Couldn\'t clone $MSYSGIT_REPO!
64 echo
65 echo -------------------------------------------------------
66 echo Checking out the master branch
67 echo -------------------------------------------------------
68 git-checkout -l -f -b master origin/master ||
69 error Couldn\'t checkout the master branch!
72 # TEMP: Remove pre-existing git directory
73 rm -rf git
76 echo
77 echo -------------------------------------------------------
78 echo Fetching the latest MinGW Git sources
79 echo -------------------------------------------------------
80 MINGW_REPO_GIT=git://repo.or.cz/git/mingw/4msysgit.git
81 MINGW_REPO_HTTP=http://repo.or.cz/r/git/mingw/4msysgit.git
83 git-submodule init &&
84 (git-submodule update ||
85 (git config submodule.git.url $MINGW_REPO_HTTP &&
86 rm -rf $INSTALL_PATH/git && # Need to clean up after the previous failed submodule update
87 git-submodule update)) ||
88 error Couldn\'t update submodules!