mirror of https://github.com/aminya/setup-cpp
fix: init gpg before adding the keys
This commit is contained in:
parent
fb111ffcf1
commit
9da09a7595
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
|
@ -88,9 +88,14 @@ async function initApt(apt: string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function initGpg() {
|
||||||
|
execSudo("gpg", ["-k"])
|
||||||
|
}
|
||||||
|
|
||||||
export function addAptKeyViaServer(keys: string[], name: string, server = "keyserver.ubuntu.com") {
|
export function addAptKeyViaServer(keys: string[], name: string, server = "keyserver.ubuntu.com") {
|
||||||
const fileName = `/etc/apt/trusted.gpg.d/${name}`
|
const fileName = `/etc/apt/trusted.gpg.d/${name}`
|
||||||
if (!existsSync(fileName)) {
|
if (!existsSync(fileName)) {
|
||||||
|
initGpg()
|
||||||
for (const key of keys) {
|
for (const key of keys) {
|
||||||
execSudo("gpg", [
|
execSudo("gpg", [
|
||||||
"--no-default-keyring",
|
"--no-default-keyring",
|
||||||
|
@ -110,6 +115,7 @@ export function addAptKeyViaServer(keys: string[], name: string, server = "keyse
|
||||||
export async function addAptKeyViaDownload(name: string, url: string) {
|
export async function addAptKeyViaDownload(name: string, url: string) {
|
||||||
const fileName = `/etc/apt/trusted.gpg.d/${name}`
|
const fileName = `/etc/apt/trusted.gpg.d/${name}`
|
||||||
if (!existsSync(fileName)) {
|
if (!existsSync(fileName)) {
|
||||||
|
initGpg()
|
||||||
await setupAptPack("curl", undefined)
|
await setupAptPack("curl", undefined)
|
||||||
execSudo("bash", ["-c", `curl -s ${url} | gpg --no-default-keyring --keyring gnupg-ring:${fileName} --import`])
|
execSudo("bash", ["-c", `curl -s ${url} | gpg --no-default-keyring --keyring gnupg-ring:${fileName} --import`])
|
||||||
execSudo("chmod", ["644", fileName])
|
execSudo("chmod", ["644", fileName])
|
||||||
|
|
Loading…
Reference in New Issue