diff options
author | Samruddhi Khandale <skhandale@microsoft.com> | 2022-10-18 20:55:55 +0300 |
---|---|---|
committer | Samruddhi Khandale <skhandale@microsoft.com> | 2022-10-18 20:55:55 +0300 |
commit | a94e01bf73f8faf5857ab4c1ac27db27f866745d (patch) | |
tree | 6df0ddfa041b4876d4eaf7b9028119ac0a27e0c2 | |
parent | 43f0b34aa308c1c0fa4257e5380b9076b0b8ea10 (diff) |
common-utils update
-rwxr-xr-x | src/common-utils/install.sh | 28 | ||||
-rwxr-xr-x | test/common-utils/test.sh | 7 |
2 files changed, 28 insertions, 7 deletions
diff --git a/src/common-utils/install.sh b/src/common-utils/install.sh index 2d51a0b..de2c469 100755 --- a/src/common-utils/install.sh +++ b/src/common-utils/install.sh @@ -112,8 +112,16 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then strace \ manpages \ manpages-dev \ - init-system-helpers" - + init-system-helpers \ + cmake \ + libz-dev \ + libssl-dev \ + libexpat1-dev \ + libcurl4-gnutls-dev \ + gettext \ + make \ + gcc" + # Needed for adding manpages-posix and manpages-posix-dev which are non-free packages in Debian if [ "${ADD_NON_FREE_PACKAGES}" = "true" ]; then # Bring in variables from /etc/os-release like VERSION_CODENAME @@ -155,11 +163,17 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then echo "Packages to verify are installed: ${package_list}" apt-get -y install --no-install-recommends ${package_list} 2> >( grep -v 'debconf: delaying package configuration, since apt-utils is not installed' >&2 ) - - # Install git if not already installed (may be more recent than distro version) - if ! type git > /dev/null 2>&1; then - apt-get -y install --no-install-recommends git - fi + + # Install latest version of git from source + git_version_list="$(curl -sSL -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/git/git/tags" | grep -oP '"name":\s*"v\K[0-9]+\.[0-9]+\.[0-9]+"' | tr -d '"' | sort -rV )" + GIT_VERSION="$(echo "${git_version_list}" | head -n 1)" + + echo "Installing git v${GIT_VERSION}" + curl -sL https://github.com/git/git/archive/v${GIT_VERSION}.tar.gz | tar -xzC /tmp 2>&1 + pushd /tmp/git-${GIT_VERSION} + make -s prefix=/usr/local all && make -s prefix=/usr/local install 2>&1 + popd + rm -rf /tmp/git-${GIT_VERSION} PACKAGES_ALREADY_INSTALLED="true" fi diff --git a/test/common-utils/test.sh b/test/common-utils/test.sh index 1282015..808f3e1 100755 --- a/test/common-utils/test.sh +++ b/test/common-utils/test.sh @@ -9,5 +9,12 @@ source dev-container-features-test-lib check "jq" jq --version check "curl" curl --version +git_version_satisfied=false +if (echo a version 2.38.1; git --version) | sort -Vk3 | tail -1 | grep -q git; then + git_version_satisfied=true +fi + +check "git version satisfies requirement" echo $git_version_satisfied | grep "true" + # Report result reportResults
\ No newline at end of file |