Mark msysGit as obsolete
[msysgit.git] / share / msysGit / net / setup-msysgit.sh
blobd658bab74f73632fb8a6d78bbc02e2aea2fe34ac
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 msysgit environment
38 echo -------------------------------------------------------
39 MSYSGIT_REPO_GIT=git://github.com/msysgit/msysgit
40 MSYSGIT_REPO_HTTP=https://github.com/msysgit/msysgit.git
42 # Multiply git.exe
44 for builtin in init unpack-objects update-ref fetch ls-remote clone checkout
46 ln "$INSTALL_PATH/installer-tmp/bin/git.exe" \
47 "$INSTALL_PATH/installer-tmp/bin/git-$builtin.exe"
48 done
50 git config --system http.sslCAinfo /bin/curl-ca-bundle.crt
51 git init &&
52 git config core.autocrlf false &&
53 git config remote.origin.url $MSYSGIT_REPO_GIT &&
54 git config remote.origin.fetch \
55 +refs/heads/@@MSYSGITBRANCH@@:refs/remotes/origin/@@MSYSGITBRANCH@@ &&
56 git config branch.@@MSYSGITBRANCH@@.remote origin &&
57 git config branch.@@MSYSGITBRANCH@@.merge refs/heads/@@MSYSGITBRANCH@@ &&
59 USE_HTTP=
60 git fetch || {
61 USE_HTTP=t &&
62 git config remote.origin.url $MSYSGIT_REPO_HTTP &&
63 git fetch || {
64 echo -n "Please enter a HTTP proxy: " &&
65 read proxy &&
66 test ! -z "$proxy" &&
67 export http_proxy="$proxy" &&
68 export https_proxy="$proxy" &&
69 git fetch
70 } ||
71 error "Could not get msysgit.git"
74 git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
76 echo
77 echo -------------------------------------------------------
78 echo Checking out the msysgit @@MSYSGITBRANCH@@ branch
79 echo -------------------------------------------------------
80 git checkout -l -f -q -b @@MSYSGITBRANCH@@ origin/@@MSYSGITBRANCH@@ ||
81 error Couldn\'t checkout the @@MSYSGITBRANCH@@ branch!
82 mkdir -p .git/hooks &&
83 cp share/msysGit/post-checkout-hook .git/hooks/post-checkout ||
84 error Could not install post-checkout hook
86 # TEMP: Remove pre-existing git directory
87 rm -rf git
90 echo
91 echo -------------------------------------------------------
92 echo Fetching the latest Git sources
93 echo -------------------------------------------------------
95 case "$USE_HTTP" in
97 GIT_REPO_URL=https://github.com/git/git.git
98 HTMLDOCS_REPO_URL=https://github.com/gitster/git-htmldocs.git
99 MINGW_REPO_URL=http://repo.or.cz/r/git/mingw.git/
100 MINGW4MSYSGIT_REPO_URL=https://github.com/msysgit/git.git
101 GITCHEETAH_REPO_URL=https://github.com/msysgit/Git-Cheetah.git
104 GIT_REPO_URL=git://github.com/git/git
105 HTMLDOCS_REPO_URL=git://github.com/gitster/git-htmldocs.git
106 MINGW_REPO_URL=git://repo.or.cz/git/mingw.git
107 MINGW4MSYSGIT_REPO_URL=git://github.com/msysgit/git
108 GITCHEETAH_REPO_URL=git://github.com/msysgit/Git-Cheetah
110 esac
112 git config submodule.git.url $MINGW4MSYSGIT_REPO_URL &&
113 mkdir -p git &&
114 cd git &&
115 git init &&
116 git config core.autocrlf input &&
117 git config remote.junio.url $GIT_REPO_URL &&
118 git config remote.junio.fetch '+refs/heads/*:refs/remotes/junio/*' &&
119 git fetch --tags junio &&
120 git config remote.mingw.url $MINGW_REPO_URL &&
121 git config remote.mingw.fetch '+refs/heads/*:refs/remotes/mingw/*' &&
122 git fetch --tags mingw &&
123 git config remote.origin.url $MINGW4MSYSGIT_REPO_URL &&
124 git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*' &&
125 git fetch --tags origin &&
126 if test -z "@@FOURMSYSGITBRANCH@@"
127 then
128 FOURMSYS=origin/master
129 else
130 FOURMSYS=origin/@@FOURMSYSGITBRANCH@@
131 fi &&
132 git config branch.${FOURMSYS#origin/}.remote origin &&
133 git config branch.${FOURMSYS#origin/}.merge refs/heads/${FOURMSYS#origin/} &&
134 git fetch origin &&
135 git checkout -l -f -q -b ${FOURMSYS#origin/} $FOURMSYS ||
136 error Couldn\'t update submodule git!
138 echo
139 echo -------------------------------------------------------
140 echo Fetching Git html help submodule
141 echo -------------------------------------------------------
143 cd .. &&
144 rm -rf /doc/git/html &&
145 git config submodule.html.url $HTMLDOCS_REPO_URL &&
146 mkdir -p doc/git/html &&
147 cd doc/git/html &&
148 git init &&
149 git config remote.origin.url $HTMLDOCS_REPO_URL &&
150 git config remote.origin.fetch '+refs/heads/master:refs/remotes/origin/master' &&
151 git fetch origin &&
152 git checkout -l -f -q $(cd ../../.. && git ls-tree HEAD doc/git/html |
153 sed -n "s/^160000 commit \(.*\).doc\/git\/html$/\1/p") ||
154 error "Couldn't update submodule doc/git/html (HTML help will not work)."
156 echo
157 echo -------------------------------------------------------
158 echo Fetching git-cheetah submodule
159 echo -------------------------------------------------------
161 cd ../../.. &&
162 rm -rf /src/git-cheetah &&
163 git config submodule.git-cheetah.url $GITCHEETAH_REPO_URL &&
164 mkdir -p src/git-cheetah &&
165 cd src/git-cheetah &&
166 git init &&
167 git config remote.origin.url $GITCHEETAH_REPO_URL &&
168 git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*' &&
169 git fetch origin &&
170 git checkout -l -f -q -b master origin/master ||
171 error "Could not update the submodule src/git-cheetah!"
173 # Copy profile.d/*.sh if there is any
175 cd ../.. &&
176 if test -d "$INSTALL_PATH"/installer-tmp/profile.d
177 then
178 mkdir -p etc/profile.d &&
179 for file in "$INSTALL_PATH"/installer-tmp/profile.d/*.sh
181 cp "$file" etc/profile.d/
182 done