my-env/install/git
2024-07-31 23:26:12 +08:00

39 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
##makedesc: Install git (latest)
source `dirname $0`/../helpers || exit 255
title
require make
if installed git; then
if [ -d "$HOME/install/git" ]; then
cd "$HOME/install/git" && \
git pull
else
clone "https://github.com/git/git.git" "$HOME/install/git" --depth=1 --single-branch && \
cd "$HOME/install/git"
fi
sudo make prefix=/usr/local all && \
sudo make prefix=/usr/local install
else
require wget
mkdir -p "$HOME/install/git"
download "https://github.com/git/git/archive/master.zip" "/tmp/git.zip" && \
unzip -oq "/tmp/git.zip" -d "$HOME/install/git" && \
rm /tmp/git.zip && \
cd "$HOME/install/git/git-master" && \
sudo make prefix=/usr/local all && \
sudo make prefix=/usr/local install && \
cd - && \
rm -rf git && \
clone "https://github.com/git/git.git" "$HOME/install/git" --depth=1 --single-branch
fi
[ $? = 0 ] && {
echo
success "git installed!"
git --version
echo
}