mirror of https://github.com/aminya/setup-cpp
fix: use gpg instead of apt-key
This commit is contained in:
parent
2915ec8f01
commit
d195a02a1d
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
|
@ -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
|
||||||
|
@ -80,13 +80,8 @@ function initApt(apt: string) {
|
||||||
"ca-certificates",
|
"ca-certificates",
|
||||||
"gnupg",
|
"gnupg",
|
||||||
])
|
])
|
||||||
try {
|
addAptKey(["3B4FE6ACC0B21F32", "40976EAF437D05B5"], "setup-cpp-ubuntu-archive.gpg")
|
||||||
execSudo("apt-key", ["adv", "--keyserver", "keyserver.ubuntu.com", "--recv-keys", "3B4FE6ACC0B21F32"])
|
addAptKey(["1E9377A2BA9EF27F"], "setup-cpp-launchpad-toolchain.gpg")
|
||||||
execSudo("apt-key", ["adv", "--keyserver", "keyserver.ubuntu.com", "--recv-keys", "40976EAF437D05B5"])
|
|
||||||
execSudo("apt-key", ["adv", "--keyserver", "keyserver.ubuntu.com", "--recv-keys", "1E9377A2BA9EF27F"])
|
|
||||||
} catch (err) {
|
|
||||||
warning(`Failed to add keys: ${err}`)
|
|
||||||
}
|
|
||||||
if (apt === "nala") {
|
if (apt === "nala") {
|
||||||
// enable utf8 otherwise it fails because of the usage of ASCII encoding
|
// enable utf8 otherwise it fails because of the usage of ASCII encoding
|
||||||
addEnv("LANG", "C.UTF-8")
|
addEnv("LANG", "C.UTF-8")
|
||||||
|
@ -94,6 +89,26 @@ function initApt(apt: string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addAptKey(keys: string[], name: string) {
|
||||||
|
try {
|
||||||
|
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}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function updateAptAlternatives(name: string, path: string) {
|
export function updateAptAlternatives(name: string, path: string) {
|
||||||
if (isGitHubCI()) {
|
if (isGitHubCI()) {
|
||||||
return execSudo("update-alternatives", ["--install", `/usr/bin/${name}`, name, path, "40"])
|
return execSudo("update-alternatives", ["--install", `/usr/bin/${name}`, name, path, "40"])
|
||||||
|
|
Loading…
Reference in New Issue