Skip to content

Package Manager Tools

🛠️ Tools · ⬅ Home


Wrapper around:

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

Conditional installation

Usage

packageWhich [ --manager packageManager ] binary [ packageName ... ]

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 - String. Optional. Package manager to use. (apk, apt, brew)
  • binary - String. Required. The binary to look for
  • packageName ... - String. Optional. 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 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.

Usage

packageWhichUninstall [ --manager packageManager ] 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 - String. Optional. Package manager to use. (apk, apt, brew)
  • binary - String. Required. The binary to look for.
  • packageInstallPackage - String. Required. The package name to uninstall if the binary is found in the $PATH.

Examples

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

Usage

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

Update packages lists and sources

Arguments

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

Return codes

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

Usage

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

Upgrade packages lists and sources

Arguments

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

Return codes

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

Usage

packageInstall [ package ] [ --verbose ] [ --manager packageManager ] [ --force ] [ --show-log ]

Install packages using a package manager. Supported managers: - apk - apt-get - brew

Arguments

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

Examples

packageInstall shellcheck

Return codes

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

Usage

packageUninstall package [ --manager packageManager ]

Removes packages using the current package manager.

Arguments

  • package - String. Required. One or more packages to uninstall
  • --manager packageManager - String. Optional. 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.

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

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

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

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 - String. Optional. Package manager to use. (apk, apt, brew)

Return codes

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

Package lists

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

Usage

packageIsInstalled package

Is a package installed?

Arguments

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

Return codes

  • 1 - If any packages are not installed
  • 0 - All packages are installed

Usage

packageInstalledList

List installed packages on this system using package manager

Arguments

  • none

Return codes

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

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

Usage

packageManagerValid [ --help ] [ packageManager ]

Is the package manager supported? Checks the package manager to be a valid, supported one.

Arguments

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

Return codes

  • 0 - The package manager is valid.
  • 1 - The package manager is not valid.

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

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