Skip to content

Package Manager Tools

🛠️ Tools · ⬅ Top


Wrapper around:

Package names change between platforms. Use packageGroupInstall for generic cross-platform names.

Conditional installation

packageWhich

Install tools using apt-get if they are not found

Usage

packageWhich binary packageInstallPackage ...

Installs an apt package if a binary does not exist in the which path. The assumption here is that packageInstallPackage will install the desired binary.

Confirms that binary is installed after installation succeeds.

Arguments

  • --manager packageManager - Optional. String. Package manager to use. (apk, apt, brew)
  • binary - Required. String. The binary to look for
  • packageName ... - Optional. String. The package name to install if the binary is not found in the $PATH. If not supplied uses the same name as the binary.

Examples

packageWhich shellcheck shellcheck
packageWhich mariadb mariadb-client

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Environment

  • Technically this will install the binary and any related files as a package.

packageWhichUninstall

Install tools using apt-get if they are not found

Usage

packageWhichUninstall binary packageInstallPackage ...

Installs an apt package if a binary does not exist in the which path (e.g. $PATH) The assumption here is that packageUninstall will install the desired binary.

Confirms that binary is installed after installation succeeds.

Arguments

  • --manager packageManager - Optional. String. Package manager to use. (apk, apt, brew)
  • binary - Required. String. The binary to look for.
  • packageInstallPackage - Required. String. The package name to uninstall if the binary is found in the $PATH.

Examples

packageWhichUninstall shellcheck shellcheck
packageWhichUninstall mariadb mariadb-client

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Environment

  • Technically this will uninstall the binary and any related files as a package.

Package management

packageUpdate

Update packages lists and sources

Usage

packageUpdate [ --help ] [ --verbose ] [ --manager packageManager ] [ --force ]

Update packages lists and sources

Arguments

  • --help - Optional. Flag. Display this help.
  • --verbose - Optional. Flag. Display progress to the terminal.
  • --manager packageManager - Optional. String. Package manager to use. (apk, apt, brew)
  • --force - Optional. Flag. Force even if it was updated recently.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

packageUpgrade

Upgrade packages lists and sources

Usage

packageUpgrade [ --help ] [ --manager packageManager ] [ --force ] ...

Upgrade packages lists and sources

Arguments

  • --help - Optional. Flag. Display this help.
  • --verbose - Optional. Flag. Display progress to the terminal.
  • --manager packageManager - Optional. String. Package manager to use. (apk, apt, brew)
  • --force - Optional. Flag. Force even if it was updated recently.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

packageInstall

Install packages using a package manager

Usage

packageInstall [ package ... ]

Install packages using a package manager.

Supported managers: - apk - apt-get - brew

Return Code: 0 - If apk is not installed, returns 0. Return Code: 1 - If apk fails to install the packages

Arguments

  • package - One or more packages to install
  • --verbose - Optional. Flag. Display progress to the terminal.
  • --manager packageManager - Optional. String. Package manager to use. (apk, apt, brew)
  • --force - Optional. Flag. Force even if it was updated recently.
  • --show-log - Optional. Flag. Show package manager logs.

Examples

packageInstall shellcheck

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

packageUninstall

Removes packages using package manager

Usage

packageUninstall [ package ... ]

Removes packages using the current package manager.

Arguments

  • package - String. Required. One or more packages to uninstall
  • --manager packageManager - Optional. String. Package manager to use. (apk, apt, brew)

Examples

packageUninstall shellcheck

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Package groups

A package group represents software which often is installed using different package manager names.

packageGroupWhich

Install a package group to have a binary installed

Usage

packageGroupWhich binary group

Install a package group to have a binary installed Any unrecognized groups are installed using the name as-is.

Arguments

  • binary - String. Required. Binary which will exist in PATH after group is installed if it does not exist.
  • group - String. Required. Package group.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

packageGroupInstall

Install a package group

Usage

packageGroupInstall group

Install a package group Any unrecognized groups are installed using the name as-is.

Arguments

  • group - String. Required. Currently allowed: "python"

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

packageGroupUninstall

Uninstall a package group

Usage

packageGroupUninstall group

Uninstall a package group Any unrecognized groups are uninstalled using the name as-is.

Arguments

  • group - String. Required. Currently allowed: "python"

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

packageMapping

undocumented

Usage

packageMapping [ packageName ] [ --manager packageManager ]

No documentation for packageMapping.

Arguments

  • packageName - A simple package name which will be expanded to specific platform or package-manager specific package names
  • --manager packageManager - Optional. String. Package manager to use. (apk, apt, brew)

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Package lists

packageDefault

Fetch the binary name for the default package in a

Usage

packageDefault

Fetch the binary name for the default package in a group Groups are: - mysql - mysqldump

Arguments

  • none

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

packageIsInstalled

Is a package installed?

Usage

packageIsInstalled [ package ... ]

Is a package installed? Return Code: 1 - If any packages are not installed Return Code: 0 - All packages are installed

Arguments

  • package - String. Required. One or more packages to check if they are installed

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

packageInstalledList

List installed packages on this system using package manager

Usage

packageInstalledList

List installed packages on this system using package manager

Arguments

  • none

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

packageAvailableList

List installed packages on this system using package manager

Usage

packageAvailableList

List installed packages on this system using package manager

Arguments

  • none

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Package Utilities

packageManagerValid

Is the package manager supported?

Usage

packageManagerValid [ --help ] [ packageManager ]

Is the package manager supported? Checks the package manager to be a valid, supported one. Return Code: 0 - The package manager is valid. Return Code: 1 - The package manager is not valid.

Arguments

  • --help - Optional. Flag. Display this help.
  • packageManager - String. Manager to check.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

packageManagerDefault

Determine the default package manager on this platform.

Usage

packageManagerDefault

Determine the default package manager on this platform. Output is one of: - apk apt brew port

Arguments

  • none

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

packageNeedRestartFlag

INTERNAL - has packageUpdate set the restart flag at some

Usage

packageNeedRestartFlag [ value ]

INTERNAL - has packageUpdate set the restart flag at some point?

Arguments

  • value - Set the restart flag to this value (blank to remove)

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error