From 3be6bf1c16c96b075ddfce30679ad3e925903a8b Mon Sep 17 00:00:00 2001 From: Ashley Kleynhans Date: Tue, 23 Aug 2022 18:09:12 +0200 Subject: [PATCH] fix(install): Fixed bugs in Halyard Debian installtion scripts that broke the repos, and also fixed the deprecation warnings for '--force-yes' when installing apt packages (#1965) --- .../resources/debian/install-component.sh | 2 +- .../src/main/resources/debian/install.sh | 38 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/halyard-deploy/src/main/resources/debian/install-component.sh b/halyard-deploy/src/main/resources/debian/install-component.sh index 0238f91a66..5b75e0e83b 100644 --- a/halyard-deploy/src/main/resources/debian/install-component.sh +++ b/halyard-deploy/src/main/resources/debian/install-component.sh @@ -1 +1 @@ -apt-get install -y --force-yes --allow-unauthenticated spinnaker-{%artifact%}={%version%} +apt-get install -y --allow-unauthenticated --allow-downgrades --allow-remove-essential --allow-change-held-packages spinnaker-{%artifact%}={%version%} diff --git a/halyard-deploy/src/main/resources/debian/install.sh b/halyard-deploy/src/main/resources/debian/install.sh index b725734c74..e84727ed90 100644 --- a/halyard-deploy/src/main/resources/debian/install.sh +++ b/halyard-deploy/src/main/resources/debian/install.sh @@ -39,12 +39,10 @@ else DISTRO=$(uname -s) fi -# If not Ubuntu 14.xx.x or higher - if [ "$DISTRO" = "Ubuntu" ]; then if [ "${DISTRIB_RELEASE%%.*}" -lt "14" ]; then echo_err "Not a supported version of Ubuntu" - echo_err "Version is $DISTRIB_RELEASE we require 14.04" + echo_err "Version is $DISTRIB_RELEASE we require 14.04 or greater." exit 1 fi else @@ -57,25 +55,25 @@ else fi function add_redis_apt_repository() { - add-apt-repository -y ppa:chris-lea/redis-server + # Only Ubuntu prior to 18.04 LTS requires this PPA + if [ "${DISTRIB_RELEASE%%.*}" -lt "18" ]; then + echo "Adding Redis PPA repository for Ubuntu version less than 18.04" + add-apt-repository -y ppa:chris-lea/redis-server + fi } function add_spinnaker_apt_repository() { + echo "Adding Spinnaker apt repository" REPOSITORY_HOST=$(echo $REPOSITORY_URL | cut -d/ -f3) - if [[ "$REPOSITORY_HOST" == "dl.bintray.com" ]]; then - REPOSITORY_ORG=$(echo $REPOSITORY_URL | cut -d/ -f4) - # Personal repositories might not be signed, so conditionally check. - gpg="" - gpg=$(curl -s -f "https://bintray.com/user/downloadSubjectPublicKey?username=$REPOSITORY_ORG") || true - if [[ ! -z "$gpg" ]]; then - echo "$gpg" | apt-key add - - fi - fi - echo "deb $REPOSITORY_URL $DISTRIB_CODENAME spinnaker" | tee /etc/apt/sources.list.d/spinnaker.list > /dev/null + echo "deb [arch=all] $REPOSITORY_URL apt main" | tee /etc/apt/sources.list.d/spinnaker.list > /dev/null } function add_java_apt_repository() { - add-apt-repository -y ppa:openjdk-r/ppa + # Only Ubuntu prior to 18.04 LTS requires this PPA + if [ "${DISTRIB_RELEASE%%.*}" -lt "18" ]; then + echo "Adding Java PPA repository for Ubuntu version less than 18.04" + add-apt-repository -y ppa:openjdk-r/ppa + fi } function install_java() { @@ -83,19 +81,21 @@ function install_java() { local java_version=$(java -version 2>&1 head -1) set -e - if [[ "$java_version" == *1.8* ]]; then - echo "Java is already installed & at the right version" + if [[ "$java_version" == *11.0* ]]; then + echo "Java dependency is already installed" return 0; fi - apt-get install -y --force-yes unzip - apt-get install -y --force-yes openjdk-8-jdk + echo "Installing Java" + apt-get install -y --allow-downgrades --allow-remove-essential --allow-change-held-packages unzip + apt-get install -y --allow-downgrades --allow-remove-essential --allow-change-held-packages openjdk-11-jre-headless # https://bugs.launchpad.net/ubuntu/+source/ca-certificates-java/+bug/983302 # It seems a circular dependency was introduced on 2016-04-22 with an openjdk-8 release, where # the JRE relies on the ca-certificates-java package, which itself relies on the JRE. # This causes the /etc/ssl/certs/java/cacerts file to never be generated, causing a startup # failure in Clouddriver. + echo "Reinstalling Java CA certificates" dpkg --purge --force-depends ca-certificates-java apt-get install ca-certificates-java }