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(
|
await execPowershell(
|
||||||
`$USER_PATH=([Environment]::GetEnvironmentVariable("PATH", "User")); [Environment]::SetEnvironmentVariable("PATH", "${path};$USER_PATH", "User")`
|
`$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
|
return
|
||||||
}
|
}
|
||||||
case "linux":
|
case "linux":
|
||||||
case "darwin": {
|
case "darwin": {
|
||||||
setupCppInProfile()
|
setupCppInProfile()
|
||||||
appendFileSync(cpprc_path, `\nexport PATH=${path}:$PATH\n`)
|
appendFileSync(cpprc_path, `\nexport PATH="${path}:$PATH"\n`)
|
||||||
info(`${path} was added to "${cpprc_path}"`)
|
info(`"${path}" was added to "${cpprc_path}"`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { info } from "@actions/core"
|
||||||
import { warning } from "../io/io"
|
import { warning } from "../io/io"
|
||||||
import { isGitHubCI } from "../env/isCI"
|
import { isGitHubCI } from "../env/isCI"
|
||||||
import { addEnv, cpprc_path, setupCppInProfile } from "../env/addEnv"
|
import { addEnv, cpprc_path, setupCppInProfile } from "../env/addEnv"
|
||||||
import { appendFileSync } from "fs"
|
import { appendFileSync, existsSync } from "fs"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
|
|
||||||
let didUpdate: boolean = false
|
let didUpdate: boolean = false
|
||||||
|
@ -59,10 +59,6 @@ function getApt() {
|
||||||
let apt: string
|
let apt: string
|
||||||
if (which.sync("nala", { nothrow: true }) !== null) {
|
if (which.sync("nala", { nothrow: true }) !== null) {
|
||||||
apt = "nala"
|
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 {
|
} else {
|
||||||
apt = "apt-get"
|
apt = "apt-get"
|
||||||
}
|
}
|
||||||
|
@ -84,10 +80,30 @@ function initApt(apt: string) {
|
||||||
"ca-certificates",
|
"ca-certificates",
|
||||||
"gnupg",
|
"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 {
|
try {
|
||||||
execSudo("apt-key", ["adv", "--keyserver", "keyserver.ubuntu.com", "--recv-keys", "3B4FE6ACC0B21F32"])
|
if (!existsSync(`/root/.gnupg/${name}`)) {
|
||||||
execSudo("apt-key", ["adv", "--keyserver", "keyserver.ubuntu.com", "--recv-keys", "40976EAF437D05B5"])
|
for (const key of keys) {
|
||||||
execSudo("apt-key", ["adv", "--keyserver", "keyserver.ubuntu.com", "--recv-keys", "1E9377A2BA9EF27F"])
|
execSudo("gpg", [
|
||||||
|
"--no-default-keyring",
|
||||||
|
"--keyring",
|
||||||
|
name,
|
||||||
|
"--keyserver",
|
||||||
|
"keyserver.ubuntu.com",
|
||||||
|
"--recv-keys",
|
||||||
|
key,
|
||||||
|
])
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
warning(`Failed to add keys: ${err}`)
|
warning(`Failed to add keys: ${err}`)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue