2018-06-13 20:12:52 +02:00
|
|
|
#!/usr/bin/env bash
|
2018-04-13 20:56:49 +02:00
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
|
|
|
if ! command -v curl &> /dev/null; then
|
|
|
|
echo >&2 'error: "curl" not found!'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! command -v tar &> /dev/null; then
|
|
|
|
echo >&2 'error: "tar" not found!'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-08-08 20:45:36 +02:00
|
|
|
if [[ -z "${GIT_VERSION}" ]]; then
|
2018-04-13 20:56:49 +02:00
|
|
|
echo >&2 'error: GIT_VERSION env. variable must be set to a non-empty value'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
(cat /etc/ld.so.conf.d/usr-local.conf 2> /dev/null | grep -q "^/usr/local/lib$") ||
|
|
|
|
echo '/usr/local/lib' >> /etc/ld.so.conf.d/usr-local.conf
|
|
|
|
ldconfig
|
|
|
|
|
|
|
|
cd /usr/src
|
|
|
|
|
2019-11-20 16:07:24 +01:00
|
|
|
url="https://mirrors.edge.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.gz"
|
2018-04-13 20:56:49 +02:00
|
|
|
echo "Downloading $url"
|
2021-08-06 01:17:47 +02:00
|
|
|
curl --connect-timeout 20 \
|
|
|
|
--max-time 10 \
|
|
|
|
--retry 5 \
|
|
|
|
--retry-delay 10 \
|
|
|
|
--retry-max-time 40 \
|
|
|
|
-# -LO $url
|
2018-04-13 20:56:49 +02:00
|
|
|
|
2021-08-08 20:45:36 +02:00
|
|
|
tar xvzf "git-${GIT_VERSION}.tar.gz" --no-same-owner
|
|
|
|
rm -f "git-${GIT_VERSION}.tar.gz"
|
2018-04-13 20:56:49 +02:00
|
|
|
|
2021-08-08 20:45:36 +02:00
|
|
|
pushd "git-${GIT_VERSION}"
|
2018-04-13 20:56:49 +02:00
|
|
|
./configure --prefix=/usr/local --with-curl
|
2021-08-08 20:45:36 +02:00
|
|
|
make -j"$(nproc)"
|
2018-04-13 20:56:49 +02:00
|
|
|
make install
|
|
|
|
popd
|
|
|
|
|
|
|
|
ldconfig
|
|
|
|
|
2021-08-08 20:45:36 +02:00
|
|
|
rm -rf "git-${GIT_VERSION}"
|
2018-04-13 20:56:49 +02:00
|
|
|
|
|
|
|
# turn the detached message off
|
|
|
|
git config --global advice.detachedHead false
|