Skip to content

Commit

Permalink
api: wrap adoptium_installer around add_external_repo function
Browse files Browse the repository at this point in the history
  • Loading branch information
theofficialgman committed Dec 31, 2023
1 parent b290182 commit 47a4df5
Showing 1 changed file with 3 additions and 20 deletions.
23 changes: 3 additions & 20 deletions api
Original file line number Diff line number Diff line change
Expand Up @@ -779,36 +779,19 @@ debian_ppa_installer() { #setup a PPA on a Debian distro. Arguments: ppa_name di
}

adoptium_installer() {
status "Adding Adoptium repository:"

echo "- downloading public key"
rm -f /tmp/adoptium-public-key
wget -O /tmp/adoptium-public-key https://adoptium.jfrog.io/artifactory/api/security/keypair/default-gpg-key/public || error "Failed to download adoptium public key"

echo " - storing binary format public key in /usr/share/keyrings"
# the dearmor command converts arbitrary input (OpenPGP ASCII armor or binary format) into binary format
cat /tmp/adoptium-public-key | gpg --dearmor | sudo tee /usr/share/keyrings/adoptium-archive-keyring.gpg >/dev/null
rm -f /tmp/adoptium-public-key

echo " - Creating /etc/apt/sources.list.d/adoptium.list"
case "$__os_codename" in
bionic | focal | jammy | buster | bullseye | bookworm)
echo "deb [signed-by=/usr/share/keyrings/adoptium-archive-keyring.gpg] https://adoptium.jfrog.io/artifactory/deb $__os_codename main" | sudo tee /etc/apt/sources.list.d/adoptium.list >/dev/null
add_external_repo "adoptium" "https://adoptium.jfrog.io/artifactory/deb $__os_codename main" "https://adoptium.jfrog.io/artifactory/api/security/keypair/default-gpg-key/public" || exit 1
;;
*)
# use bionic target name explicitly for any other OS as its the oldest LTS target adoptium continues to support
# all supported adoptium OSs use the same debs so the target specified does not actually matter
echo "deb [signed-by=/usr/share/keyrings/adoptium-archive-keyring.gpg] https://adoptium.jfrog.io/artifactory/deb bionic main" | sudo tee /etc/apt/sources.list.d/adoptium.list >/dev/null
add_external_repo "adoptium" "https://adoptium.jfrog.io/artifactory/deb bionic main" "https://adoptium.jfrog.io/artifactory/api/security/keypair/default-gpg-key/public" || exit 1
;;
esac
apt_update
if [ $? != 0 ]; then
anything_installed_from_repo "https://adoptium.jfrog.io/artifactory/deb"
if [ $? != 0 ]; then
# nothing installed from repo, this check is to prevent removing repos which other pi-apps scripts or the user have used successfully
# safe to remove
sudo rm -f /etc/apt/sources.list.d/adoptium.list /usr/share/keyrings/adoptium-archive-keyring.gpg
fi
rm_external_repo "adoptium"
error "Failed to perform apt update after adding Adoptium repository."
fi
}
Expand Down

0 comments on commit 47a4df5

Please sign in to comment.