fix git.sh 2

This commit is contained in:
Anthony Axenov 2022-01-09 17:26:27 +08:00
parent 7f8f9ddc27
commit d175b6ee3b
Signed by: anthony
GPG Key ID: EA9EC32FF7CCD4EC

View File

@ -1,24 +1,29 @@
#!/bin/bash
echo
echo "==============================================="
echo "Installing git..."
echo "Installing git (latest)..."
echo "==============================================="
echo
installed() {
command -v "$1" >/dev/null 2>&1
}
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
if installed git; then
[ ! -d "/usr/src/git" ] && sudo git clone https://github.com/git/git.git --depth=1 /usr/src/git
sudo rm -rf /usr/src/git
sudo git clone https://github.com/git/git.git --depth=1 /usr/src/git
sudo chown -R $USER: /usr/src/git
cd /usr/src/git/
sudo make prefix=/usr/local all
sudo make prefix=/usr/local install
else
sudo wget https://github.com/git/git/archive/master.zip -O /usr/src/git.zip
sudo unzip /usr/src/git.zip -d /usr/src/git
sudo rm -f /usr/src/git.zip
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
cd /usr/src/git/git-master
sudo make prefix=/usr/local all
sudo make prefix=/usr/local install
@ -27,6 +32,6 @@ else
sudo git clone https://github.com/git/git.git --depth=1 /usr/src/git
sudo chown -R $USER: /usr/src/git
fi
ENVDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd -
cp "$ENVDIR"/dotfiles/.gitconfig $HOME/.gitconfig
git --version