mirror of https://github.com/aminya/setup-cpp
feat: support installing packages using dnf
This commit is contained in:
parent
45e4fd60f0
commit
1f049b017f
|
@ -0,0 +1,14 @@
|
|||
import which from "which"
|
||||
|
||||
let hasDnfCache: undefined | boolean = undefined
|
||||
|
||||
export function hasDnf(): boolean {
|
||||
if (process.platform !== "linux") {
|
||||
return false
|
||||
}
|
||||
if (hasDnfCache === undefined) {
|
||||
hasDnfCache = which.sync("dnf", { nothrow: true }) !== null
|
||||
}
|
||||
|
||||
return hasDnfCache
|
||||
}
|
|
@ -29,9 +29,6 @@ export function setupAptPack(
|
|||
|
||||
if (!didInit) {
|
||||
// install apt utils and certificates (usually missing from docker containers)
|
||||
// set time - zone
|
||||
// TZ = Canada / Pacific
|
||||
// ln - snf / usr / share / zoneinfo / $TZ / etc / localtime && echo $TZ > /etc/timezone
|
||||
execSudo(apt, [
|
||||
"install",
|
||||
"--fix-broken",
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
/* eslint-disable require-atomic-updates */
|
||||
import { InstallationInfo } from "./setupBin"
|
||||
import { execSudo } from "../exec/sudo"
|
||||
import { info } from "../io/io"
|
||||
|
||||
let didUpdate: boolean = false
|
||||
|
||||
/** A function that installs a package using dnf */
|
||||
export function setupDnfPack(name: string, version?: string): InstallationInfo {
|
||||
info(`Installing ${name} ${version ?? ""} via dnf`)
|
||||
|
||||
const dnf = "dnf"
|
||||
|
||||
if (!didUpdate) {
|
||||
execSudo(dnf, ["-y", "check-update"])
|
||||
didUpdate = true
|
||||
}
|
||||
|
||||
if (version !== undefined && version !== "") {
|
||||
execSudo(dnf, ["-y", "install", `${name}-${version}`])
|
||||
} else {
|
||||
execSudo(dnf, ["-y", "install", name])
|
||||
}
|
||||
|
||||
return { binDir: "/usr/bin/" }
|
||||
}
|
|
@ -18,10 +18,6 @@ export function setupPacmanPack(name: string, version?: string, aur?: string): I
|
|||
}
|
||||
|
||||
if (!didInit) {
|
||||
// set time - zone
|
||||
// TZ = Canada / Pacific
|
||||
// ln - snf / usr / share / zoneinfo / $TZ / etc / localtime && echo $TZ > /etc/timezone
|
||||
|
||||
// install base-devel
|
||||
execSudo(pacman, ["-Sy", "--noconfirm", "base-devel"])
|
||||
didInit = true
|
||||
|
|
Loading…
Reference in New Issue