mirror of https://github.com/aminya/setup-cpp
Merge pull request #110 from aminya/space-name [skip ci]
This commit is contained in:
commit
8fb789d7c1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -79,14 +79,14 @@ async function addPathSystem(path: string) {
|
|||
await execPowershell(
|
||||
`$USER_PATH=([Environment]::GetEnvironmentVariable("PATH", "User")); [Environment]::SetEnvironmentVariable("PATH", "${path};$USER_PATH", "User")`
|
||||
)
|
||||
info(`${path} was added to the PATH.`)
|
||||
info(`"${path}" was added to the PATH.`)
|
||||
return
|
||||
}
|
||||
case "linux":
|
||||
case "darwin": {
|
||||
setupCppInProfile()
|
||||
appendFileSync(cpprc_path, `\nexport PATH=${path}:$PATH\n`)
|
||||
info(`${path} was added to "${cpprc_path}"`)
|
||||
appendFileSync(cpprc_path, `\nexport PATH="${path}:$PATH"\n`)
|
||||
info(`"${path}" was added to "${cpprc_path}"`)
|
||||
return
|
||||
}
|
||||
default: {
|
||||
|
|
|
@ -5,7 +5,7 @@ import { info } from "@actions/core"
|
|||
import { warning } from "../io/io"
|
||||
import { isGitHubCI } from "../env/isCI"
|
||||
import { addEnv, cpprc_path, setupCppInProfile } from "../env/addEnv"
|
||||
import { appendFileSync } from "fs"
|
||||
import { appendFileSync, existsSync } from "fs"
|
||||
import which from "which"
|
||||
|
||||
let didUpdate: boolean = false
|
||||
|
@ -59,10 +59,6 @@ function getApt() {
|
|||
let apt: string
|
||||
if (which.sync("nala", { nothrow: true }) !== null) {
|
||||
apt = "nala"
|
||||
|
||||
// enable utf8 otherwise it fails because of the usage of ASCII encoding
|
||||
addEnv("LANG", "C.UTF-8")
|
||||
addEnv("LC_ALL", "C.UTF-8")
|
||||
} else {
|
||||
apt = "apt-get"
|
||||
}
|
||||
|
@ -84,10 +80,30 @@ function initApt(apt: string) {
|
|||
"ca-certificates",
|
||||
"gnupg",
|
||||
])
|
||||
addAptKey(["3B4FE6ACC0B21F32", "40976EAF437D05B5"], "setup-cpp-ubuntu-archive.gpg")
|
||||
addAptKey(["1E9377A2BA9EF27F"], "setup-cpp-launchpad-toolchain.gpg")
|
||||
if (apt === "nala") {
|
||||
// enable utf8 otherwise it fails because of the usage of ASCII encoding
|
||||
addEnv("LANG", "C.UTF-8")
|
||||
addEnv("LC_ALL", "C.UTF-8")
|
||||
}
|
||||
}
|
||||
|
||||
function addAptKey(keys: string[], name: string) {
|
||||
try {
|
||||
execSudo("apt-key", ["adv", "--keyserver", "keyserver.ubuntu.com", "--recv-keys", "3B4FE6ACC0B21F32"])
|
||||
execSudo("apt-key", ["adv", "--keyserver", "keyserver.ubuntu.com", "--recv-keys", "40976EAF437D05B5"])
|
||||
execSudo("apt-key", ["adv", "--keyserver", "keyserver.ubuntu.com", "--recv-keys", "1E9377A2BA9EF27F"])
|
||||
if (!existsSync(`/root/.gnupg/${name}`)) {
|
||||
for (const key of keys) {
|
||||
execSudo("gpg", [
|
||||
"--no-default-keyring",
|
||||
"--keyring",
|
||||
name,
|
||||
"--keyserver",
|
||||
"keyserver.ubuntu.com",
|
||||
"--recv-keys",
|
||||
key,
|
||||
])
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
warning(`Failed to add keys: ${err}`)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue