public
Description: My personal script stash
Homepage: http://github.com/melo/scripts
Clone URL: git://github.com/melo/scripts.git
commit  45ae6587fa0dcd4fa1884921e75ef251625cce4a
tree    dbc6a298935cfc288350c0772d737b83ff8d0c93
parent  16cdbbcb3139afb2e304cc9fefa84d8f5d0a0147
scripts / bin / x-git-update-to-latest-version
100755 115 lines (87 sloc) 2.189 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/sh
#
# Updates you git.git clone, recompiles, installs and activates the latest
# version
#
 
# Set this to the place where git.git clone is at
# in you local filesystem
GIT_CLONE_DIR=$HOME/work/track/git
 
# Where all the git versions will be placed
# Each version will be inside a directory, like git-v1.5.6.1-204-g6991357
# Current active version will be a symblink 'git'
# so you can add $BASE/git/bin to your PATH
BASE=/usr/local
 
### Nothing more to tweak ###
 
cd $GIT_CLONE_DIR
if [ $? != 0 ] ; then
  echo
  echo "** FATAL **: could not chdir to GIT_CLONE_DIR $GIT_CLONE_DIR"
  echo "Edit this script and tell me where the git.git clone is"
  exit 1
fi
 
echo
echo "This script will pull the lastest git.git master branch, recompile,"
echo "install and activate."
echo
echo "Sure? [y/N]"
 
read confirmation
 
if [ "$confirmation" != "y" ] ; then exit ; fi
 
if [ -e configure ] ; then
make distclean
fi
 
git pull
 
version=`git describe --always`
 
if [ -d "$BASE/git-$version" ] ; then
  echo
  echo "**** You already have the latest git version ($version) installed"
  echo
  exit 0
fi
 
echo
echo "******* Compiling version $version"
echo
 
make configure
./configure --prefix=$BASE/git-$version
unset PERL_MM_OPT
make -j6 all
if [ $? != 0 ] ; then
echo "******* Compilation failed! "
  exit 1
fi
 
 
echo
echo "******* Installing git and documentation"
echo
 
sudo make install
sudo make quick-install-doc
 
 
echo
echo "******* Cleanup phase"
echo
 
make distclean
 
 
echo
echo "******* Check environment"
echo
 
check_path=`echo $PATH | perl -pe 's/:/\n/g' | egrep ^$BASE/git/bin$`
if [ -z "$check_path" ] ; then
echo
echo "WARNING: your PATH must be changed to include"
  echo
echo " $BASE/git/bin"
  echo
fi
 
check_manpath=`echo $MANPATH | perl -pe 's/:/\n/g' | egrep ^$BASE/git/share/man$`
if [ -z "$check_manpath" ] ; then
echo
echo "WARNING: your MANPATH must be changed to include"
  echo
echo " $BASE/git/share/man"
  echo
fi
 
echo
echo Current git version: `readlink $BASE/git`
echo Switching to version: git-$version
echo
 
sudo sh -c "cd $BASE; rm -f git; ln -s git-$version git"
 
echo
echo "You are running verion (running git -v now):"
echo
git --version