Skip to content

Commit 9da09a7

Browse files
committed
fix: init gpg before adding the keys
1 parent fb111ff commit 9da09a7

File tree

5 files changed

+10
-4
lines changed

5 files changed

+10
-4
lines changed

dist/setup_cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup_cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup_cpp.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

dist/setup_cpp.mjs.map

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/utils/setup/setupAptPack.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,14 @@ async function initApt(apt: string) {
8888
}
8989
}
9090

91+
function initGpg() {
92+
execSudo("gpg", ["-k"])
93+
}
94+
9195
export function addAptKeyViaServer(keys: string[], name: string, server = "keyserver.ubuntu.com") {
9296
const fileName = `/etc/apt/trusted.gpg.d/${name}`
9397
if (!existsSync(fileName)) {
98+
initGpg()
9499
for (const key of keys) {
95100
execSudo("gpg", [
96101
"--no-default-keyring",
@@ -110,6 +115,7 @@ export function addAptKeyViaServer(keys: string[], name: string, server = "keyse
110115
export async function addAptKeyViaDownload(name: string, url: string) {
111116
const fileName = `/etc/apt/trusted.gpg.d/${name}`
112117
if (!existsSync(fileName)) {
118+
initGpg()
113119
await setupAptPack("curl", undefined)
114120
execSudo("bash", ["-c", `curl -s ${url} | gpg --no-default-keyring --keyring gnupg-ring:${fileName} --import`])
115121
execSudo("chmod", ["644", fileName])

0 commit comments

Comments
 (0)