Managing opsi packages with opsi-cli

Managing opsi packages with opsi-cli

The cross-platform command line tool opsi-cli allows server-side tasks to be executed from any computer with a connection to the opsi server, without having to work directly on the opsi server. This simplifies the workflow significantly. In addition, its functionality can be expanded using various plugins.

Here we introduce the new opsi-cli plugin: package. This plugin provides a comprehensive set of new commands for managing opsi packages. Some of them even work without a connection to the server. Whether you need to create, extract, list, install or uninstall packages, the package plugin for the opsi-cli has you covered!

Creating an opsi package

The make command allows you to package a specified source directory and save it to a destination directory. This will create a .opsi package along with .md5 and .zsync files.

opsi-cli package make.

You can customize the packaging process with several options:

  • --md5/--no-md5: Create md5 checksum for the package (default: true).
  • --zsync/--no-zsync: Create zsync file for the package (default:true).
  • --custom-name: Include directories with the specified custom name.
  • --custom-only: Include only custom directories.
  • --follow-symlinks: Follow symlinks.
  • -o, --overwrite: Overwrite existing package if it exists.

Generating control.toml

The control-to-toml command generates a control.toml from a control file located in the specified source directory.

opsi-cli package control-to-toml [SOURCE_DIR]

Extracting an opsi package

The extract command extracts an opsi package from the specified package archive to the destination directory.

opsi-cli package extract [OPTIONS] [PACKAGE_ARCHIVE] [DESTINATION_DIR]

You can customize the extraction process with options like replacing the existing product ID in the control file using --new-product-id or overwriting the destination directory with -o, --overwrite.

Listing opsi products

The list command lists opsi products installed on an opsi-Depotserver, optionally filtered by product IDs.

opsi-cli package list.

By default, it will show products installed on all depots. Use the --depots option to specify depot IDs (comma-separated) or all to list products from all depots.

Installing opsi packages

The install command allows you to install opsi packages directly from local paths or URLs, eliminating the need to download the package first. Simply provide the URL or path to the local .opsi archive, and opsi-cli will handle the rest.

opsi-cli install package.

By default, it will be installed on the opsi-Configserver, but you can specify other depots using the --depots option or use all to install on all depots. During installation, if you need to change the default product property values, an interactive prompt will guide you through the process using the --update-properties option. If there are locked products, you can use --force to force the installation.

Uninstalling opsi products

The uninstall command allows you to uninstall opsi products specified by their product IDs.

opsi-cli package uninstall [OPTIONS] [PRODUCT_IDS]

By default, it will be uninstalled from the opsi-Configserver, but you can specify other depots using the --depots option or use all to uninstall from all depots. If there are conflicts or issues, you can use --force to force the uninstallation.


With these commands, managing your opsi packages becomes effortless. Whether you’re creating new packages or managing existing ones, the package plugin for opsi-cli offers a unified solution to streamline your workflow, eliminating the need for multiple tools.

Tip

Many of these commands feature a modern and colorful progress bar to keep you informed of the status. If you need to run opsi-cli in scripts or prefer a less verbose output, you can use the --quiet option to suppress the progress bar and other non-essential output.

We appreciate your feedback, so please share your thoughts in our forum.

Related Posts

opsi à la Carte: opsiconf 2024 in Mainz

opsi à la Carte: opsiconf 2024 in Mainz

On July 9th and 10th, 2024, the fourth opsiconf took place in Mainz. A report by Heike Jurzik.

Read More
From Vacant to Vibrant

From Vacant to Vibrant

24 years of opsi. Ute Hahn-Klimroth joins me to reflect opsi's history.

Read More
opsi 4.3 released

opsi 4.3 released

The new opsi release is here: For more than two years we have been working on modernizing opsi, making it more secure and reliable than ever. Now the time has finally come: We are very proud of the result, which we would like to officially present today.

Read More