KasperskyOS Community Edition 1.3

Tools for managing KPA packages

KasperskyOS Community Edition includes the following tools for managing KPA packages:

  • cas-pack for building a KPA package in a system where the SDK is installed.
  • cas-inspect for getting information about KPA package contents when working with the SDK.
  • cas-pm for installing one or more KPA packages in a built KasperskyOS-based solution image.

The executable files of these tools are located in the directory /opt/KasperskyOS-Community-Edition-<version>/toolchain/bin/.

In this section

cas-pack tool

cas-inspect tool

cas-pm tool

Page top
[Topic cas_tools]

cas-pack tool

KasperskyOS Community Edition includes the cas-pack tool (the toolchain/bin/cas-pack executable file) intended for building a KPA package in a system where the KasperskyOS Community Edition SDK is installed.

Syntax of the shell command for running the cas-pack tool:

cas-pack {-o|--output} <FILE> --manifest <FILE> --verify [--version] [-h|--help] <FILES>...

Parameters:

  • {-o|--output} <FILE>

    Full name of the built KPA package file.

  • --manifest <FILE>

    Full name of the KPA package manifest file.

  • <FILES>

    List of the full names of files that will be included in the KPA package. Use a space to separate list items. You can use the * character to select all files in the directory.

  • --verify

    Verification of the presence of all KPA package components specified in its manifest and the absence of unspecified components, and calculation of the checksums of KPA package components and their comparison with those specified in the KPA package manifest.

  • --version

    Tool version.

  • -h|--help

    Help text.

Example of the shell command for running the cas-pack tool:

# Packages all program source files residing in the # files directory into the KPA package named helloworld.kpa. A KPA package is built # using information from the manifest.json file, which is the # KPA package manifest. The built KPA package is verified. /opt/KasperskyOS-Community-Edition-<version>/toolchain/bin/cas-pack --output ./helloworld.kpa --manifest ./manifest.json --verify ./files/*
Page top
[Topic tools_cas_pack]

cas-inspect tool

The KasperskyOS Community Edition is delivered with the cas-inspect tool (toolchain/bin/cas-inspect executable file), which lets you get information about the contents of KPA package when working with SDK.

Syntax of the shell command for running the cas-inspect tool:

cas-inspect [-h|--help] [--version] {-i|--input} <PACKAGE> --verify [<COMMAND>] [-o <path>]

Parameters:

  • {-i|--input} <PACKAGE>

    Path to the KPA package (*.kpa file).

  • <COMMAND>

    Commands:

    • dump – prints to standard output the KPA package manifest and information about KPA package components, which includes the size in bytes (Size), offset in bytes (Offset – relative to the end of the KPA package manifest, and Absolute – relative to the start of the KPA package), and the checksum (Digest). This parameter is applied by default.
    • read <manifest|blobs|<hash> – prints the KPA package manifest (read manifest), the contents of all KPA package components (read blobs), or the contents of one KPA package component with the defined checksum (read <hash>). When using the -o <path> parameter, the output is printed to a file. Otherwise, it is printed to the standard output.
    • list – prints the checksum, offset (in bytes) relative to the start of the KPA package, and the size (in bytes) for all KPA package components to the standard output.
    • read-files <FILES>... – prints the contents of a KPA package component based on the component file name. You can specify multiple names of KPA package component files if you separate these names with a space. When using the -o <path> parameter, the output is printed to a file.
    • list-files – prints to standard output a list of all names of KPA package component files included in the KPA package manifest.
  • -o <path>

    Path to the file or directory for saving data when using the commands read {manifest|blobs|<hash>} and read-files <FILES>.... When printing the KPA package manifest (read manifest) or the contents of the KPA package component with the defined checksum (read <hash>), you must specify the file path. When printing the contents of all program components (read blobs), you must specify the path to the directory where each program component will be saved in a separate file with a name matching the checksum of the specific component. When printing the contents of all KPA package components (read-files <FILES>...), you must specify the path to the directory where each KPA package component will be saved in a separate file with the name of the specific component.

  • --verify

    Verification of the presence of all KPA package components specified in its manifest and the absence of unspecified KPA package components, and calculation of the checksums of KPA package components and their comparison with those specified in the KPA package manifest.

  • -h|--help

    Help text.

  • --version

    Tool version.

Examples of shell commands for running the cas-inspect tool:

# Prints the KPA package manifest and information about # KPA package components. cas-inspect -i helloworld.kpa # Prints the KPA package manifest and information about # KPA package components to the console, and verifies the availability of the KPA package components # specified in the manifest and the checksums of # KPA package components. cas-inspect -i helloworld.kpa --verify # Prints the KPA package manifest to a file. cas-inspect -i helloworld.kpa read manifest -o ./manifest # Prints the contents of the KPA package component with the defined # checksum to a file. cas-inspect -i helloworld.kpa read 5d8071308518a7bb003aa084fc995 d2f09b79e9e52f8cd296cb3ee2644ad3951 -o ./comp # Prints the contents of each KPA package component to a separate file. cas-inspect -i helloworld.kpa read blobs -o . # Prints information about KPA package components to the console. cas-inspect -i helloworld.kpa list
Page top
[Topic tools_cas_inspect]

