Skip to content

Commit 50a814c

Browse files
committed
fix: install the default version if dnf version was incorrect
1 parent 1f049b0 commit 50a814c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/utils/setup/setupDnfPack.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable require-atomic-updates */
22
import { InstallationInfo } from "./setupBin"
33
import { execSudo } from "../exec/sudo"
4-
import { info } from "../io/io"
4+
import { info, warning } from "../io/io"
55

66
let didUpdate: boolean = false
77

@@ -17,7 +17,12 @@ export function setupDnfPack(name: string, version?: string): InstallationInfo {
1717
}
1818

1919
if (version !== undefined && version !== "") {
20-
execSudo(dnf, ["-y", "install", `${name}-${version}`])
20+
try {
21+
execSudo(dnf, ["-y", "install", `${name}-${version}`])
22+
} catch (err) {
23+
warning(`${(err as Error).toString()}\nInstalling the default version available via dnf`)
24+
execSudo(dnf, ["-y", "install", name])
25+
}
2126
} else {
2227
execSudo(dnf, ["-y", "install", name])
2328
}

0 commit comments

Comments
 (0)