Work in progress: a script that generates GitMe-$VERSION.exe
[git/jnareb-git.git] / share / GitMe / setup-msysgit.sh
blobaa34e41f6d1f74ef32ddc0357d940229aec4017e
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
16 echo -------------------------------------------------------
17 echo Fetching the latest MSys environment
18 echo -------------------------------------------------------
19 MSYSGIT_REPO_GIT=repo.or.cz/msysgit.git
20 MSYSGIT_REPO_HTTP=repo.or.cz/r/msysgit.git
21 MSYSGIT_PROT=git
23 git init &&
24 git config remote.origin.url git://$MSYSGIT_REPO_GIT &&
25 git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*' &&
26 git config remote.mob.url \
27 ssh://mob@$MSYSGIT_REPO_GIT &&
28 git config remote.mob.fetch +refs/remote/mob:refs/remotes/origin/mob &&
29 git config remote.mob.push master:mob &&
30 (git fetch ||
31 (MSYSGIT_PROT=http &&
32 git config remote.origin.url \
33 http://$MSYSGIT_REPO_HTTP &&
34 git fetch))
36 # This following works, but would not fall back on curl if git:// protocol couldn't be used
37 #git-clone -n $MSYSGIT_REPO /msysgit-tmp ||
38 #mv /msysgit-tmp/.git $INSTALL_PATH/.git
39 #rm -rf /msysgit-tmp ||
40 # error Couldn\'t clone $MSYSGIT_REPO!
43 echo
44 echo -------------------------------------------------------
45 echo Checking out the master branch
46 echo -------------------------------------------------------
47 git-checkout -l -f -b master origin/master ||
48 error Couldn\'t checkout the master branch!
51 # TEMP: Remove pre-existing git directory
52 rm -rf git
55 echo
56 echo -------------------------------------------------------
57 echo Fetching the latest MinGW Git sources
58 echo -------------------------------------------------------
59 MINGW_REPO=git://repo.or.cz/git/mingw/4msysgit.git
60 if [ "$MSYSGIT_PROT" == "http" ]; then
61 MINGW_REPO=http://repo.or.cz/r/git/mingw/4msysgit.git
64 git-submodule init &&
65 git config submodule.git.url $MINGW_REPO &&
66 git-submodule update ||
67 error Couldn\'t update submodules!
70 echo
71 echo -------------------------------------------------------
72 echo Install config.mak file in /git
73 echo -------------------------------------------------------
74 cp $INSTALL_PATH/installer-tmp/config.mak $INSTALL_PATH/git/config.mak