my-env/install/git

39 lines
1.0 KiB
Plaintext
Raw Normal View History

#!/bin/bash
##makedesc: Install git (latest)
2023-04-14 04:06:40 +00:00
source `dirname $0`/../helpers || exit 255
2023-04-14 04:06:40 +00:00
title
2023-04-14 04:06:40 +00:00
require make
2022-01-09 09:23:19 +00:00
2022-01-08 06:17:50 +00:00
if installed git; then
2023-04-14 04:06:40 +00:00
if [ -d "$HOME/install/git" ]; then
cd "$HOME/install/git" && \
2022-07-05 09:05:34 +00:00
git pull
else
2023-04-14 04:06:40 +00:00
clone "https://github.com/git/git.git" "$HOME/install/git" --depth=1 --single-branch && \
cd "$HOME/install/git"
2022-07-05 09:05:34 +00:00
fi
sudo make prefix=/usr/local all && \
sudo make prefix=/usr/local install
else
2023-04-14 04:06:40 +00:00
require wget
mkdir -p "$HOME/install/git"
download "https://github.com/git/git/archive/master.zip" "/tmp/git.zip" && \
unzip -oq "/tmp/git.zip" -d "$HOME/install/git" && \
2022-07-05 09:05:34 +00:00
rm /tmp/git.zip && \
2023-04-14 04:06:40 +00:00
cd "$HOME/install/git/git-master" && \
2022-07-05 09:05:34 +00:00
sudo make prefix=/usr/local all && \
sudo make prefix=/usr/local install && \
cd - && \
rm -rf git && \
2023-04-14 04:06:40 +00:00
clone "https://github.com/git/git.git" "$HOME/install/git" --depth=1 --single-branch
fi
2023-04-14 04:06:40 +00:00
[ $? = 0 ] && {
echo
success "git installed!"
git --version
echo
}