fix: install ca-certificates before downloading

This commit is contained in:
Amin Yahyaabadi 2024-08-19 01:18:00 -07:00
parent ee265991bc
commit 8a5b753ad5
No known key found for this signature in database
GPG Key ID: F52AF77F636088F0
9 changed files with 17 additions and 12 deletions

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -3,6 +3,7 @@ import { execRoot, execRootSync } from "admina"
import { warning } from "ci-log"
import { DownloaderHelper } from "node-downloader-helper"
import { pathExists } from "path-exists"
import { installAptPack } from "./install.js"
function initGpg() {
execRootSync("gpg", ["-k"])
@ -54,6 +55,7 @@ export async function addAptKeyViaDownload(name: string, url: string) {
if (!(await pathExists(fileName))) {
initGpg()
await installAptPack([{ name: "ca-certificates" }])
const dl = new DownloaderHelper(url, tmpdir(), { fileName: name })
dl.on("error", (err) => {
throw new Error(`Failed to download ${url}: ${err}`)

View File

@ -3,6 +3,7 @@ import { addPath } from "envosman"
import { execaSync } from "execa"
import { DownloaderHelper } from "node-downloader-helper"
import { dirname } from "patha"
import { installAptPack } from "setup-apt"
import which from "which"
import { rcOptions } from "../cli-options.js"
@ -29,6 +30,7 @@ export async function setupBrew(_version: string, _setupDir: string, _arch: stri
}
// download the installation script
await installAptPack([{ name: "ca-certificates" }])
const dl = new DownloaderHelper("https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh", tmpdir(), {
fileName: "install-brew.sh",
})

View File

@ -24,6 +24,7 @@ export async function setupLLVMApt(
const installationFolder = `/usr/lib/llvm-${majorVersion}`
// download the installation script
await installAptPack([{ name: "ca-certificates" }])
const dl = new DownloaderHelper("https://apt.llvm.org/llvm.sh", tmpdir(), { fileName: "llvm.sh" })
dl.on("error", (err) => {
throw new Error(`Failed to download the LLVM installer script: ${err}`)