From d175b6ee3b0e90f885a6a22f99a15b37f0505c18 Mon Sep 17 00:00:00 2001 From: AnthonyAxenov Date: Sun, 9 Jan 2022 17:26:27 +0800 Subject: [PATCH] fix git.sh 2 --- install/010-git.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/install/010-git.sh b/install/010-git.sh index f9f2325..54f8d07 100755 --- a/install/010-git.sh +++ b/install/010-git.sh @@ -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 \ No newline at end of file +git --version