cas-pm tool

KasperskyOS Community Edition includes the cas-pm tool (the toolchain/bin/cas-pm executable file), which installs KPA packages in a built KasperskyOS-based solution image.

Syntax of the shell command for running the cas-pm tool:

cas-pm {-p|--pkgsdir} <DIR> {-d|--dbpath} <PATH> {-a|--appsdir} <DIR> [--rootdir <DIR>] [{-l|--layout} <PATH>] {-e|--extention} <ARG> {-r|--reinstall} <-v[v...]> [--sign-ext <ARG>] [--index-ext <ARG>] <PACKAGES>... [--version] [-h|--help]

Parameters:

  • {-p|--pkgsdir} <DIR>

    SDK host system path to the directory containing the KPA packages to be installed.

  • {-d|--dbpath} <PATH>

    Full name of the SQLite database file that contains data on the installed KPA packages. If the database has not yet been created, it will be automatically generated upon startup of the tool with the specified name, and information about the installed KPA packages will be added to it.

    To ensure that the PackageManager component can detect the database after startup of the KasperskyOS-based solution, complete the following steps:

    1. After calling the cas-pm tool, copy the database file into the file system that will be put into the KasperskyOS-based solution image. If the full name of the database file was originally specified in this file system, this step can be omitted.
    2. The full name of the database file in the file system that will be put into the KasperskyOS-based solution image must be passed to the CMake command create_package_manager_entity() via the DB_PATH parameter (for more details, see PackageManager component usage scenario).
  • {-a|--appsdir} <DIR>

    SDK host system path to the directory intended for storing KPA packages before they are written to the KasperskyOS-based solution image.

  • --rootdir <DIR>

    Relative directory that will be used for installing KPA packages to the KasperskyOS-based solution image. Specify the directory in the file system that will be put into the KasperskyOS-based solution image. Information about the location of KPA packages will be entered into the database and will be required by the PackageManager component when removing KPA packages.

  • {-l|--layout} <PATH>

    Full name of the JSON file that is used to redefine the paths for installing KPA package components. Specify the full file name in the system where the SDK is installed. By default, when a KPA package is installed, its components are put into directories depending on the specific type of KPA package component (for more details, see the componentType key in the article titled List of "components" objects). To change the names of the default directories, define your own values for the keys: bin, res, lib and manifestLocale. To ensure that the PackageManager component can detect KPA package components after the KasperskyOS-based solution is started, the name of this file must be passed in the CUSTOM_LAYOUT parameter of the CMake command create_package_manager_entity() (for more details, see PackageManager component usage scenario).

    Example of a custom_layout_schema.json file:

    { "bin" : "custom-bin-path", "res" : "CustomResPath", "lib" : "CustomLibPath", "manifestLocale" : "Custom_manifestLocale_Path" }
  • {-e|--extention} <ARG>

    Extension for a KPA package file. The default value is kpa.

  • {-r|--reinstall}

    Reinstallation of KPA packages.

  • -v[v...]

    Log level for actions performed by the tool. The number of v characters indicates the log level. Messages are printed to standard output. Available values:

    • -v

      This level logs non-detailed information about normal operation of the tool, and errors and warnings about potential problems.

    • -vv[v...]

      This level adds detailed logging of tool operation information that may be useful to developers for troubleshooting.

  • --sign-ext <ARG>

    Extension for a KPA package external signature file. For more details about a KPA package external signature, see Working with KPA packages.

  • --index-ext <ARG>

    Extension for a KPA package index file. For more details about a KPA package index file, see Working with KPA packages.

  • <PACKAGES>

    List of full names of installed KPA packages in the system where the SDK is installed. You do not need to specify the file extension. Use a space to separate list items.

  • --version

    Tool version.

  • -h|--help

    Help text.

Examples of shell commands for running the cas-pm tool:

# Reinstall the helloworld.kpa package located in the directory defined by the ${PKG_DIR} variable. # The package will first be put into the directory ${ROOTFS_DIR}/package before it is written to the image of the # KasperskyOS-based solution. The directory ${ROOTFS_DIR}/package resides in the file system # that will be copied to the solution image. The repository.sqlite database containing information about the # packages installed in the image will reside in the directory defined by the ${ROOTFS_DIR} variable. # During installation, the actions performed by the tool are logged in detail. /opt/KasperskyOS-Community-Edition-<version>/toolchain/bin/cas-pm --pkgsdir ${PKG_DIR} --reinstall -vvv --dbpath ${ROOTFS_DIR}/repository.sqlite --appsdir ${ROOTFS_DIR}/package --rootdir ${ROOTFS_DIR}/package --extension kpa ${PKG_DIR}/helloworld
Page top
[Topic tools_cas_pm]