From 47a4df5252756d1eb5d1253343fedf67a8915cbd Mon Sep 17 00:00:00 2001 From: theofficialgman <28281419+theofficialgman@users.noreply.github.com> Date: Sun, 31 Dec 2023 16:52:18 -0500 Subject: [PATCH] api: wrap `adoptium_installer` around `add_external_repo` function --- api | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/api b/api index 2298fd824ea..68c6e25ec76 100755 --- a/api +++ b/api @@ -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 }