git rework
This commit is contained in:
parent
b2cf7c154e
commit
e9638e845c
43
install/git
43
install/git
@ -1,43 +1,38 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
##makedesc: Install git (latest)
|
##makedesc: Install git (latest)
|
||||||
|
source `dirname $0`/../helpers || exit 255
|
||||||
|
|
||||||
echo
|
title
|
||||||
echo "==============================================="
|
|
||||||
echo "Installing git (latest)..."
|
|
||||||
echo "==============================================="
|
|
||||||
echo
|
|
||||||
|
|
||||||
installed() {
|
require make
|
||||||
command -v "$1" >/dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
! installed make && sudo apt install -y make
|
|
||||||
|
|
||||||
if installed git; then
|
if installed git; then
|
||||||
if [ -d "${HOME}/install/git" ]; then
|
if [ -d "$HOME/install/git" ]; then
|
||||||
cd "${HOME}/install/git" && \
|
cd "$HOME/install/git" && \
|
||||||
git pull
|
git pull
|
||||||
else
|
else
|
||||||
git clone https://github.com/git/git.git --depth=1 "${HOME}/install/git" && \
|
clone "https://github.com/git/git.git" "$HOME/install/git" --depth=1 --single-branch && \
|
||||||
cd "${HOME}/install/git"
|
cd "$HOME/install/git"
|
||||||
fi
|
fi
|
||||||
sudo make prefix=/usr/local all && \
|
sudo make prefix=/usr/local all && \
|
||||||
sudo make prefix=/usr/local install
|
sudo make prefix=/usr/local install
|
||||||
else
|
else
|
||||||
! installed wget && sudo apt install -y wget
|
require wget
|
||||||
[ -d "${HOME}/install/git" ] || mkdir -p "${HOME}/install/git"
|
mkdir -p "$HOME/install/git"
|
||||||
wget https://github.com/git/git/archive/master.zip -O /tmp/git.zip && \
|
download "https://github.com/git/git/archive/master.zip" "/tmp/git.zip" && \
|
||||||
unzip -oq /tmp/git.zip -d "${HOME}/install/git" && \
|
unzip -oq "/tmp/git.zip" -d "$HOME/install/git" && \
|
||||||
rm /tmp/git.zip && \
|
rm /tmp/git.zip && \
|
||||||
cd "${HOME}/install/git/git-master" && \
|
cd "$HOME/install/git/git-master" && \
|
||||||
sudo make prefix=/usr/local all && \
|
sudo make prefix=/usr/local all && \
|
||||||
sudo make prefix=/usr/local install && \
|
sudo make prefix=/usr/local install && \
|
||||||
cd - && \
|
cd - && \
|
||||||
rm -rf git && \
|
rm -rf git && \
|
||||||
git clone https://github.com/git/git.git --depth=1 "${HOME}/install/git"
|
clone "https://github.com/git/git.git" "$HOME/install/git" --depth=1 --single-branch
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
[ $? = 0 ] && {
|
||||||
echo "Finish!"
|
echo
|
||||||
git --version
|
success "git installed!"
|
||||||
echo
|
git --version
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user