[Ubuntu] Rework Git installation to avoid using apt repo (#3095)

* rework git installation

* simplify git installation

* minor fix

* document source repo's

* small fix

* debug
This commit is contained in:
Dibir Magomedsaygitov
2021-04-09 11:57:40 +03:00
committed by GitHub
parent fbcc41275b
commit d1de678b65
2 changed files with 18 additions and 5 deletions

View File

@@ -78,13 +78,15 @@ function Get-DockerBuildxVersion {
function Get-GitVersion {
$result = Get-CommandResult "git --version"
$gitVersion = $result.Output | Take-OutputPart -Part 2
return "Git $gitVersion"
$aptSourceRepo = Get-AptSourceRepository -PackageName "git-core"
return "Git $gitVersion (apt source repository: $aptSourceRepo)"
}
function Get-GitLFSVersion {
$result = Get-CommandResult "git-lfs --version"
$gitlfsversion = $result.Output | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/"
return "Git LFS $gitlfsversion"
$aptSourceRepo = Get-AptSourceRepository -PackageName "git-lfs"
return "Git LFS $gitlfsversion (apt source repository: $aptSourceRepo)"
}
function Get-GitFTPVersion {

View File

@@ -7,19 +7,30 @@
# Source the helpers for use with the script
source $HELPER_SCRIPTS/install.sh
GIT_REPO="ppa:git-core/ppa"
GIT_LFS_REPO="https://packagecloud.io/install/repositories/github/git-lfs"
## Install git
add-apt-repository ppa:git-core/ppa -y
add-apt-repository $GIT_REPO -y
apt-get update
apt-get install git -y
git --version
# Install git-lfs
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
apt-get install -y --no-install-recommends git-lfs
curl -s $GIT_LFS_REPO/script.deb.sh | bash
apt-get install -y git-lfs
# Install git-ftp
apt-get install git-ftp -y
# Remove source repo's
add-apt-repository --remove $GIT_REPO
rm /etc/apt/sources.list.d/github_git-lfs.list
# Document apt source repo's
echo "git-core $GIT_REPO" >> $HELPER_SCRIPTS/apt-sources.txt
echo "git-lfs $GIT_LFS_REPO" >> $HELPER_SCRIPTS/apt-sources.txt
#Install hub
tmp_hub="/tmp/hub"
mkdir -p "$tmp_hub"