mirror of https://github.com/aminya/setup-cpp
fix: do not pani on addAptKey server errors
This commit is contained in:
parent
201ecd0a36
commit
67a5cc536b
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
|
@ -123,26 +123,31 @@ function initGpg() {
|
|||
}
|
||||
|
||||
export async function addAptKeyViaServer(keys: string[], name: string, server = "keyserver.ubuntu.com") {
|
||||
const fileName = `/etc/apt/trusted.gpg.d/${name}`
|
||||
if (!(await pathExists(fileName))) {
|
||||
initGpg()
|
||||
try {
|
||||
const fileName = `/etc/apt/trusted.gpg.d/${name}`
|
||||
if (!(await pathExists(fileName))) {
|
||||
initGpg()
|
||||
|
||||
await Promise.all(
|
||||
keys.map(async (key) => {
|
||||
await execRoot("gpg", [
|
||||
"--no-default-keyring",
|
||||
"--keyring",
|
||||
`gnupg-ring:${fileName}`,
|
||||
"--keyserver",
|
||||
server,
|
||||
"--recv-keys",
|
||||
key,
|
||||
])
|
||||
await execRoot("chmod", ["644", fileName])
|
||||
})
|
||||
)
|
||||
await Promise.all(
|
||||
keys.map(async (key) => {
|
||||
await execRoot("gpg", [
|
||||
"--no-default-keyring",
|
||||
"--keyring",
|
||||
`gnupg-ring:${fileName}`,
|
||||
"--keyserver",
|
||||
server,
|
||||
"--recv-keys",
|
||||
key,
|
||||
])
|
||||
await execRoot("chmod", ["644", fileName])
|
||||
})
|
||||
)
|
||||
}
|
||||
return fileName
|
||||
} catch (err) {
|
||||
warning(`Failed to add apt key via server ${server}: ${err}`)
|
||||
return undefined
|
||||
}
|
||||
return fileName
|
||||
}
|
||||
|
||||
export async function addAptKeyViaDownload(name: string, url: string) {
|
||||
|
|
Loading…
Reference in New Issue