#!/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/Documents/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 ### ## local::lib installs might mess up with /usr/bin/perl ## if you have another perl on your path unset PERL_MM_OPT unset PERL5LIB 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 # Allow for -t to force a make test # I should learn to use getopt with sh really run_tests= if [ "$1" == "-t" ] ; then run_tests=yes 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 [ -z "$DOIT" -a -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 PERL_PATH="/usr/bin/env perl" export PERL_PATH make configure ./configure --prefix=$BASE/git-$version make -j6 all if [ $? != 0 ] ; then echo "******* Compilation failed! " exit 1 fi if [ "$run_tests" == "yes" ] ; then echo echo "******* Installing git and documentation" echo make test 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