Setup apt packages and repositories in Debian/Ubuntu-based distributions
npm install setup-apt> Setup apt packages and repositories in Debian/Ubuntu-based distributions
``sh`
npm install --save setup-apt
Update the alternatives for a package
Parameters:
- name (string) - The name of the packagestring
- path () - The path to the binarynumber
- priority () - The priority of the alternative (Defaults to 40)
returns: Promise
Add the update-alternatives command to the rc file
Parameters:
- name (string) - The name of the packagestring
- path () - The path to the binaryRcOptions
- rcOptions () - The options for the rc file to add the update-alternatives command tonumber
- priority () - The priority of the alternative (Defaults to 40)
returns: Promise
Get the environment variables to use for the apt command
Parameters:
- apt (string) - The apt command to use
returns: ProcessEnv
The timeout to use for apt commands
Wait up to 300 seconds if the apt-get lock is held
Check if nala is installed
returns: boolean
Get the apt command to use
If nala is installed, use that, otherwise use apt-get
returns: string
Check if a package is installed
Parameters:
- pack (string) - The package to check
returns: Promise
Check if a package matching a regexp is installed
Parameters:
- regexp (string) - The regexp to check
returns: Promise
Update the apt repositories
Parameters:
- apt (string) - The apt command to use (optional)
returns: void
Update the apt repositories (memoized)
Parameters:
- apt - The apt command to use (optional)
Filter out the packages that are already installed and qualify the packages into a full package name/version
Parameters:
- packages (AptPackage[])string
- apt ()
returns: Promise
Qualify the package into full package name/version.
If the package is not installed, return the full package name/version.
If the package is already installed, return undefined
Parameters:
- pack (AptPackage)string
- apt ()
returns: Promise
Install gnupg and certificates (usually missing from docker containers)
Parameters:
- apt (string)
returns: Promise
Install gnupg and certificates (usually missing from docker containers) (memoized)
Parameters:
- repo (string)string
- apt ()
returns: Promise
Parameters:
- apt (string)
returns: Promise
The information about an installation result
The information about an apt package
Install a package using apt
Parameters:
- packages (AptPackage[]) - The packages to install (name, and optional info like version and repositories)boolean
- update () - Whether to update the package list before installing (Defaults to false)
returns: Promise
`ts`
await installAptPack([{ name: "ca-certificates" }, { name: "gnupg" }])
`ts`
await installAptPack([
{
name: "gcc",
version,
repository: "ppa:ubuntu-toolchain-r/test",
key: { key: "1E9377A2BA9EF27F", fileName: "ubuntu-toolchain-r-test.gpg" },
},
])
Add an apt key
Parameters:
- options (AddAptKeyOptions) - The options for adding the key
returns: Promise
`ts`
await addAptKey({ key: "3B4FE6ACC0B21F32" fileName: "bazel-archive-keyring.gpg"})
`ts`
await addAptKey({
keyUrl: "https://bazel.build/bazel-release.pub.gpg",
fileName: "bazel-archive-keyring.gpg",
})
Add an apt key via a keyserver
Parameters:
- { key, keyServer = defaultKeyServer, fileName, keyStorePath = defaultKeyServer } (KeyServerOptions)
returns: Promise
Add an apt key via a download
Parameters:
- options - The options for adding the key
- { keyUrl, fileName, keyStorePath = defaultKeyStorePath } (KeyUrl`)
returns: Promise
You can sponsor my work here:
https://github.com/sponsors/aminya
Pull requests, issues and feature requests are welcome.
See the Contributing guide.