From e897f5975c7c279a56d2809f4e8e1ad25f80b918 Mon Sep 17 00:00:00 2001 From: Justin Kolberg Date: Fri, 25 Oct 2024 12:45:22 -0700 Subject: [PATCH] use repo_id for url replacement Signed-off-by: Justin Kolberg --- install-script/install.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/install-script/install.sh b/install-script/install.sh index 53e0b961..420e3da1 100755 --- a/install-script/install.sh +++ b/install-script/install.sh @@ -971,21 +971,29 @@ function install_linux_package() { yum | dnf) curl -s "${base_url}/script.rpm.sh" | bash # Change packagecloud.io to packages.sumologic.com in the repo's configuration - sed -i 's/packagecloud.io/packages.sumologic.com/g' /etc/yum.repos.d/sumologic_stable.repo + sed -i 's/packagecloud.io/packages.sumologic.com/g' /etc/yum.repos.d/${repo_id}.repo yum --quiet --disablerepo="*" --enablerepo="${repo_id}" -y update - yum install --quiet -y "${package_name}-${VERSION}" - ;; - apt-get) + local package_str package_str="${package_name}" if [[ -n "${VERSION}" ]]; then - package_str="${package_str}=${VERSION}" + package_str="${package_str}-${VERSION}" fi echo "Installing ${package_str}" + yum install --quiet -y "${package_str}" + ;; + apt-get) curl -s "${base_url}/script.deb.sh" | bash # Change packagecloud.io to packages.sumologic.com in the repo's configuration - sed -i 's/packagecloud.io/packages.sumologic.com/g' /etc/apt/sources.list.d/sumologic_stable.list + sed -i 's/packagecloud.io/packages.sumologic.com/g' /etc/apt/sources.list.d/${repo_id}.list apt-get update --quiet -y -o Dir::Etc::sourcelist="sources.list.d/${repo_id}" + + local package_str + package_str="${package_name}" + if [[ -n "${VERSION}" ]]; then + package_str="${package_str}=${VERSION}" + fi + echo "Installing ${package_str}" apt-get install --quiet -y "${package_str}" ;; esac