fix git.sh 2
This commit is contained in:
parent
7f8f9ddc27
commit
d175b6ee3b
@ -1,24 +1,29 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
echo
|
echo
|
||||||
echo "==============================================="
|
echo "==============================================="
|
||||||
echo "Installing git..."
|
echo "Installing git (latest)..."
|
||||||
echo "==============================================="
|
echo "==============================================="
|
||||||
echo
|
echo
|
||||||
|
|
||||||
installed() {
|
installed() {
|
||||||
command -v "$1" >/dev/null 2>&1
|
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
|
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
|
sudo chown -R $USER: /usr/src/git
|
||||||
cd /usr/src/git/
|
cd /usr/src/git/
|
||||||
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
|
||||||
sudo wget https://github.com/git/git/archive/master.zip -O /usr/src/git.zip
|
wget https://github.com/git/git/archive/master.zip -O /tmp/git.zip
|
||||||
sudo unzip /usr/src/git.zip -d /usr/src/git
|
sudo unzip -q /tmp/git.zip -d /usr/src/git
|
||||||
sudo rm -f /usr/src/git.zip
|
rm /tmp/git.zip
|
||||||
cd /usr/src/git/git-master
|
cd /usr/src/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
|
||||||
@ -27,6 +32,6 @@ else
|
|||||||
sudo git clone https://github.com/git/git.git --depth=1 /usr/src/git
|
sudo git clone https://github.com/git/git.git --depth=1 /usr/src/git
|
||||||
sudo chown -R $USER: /usr/src/git
|
sudo chown -R $USER: /usr/src/git
|
||||||
fi
|
fi
|
||||||
ENVDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
cd -
|
||||||
cp "$ENVDIR"/dotfiles/.gitconfig $HOME/.gitconfig
|
cp "$ENVDIR"/dotfiles/.gitconfig $HOME/.gitconfig
|
||||||
git --version
|
git --version
|
||||||
|
Loading…
Reference in New Issue
Block a user