2021-12-22 13:51:22 +00:00
|
|
|
#!/bin/bash
|
2022-07-04 09:56:45 +00:00
|
|
|
##makedesc: Install git (latest)
|
|
|
|
|
2022-01-08 06:17:50 +00:00
|
|
|
echo
|
|
|
|
echo "==============================================="
|
2022-01-09 09:26:27 +00:00
|
|
|
echo "Installing git (latest)..."
|
2022-01-08 06:17:50 +00:00
|
|
|
echo "==============================================="
|
|
|
|
echo
|
2021-12-22 13:51:22 +00:00
|
|
|
|
2022-01-09 09:23:19 +00:00
|
|
|
installed() {
|
|
|
|
command -v "$1" >/dev/null 2>&1
|
|
|
|
}
|
2022-01-09 09:26:27 +00:00
|
|
|
|
|
|
|
! installed make && sudo apt install -y make
|
2022-01-09 09:23:19 +00:00
|
|
|
|
2022-01-08 06:17:50 +00:00
|
|
|
if installed git; then
|
2022-07-05 09:05:34 +00:00
|
|
|
if [ -d "${HOME}/install/git" ]; then
|
|
|
|
cd /usr/src/git/ && \
|
|
|
|
git pull
|
|
|
|
else
|
|
|
|
git clone https://github.com/git/git.git --depth=1 "${HOME}/install/git" && \
|
|
|
|
cd /usr/src/git/
|
|
|
|
fi
|
|
|
|
sudo make prefix=/usr/local all && \
|
|
|
|
sudo make prefix=/usr/local install
|
2021-12-22 13:51:22 +00:00
|
|
|
else
|
2022-07-04 09:56:45 +00:00
|
|
|
! installed wget && sudo apt install -y wget
|
2022-07-05 09:05:34 +00:00
|
|
|
[ -d "${HOME}/install/git" ] || mkdir -p "${HOME}/install/git"
|
|
|
|
wget https://github.com/git/git/archive/master.zip -O /tmp/git.zip && \
|
|
|
|
unzip -q /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 && \
|
|
|
|
git clone https://github.com/git/git.git --depth=1 "${HOME}/install/git"
|
2021-12-22 13:51:22 +00:00
|
|
|
fi
|
2022-07-04 09:56:45 +00:00
|
|
|
|
2022-01-09 09:26:27 +00:00
|
|
|
git --version
|