Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ubuntu] Remove apt sources for Postgresql, Mongodb, Heroku #3091

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
function Get-PostgreSqlVersion {
$postgreSQLVersion = psql --version | Take-OutputPart -Part 2
return "Postgre SQL $postgreSQLVersion"
$aptSourceRepo = Get-AptSourceRepository -PackageName "postgresql"
return "Postgre SQL $postgreSQLVersion (apt source repository: $aptSourceRepo)"
}

function Get-MongoDbVersion {
$mongoDBVersion = mongod --version | Select-Object -First 1 | Take-OutputPart -Part 2 -Delimiter "v"
return "MongoDB $mongoDBVersion"
$aptSourceRepo = Get-AptSourceRepository -PackageName "mongodb"
return "MongoDB $mongoDBVersion (apt source repository: $aptSourceRepo)"
}

function Get-SqliteVersion {
Expand Down
7 changes: 7 additions & 0 deletions images/linux/scripts/helpers/SoftwareReport.Helpers.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,10 @@ function Get-CachedToolInstances
return $toolInstances
}

function Get-AptSourceRepository {
param([String] $PackageName)

$sourceUrl = Get-Content "$PSScriptRoot/../helpers/apt-sources.txt" | Select-String -Pattern $PackageName | Take-OutputPart -Part 1
return $sourceUrl
}

2 changes: 1 addition & 1 deletion images/linux/scripts/installers/heroku.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
################################################################################

# Install Heroku CLI
curl https://cli-assets.heroku.com/install-ubuntu.sh | sh
curl https://cli-assets.heroku.com/install.sh | sh

invoke_tests "Tools" "Heroku"
8 changes: 7 additions & 1 deletion images/linux/scripts/installers/mongodb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@
# Source the helpers
source $HELPER_SCRIPTS/os.sh

REPO_URL="https://repo.mongodb.org/apt/ubuntu"

# Install Mongo DB
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
version=$(getOSVersionLabel)
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu $version/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
echo "deb [ arch=amd64,arm64 ] $REPO_URL $version/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
sudo apt-get update
sudo apt-get install -y mongodb-org

rm /etc/apt/sources.list.d/mongodb-org-4.4.list

echo "mongodb $REPO_URL" >> $HELPER_SCRIPTS/apt-sources.txt

invoke_tests "Databases" "MongoDB"
8 changes: 7 additions & 1 deletion images/linux/scripts/installers/postgresql.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
## Desc: Installs Postgresql
################################################################################

REPO_URL="https://apt.postgresql.org/pub/repos/apt/"

#Preparing repo for PostgreSQL 12.
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
echo "deb https://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list
echo "deb $REPO_URL `lsb_release -cs`-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list

echo "Install PostgreSQL"
apt update
Expand All @@ -19,4 +21,8 @@ apt-get install libpq-dev
systemctl is-active --quiet postgresql.service && systemctl stop postgresql.service
systemctl disable postgresql.service

rm /etc/apt/sources.list.d/pgdg.list

echo "postgresql $REPO_URL" >> $HELPER_SCRIPTS/apt-sources.txt

invoke_tests "Databases" "PostgreSQL"