Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 46 lines (33 sloc) 991 Bytes
#!/bin/bash
set -e
export PREFIX=`which git | sed -e 's/\/bin\/git//' | sed -e 's/\/libexec.*//'`
# was not able to figure why I kept getting this
# "undefined reference to `libiconv_open'"
# the only way to make it work was adding the CFLAGS below
export CFLAGS=-liconv
export TMPDIR=/tmp/.git-$USER
mkdir -p $TMPDIR
cd $TMPDIR
export VERSION=$1
if [[ '' == $VERSION ]] ; then
/bin/echo 'Usage: [sudo] git selfupdate version'
exit
fi
echo Fetching git version: $VERSION to $PREFIX
curl -O http://kernel.org/pub/software/scm/git/git-$VERSION.tar.gz
curl -O http://kernel.org/pub/software/scm/git/git-manpages-$VERSION.tar.gz
tar -xzf git-$VERSION.tar.gz
cd git-$VERSION
make CFLAGS=$CFLAGS prefix=$PREFIX all
if [ -e $PREFIX/libexec/git-core/git ] ; then
rm -rf $PREFIX/libexec/git-core;
fi
make prefix=$PREFIX install
cd ..
rm -rf git-$VERSION
pushd $PREFIX/man
tar -xzf $TMPDIR/git-manpages-$VERSION.tar.gz
popd
cd $TMPDIR
echo "Files remaining in $TMPDIR:"
\ls git-*