2021-12-22 13:51:22 +00:00
|
|
|
#!/bin/bash
|
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
|
|
|
ENVDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
|
|
|
|
|
|
! installed make && sudo apt install -y make
|
|
|
|
! installed curl && sudo apt install -y curl
|
2022-01-09 09:23:19 +00:00
|
|
|
|
2022-01-08 06:17:50 +00:00
|
|
|
if installed git; then
|
2022-01-09 09:26:27 +00:00
|
|
|
sudo rm -rf /usr/src/git
|
|
|
|
sudo git clone https://github.com/git/git.git --depth=1 /usr/src/git
|
2022-01-09 09:14:15 +00:00
|
|
|
sudo chown -R $USER: /usr/src/git
|
2021-12-22 13:51:22 +00:00
|
|
|
cd /usr/src/git/
|
|
|
|
sudo make prefix=/usr/local all
|
|
|
|
sudo make prefix=/usr/local install
|
|
|
|
else
|
2022-01-09 09:26:27 +00:00
|
|
|
wget https://github.com/git/git/archive/master.zip -O /tmp/git.zip
|
|
|
|
sudo unzip -q /tmp/git.zip -d /usr/src/git
|
|
|
|
rm /tmp/git.zip
|
2021-12-22 13:51:22 +00:00
|
|
|
cd /usr/src/git/git-master
|
|
|
|
sudo make prefix=/usr/local all
|
|
|
|
sudo make prefix=/usr/local install
|
|
|
|
cd /usr/src
|
|
|
|
sudo rm -rf git
|
|
|
|
sudo git clone https://github.com/git/git.git --depth=1 /usr/src/git
|
2022-01-09 09:14:15 +00:00
|
|
|
sudo chown -R $USER: /usr/src/git
|
2021-12-22 13:51:22 +00:00
|
|
|
fi
|
2022-01-09 09:26:27 +00:00
|
|
|
cd -
|
2022-01-09 09:23:19 +00:00
|
|
|
cp "$ENVDIR"/dotfiles/.gitconfig $HOME/.gitconfig
|
2022-01-09 09:26:27 +00:00
|
|
|
git --version
|