pkgadd: Add or update packages on CRUX


pkgadd: Add or update packages on CRUX

This article walks through using pkgadd to install or update local software packages on CRUX. It assumes you have a local package file (e.g., a .pkg, .tgz, or package directory) and that you understand basic CRUX concepts.

Quickstart: what pkgadd does

  • Install a local software package:
pkgadd {{package}}
  • Update an already installed package from a local package:
pkgadd -u {{package}}

Note: the exact package filename or path goes in place of {{package}}. The -u option tells pkgadd to upgrade the matching installed package from the provided local package.

Common scenarios

1) Install a local package

  • You have a package file named myapp-1.2.pkg in your current directory.
  • Install it with:
pkgadd myapp-1.2.pkg

What to expect:

  • The installer will unpack files into the filesystem, run any post-install scripts, and update package database entries.
  • Dependencies: pkgadd on CRUX typically relies on the local package containing its dependencies or being able to satisfy them manually.

2) Update an installed package from a local file

  • You have a newer myapp-1.3.pkg ready.
  • Update with:
pkgadd -u myapp-1.3.pkg

What to expect:

  • If the local package contains the same package name, it replaces the older version.
  • Dependencies may be re-checked; ensure you have the required libraries installed.

3) Update all upgradable packages from local sources (manual approach)

CRUX does not always prompt for bulk updates from local sources in a single command. You typically run pkgadd for each package you want to upgrade. Consider maintaining a small script if you have several local upgrades.

Practical tips and pitfalls

  • Path and permissions: Ensure you have read access to the package file and sufficient privileges to install (often root).
  • Correct package selection: The package filename must match the package you intend to install or upgrade. A mismatched name can cause installation to fail or overwrite the wrong package.
  • Dependency handling: Local packages may declare dependencies. If dependencies are missing, installation can fail. You may need to install dependencies first from local files or repository mirrors.
  • Pre- and post-install scripts: Some packages run scripts during install. If these fail due to environment issues (missing directories, permissions), clean up or retry after resolving the cause.
  • Verification: After installation, verify the package version and that binaries run as expected.

Troubleshooting quick checks

  • Check the return status of pkgadd. A non-zero exit code indicates an error.
  • Inspect pkgadd logs or the system logs for messages related to file conflicts, permissions, or missing dependencies.
  • If you suspect a corrupted package file, re-download or re-create the local package.

Summary

  • Use pkgadd to install or upgrade from a local package on CRUX.
  • Provide the exact package file name; use -u to upgrade.
  • Be mindful of permissions and dependencies, and verify the result after installation.

See Also