Adjust GitMe installer for recent changes
[git/jnareb-git.git] / share / GitMe / setup-msysgit.sh
blobbc08ccac6b13940b11365861ca7e07b675649d3c
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=git://repo.or.cz/msysgit.git
40 MSYSGIT_REPO_GIT_MOB=ssh://mob@repo.or.cz/srv/git/msysgit.git
41 MSYSGIT_REPO_HTTP=http://repo.or.cz/r/msysgit.git
43 # Multiply git.exe
45 cp "$INSTALL_PATH/installer-tmp/bin/git.exe" "$INSTALL_PATH/installer-tmp/bin/git-init.exe"
46 cp "$INSTALL_PATH/installer-tmp/bin/git.exe" "$INSTALL_PATH/installer-tmp/bin/git-unpack-objects.exe"
47 cp "$INSTALL_PATH/installer-tmp/bin/git.exe" "$INSTALL_PATH/installer-tmp/bin/git-update-ref.exe"
49 git init &&
50 git config remote.origin.url $MSYSGIT_REPO_GIT &&
51 git config remote.origin.fetch \
52 +refs/heads/@@MSYSGITBRANCH@@:refs/remotes/origin/@@MSYSGITBRANCH@@ &&
53 git config branch.master.remote origin &&
54 git config branch.master.merge refs/heads/@@MSYSGITBRANCH@@ &&
55 git config remote.mob.url $MSYSGIT_REPO_GIT_MOB &&
56 git config remote.mob.fetch +refs/remote/mob:refs/remotes/origin/mob &&
57 git config remote.mob.push master:mob &&
59 USE_HTTP=
60 git fetch ||
61 USE_HTTP=t &&
62 git config remote.origin.url $MSYSGIT_REPO_HTTP &&
63 git fetch ||
64 error "Could not get msysgit.git"
66 git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
68 echo
69 echo -------------------------------------------------------
70 echo Checking out the master branch
71 echo -------------------------------------------------------
72 git-checkout -l -f -q -b master origin/@@MSYSGITBRANCH@@ ||
73 error Couldn\'t checkout the master branch!
76 # TEMP: Remove pre-existing git directory
77 rm -rf git
80 echo
81 echo -------------------------------------------------------
82 echo Fetching the latest MinGW Git sources
83 echo -------------------------------------------------------
85 case "$USE_HTTP" in
87 GIT_REPO_URL=http://repo.or.cz/r/git.git/
88 MINGW_REPO_URL=http://repo.or.cz/r/git/mingw.git/
89 MINGW4MSYSGIT_REPO_URL=http://repo.or.cz/r/git/mingw/4msysgit.git/
91 '')
92 GIT_REPO_URL=git://repo.or.cz/git.git
93 MINGW_REPO_URL=git://repo.or.cz/git/mingw.git
94 MINGW4MSYSGIT_REPO_URL=git://repo.or.cz/git/mingw/4msysgit.git
96 esac
98 git config submodule.git.url $MINGW4MSYSGIT_REPO_URL &&
99 mkdir git &&
100 cd git &&
101 git init &&
102 git config remote.junio.url $GIT_REPO_URL &&
103 git config remote.junio.fetch '+refs/heads/*:refs/remotes/junio/*' &&
104 git fetch junio &&
105 git config remote.mingw.url $MINGW_REPO_URL &&
106 git config remote.mingw.fetch '+refs/heads/*:refs/remotes/mingw/*' &&
107 git fetch mingw &&
108 git config remote.origin.url $MINGW4MSYSGIT_REPO_URL &&
109 git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*' &&
110 git fetch origin &&
111 if test -z "@@FOURMSYSGITBRANCH@@"
112 then
113 FOURMSYS=$(cd .. && git ls-tree HEAD git |
114 sed -n "s/^160000 commit \(.*\) git$/\1/p")
115 else
116 FOURMSYS=origin/@@FOURMSYSGITBRANCH@@
117 fi &&
118 git checkout -l -f -q $FOURMSYS ||
119 error Couldn\'t update submodule git!
121 echo
122 echo -------------------------------------------------------
123 echo Fetching HTML help pages
124 echo -------------------------------------------------------
126 cd .. &&
127 rm -rf /doc/git/html &&
128 git config submodule.html.url $GIT_REPO_URL &&
129 mkdir -p doc/git/html &&
130 cd doc/git/html &&
131 git init &&
132 git config remote.origin.url $GIT_REPO_URL &&
133 git config remote.origin.fetch '+refs/heads/html:refs/remotes/origin/html' &&
134 git fetch origin &&
135 git checkout -l -f -q $(cd ../../.. && git ls-tree HEAD doc/git/html |
136 sed -n "s/^160000 commit \(.*\).doc\/git\/html$/\1/p") ||
137 error "Couldn't update submodule doc/git/html (HTML help will not work)."