From 50a814c62d5200f7ccc419a71fc1565faec7e5ca Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sun, 10 Jul 2022 16:17:17 -0700 Subject: [PATCH] fix: install the default version if dnf version was incorrect --- src/utils/setup/setupDnfPack.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/utils/setup/setupDnfPack.ts b/src/utils/setup/setupDnfPack.ts index 08f0fb97..1fdf2f25 100644 --- a/src/utils/setup/setupDnfPack.ts +++ b/src/utils/setup/setupDnfPack.ts @@ -1,7 +1,7 @@ /* eslint-disable require-atomic-updates */ import { InstallationInfo } from "./setupBin" import { execSudo } from "../exec/sudo" -import { info } from "../io/io" +import { info, warning } from "../io/io" let didUpdate: boolean = false @@ -17,7 +17,12 @@ export function setupDnfPack(name: string, version?: string): InstallationInfo { } if (version !== undefined && version !== "") { - execSudo(dnf, ["-y", "install", `${name}-${version}`]) + try { + execSudo(dnf, ["-y", "install", `${name}-${version}`]) + } catch (err) { + warning(`${(err as Error).toString()}\nInstalling the default version available via dnf`) + execSudo(dnf, ["-y", "install", name]) + } } else { execSudo(dnf, ["-y", "install", name]) }