Skip to content

Commit

Permalink
fix(install): Fixed bugs in Halyard Debian installtion scripts that b…
Browse files Browse the repository at this point in the history
…roke the repos, and also fixed the deprecation warnings for '--force-yes' when installing apt packages (#1965)
  • Loading branch information
ashleykleynhans authored Aug 23, 2022
1 parent 1fd610a commit 3be6bf1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -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%}
38 changes: 19 additions & 19 deletions halyard-deploy/src/main/resources/debian/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -57,45 +55,47 @@ 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() {
set +e
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
}
Expand Down

0 comments on commit 3be6bf1

Please sign in to comment.