feat: install bash for alpine

This commit is contained in:
Amin Yahyaabadi 2025-03-23 01:40:17 -07:00
parent 3108fdcf8d
commit 5a0bbafcb2
7 changed files with 32 additions and 4 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

View File

@ -1,5 +1,6 @@
export * from "./apk-repository.js"
export * from "./has-apk.js"
export * from "./init-apt.js"
export * from "./install-package.js"
export * from "./qualify-install.js"
export * from "./update.js"

View File

@ -0,0 +1,23 @@
import { defaultExecOptions, execRootSync } from "admina"
import memoize from "memoizee"
import { filterAndQualifyApkPackages } from "./qualify-install.js"
import { updateApkMemoized } from "./update.js"
/** Install bash (usually missing from docker containers) */
export async function initApk() {
// Update the repos
await updateApkMemoized()
const toInstall = await filterAndQualifyApkPackages([
{ name: "bash" },
])
if (toInstall.length !== 0) {
execRootSync("apk", ["add", ...toInstall], {
...defaultExecOptions,
})
}
}
/** Install bash (usually missing from docker containers) (memoized) */
export const initApkMemoized = memoize(initApk, { promise: true })

View File

@ -1,6 +1,7 @@
import { execRoot } from "admina"
import { info, warning } from "ci-log"
import { hasApk } from "./has-apk.js"
import { initApkMemoized } from "./init-apt.js"
import { type ApkPackage, filterAndQualifyApkPackages, formatPackageWithVersion } from "./qualify-install.js"
import { updateApkMemoized } from "./update.js"
@ -38,6 +39,9 @@ export async function installApkPackage(packages: ApkPackage[], update = false):
// Update the repos if needed
await updateApkMemoized()
// init the apk
await initApkMemoized()
const packagesToInstall = await filterAndQualifyApkPackages(packages)
if (packagesToInstall.length === 0) {