Skip to content

Instantly share code, notes, and snippets.

@sattellite
Last active August 29, 2015 14:10
Show Gist options
  • Save sattellite/75f3681235ea46fc35c1 to your computer and use it in GitHub Desktop.
Save sattellite/75f3681235ea46fc35c1 to your computer and use it in GitHub Desktop.
Update git to latest stable version in Fedora
#!/bin/bash
CUR_PWD=`pwd`
TEMPPATH=${HOME}/.tmp
GITDIR=${TEMPPATH}/git
function clone_git {
git clone https://github.com/git/git.git $GITDIR &>/dev/null
}
function is_git {
git status &>/dev/null || clone_git
}
sudo dnf install -y -q curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc xmlto docbook2X &>/dev/null
sudo ln -s /usr/bin/db2x_docbook2texi /usr/bin/docbook2x-texi &>/dev/null
if [ ! -d "$GITDIR" ]; then
mkdir -p $TEMPPATH && clone_git
fi
cd $GITDIR
is_git
git checkout master &>/dev/null
git pull &>/dev/null
./GIT-VERSION-GEN &>/dev/null
sed -i 's/\s//g' ./GIT-VERSION-FILE &>/dev/null
. ./GIT-VERSION-FILE &>/dev/null
GIT_CURVERSION=`git --version|awk '{print $NF}'` &>/dev/null
if [ "${GIT_VERSION}" == "${GIT_CURVERSION}" ]; then
echo "Current version is up to date. (${GIT_CURVERSION})"
else
make configure
./configure --prefix=/usr
make all doc info
sudo make install install-doc install-html install-info
echo "Installed new version of git. (${GIT_VERSION})"
fi
cd ${CUR_PWD}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment