Commandline client

The commandline client is a commandline tool for using the reference clients.

Installation

For Linux and Mac

For v1.9 and earlier it requires java 8 and perl.

For v1.10+ it requires java 11+ and perl.

For Windows

For v1.9 and earlier it requires java 8.

For v1.10+ it requires java 11+.


Download the desired version of the bitrepository-command-line-XXX-distributed.tar.gz from here (XXX refers to the version):

https://sbforge.org/nexus/content/repositories/releases/org/bitrepository/reference/bitrepository-client/.

The latest devel client can be found here


Unpack the file in any wanted location, e.g. 

tar -xvf bitrepository-command-line-XXX-distributed.tar.gz

It requires a 'conf' sub-directory to the installation which contain all the settings, etc. for the setup of the collection. This can be done in either of the two ways:

  • Create the 'conf' directory and copy all the settings file into it.
  • Make a symbolic link to the 'conf' directory for the WebClient or the services in the collection (e.g. 'ln -s /my/bitrepository/services/conf).

Certificate

If secure communication is used for this bit repository, a client certificate needs to be define. In this case the client expects to find a certificate name client-certificate.pem in the conf folder. Either name the certificate client-certificate.pem  directly or create a symlink to the certificate.

Execute

The different commands can be run with the bitmag.sh script (bitmag.cmd on windows).

E.g. the following command will fetch the checksums for the test1 collection.

bin/bitmag.sh get-checksums -c test1

get-file

Retrieves a file. It takes the following arguments:

  • [MANDATORY] -i The id of the file to perform the operation on.

  • [MANDATORY] -c The id of the collection to retrieve the file from.

  • [OPTIONAL] -p The id of the pillar where the file should be retrieved from. If no argument, then the file will be retrieved from the fastest pillars.

  • [OPTIONAL] -l The location where the file should be placed (either total path or directory). If no argument, then in the directory where the script is located.

get-file-ids

Get the list of files in a collection 'get-file-ids.sh' command. It takes the following arguments:

  • [MANDATORY] -c The id for the collection to retrieve the file for.

  • [OPTIONAL] -i The id of the file to retrieve. If no such argument, then the id of all files are retrieved.

  • [OPTIONAL] -p The id of the pillar where the id should be retrieved.

get-checksums

Lists the checksum for the files in the indicated collection. It takes the following arguments:

  • [MANDATORY] -c The id for the collection to retrieve checksums from.

  • [OPTIONAL] -i The id of the file to retrieve the checksum from. If no such argument, then the checksums of all files are retrieved.

  • [OPTIONAL] -p The id of the pillar to retrieve checksums from.
  • [OPTIONAL] -S The salt of checksum to request in the response. Requires the -R ChecksumType (algorithm) argument with a salt type algorithm.

  • [OPTIONAL] -R The algorithm of checksum to request in the response from the pillars. Allowed values are: MD5, SHA1, SHA256, SHA384, SHA512. If using a salt, prefix the listed types with HMAC_, eg. HMAC_MD5.

get-file-infos

Lists the file-infos for the files in the indicated collection. File-infos as a combination of checksums and fileIDs. This command will replace the get-file-ids and get-checksums in a later release. It takes the following arguments:

  • [MANDATORY] -c The id for the collection to retrieve checksums from.

  • [OPTIONAL] -i The id of the file to retrieve the checksum from. If no such argument, then the checksums of all files are retrieved.

  • [OPTIONAL] -p The id of the pillar to retrieve checksums from.
  • [OPTIONAL] -S The salt of checksum to request in the response. Requires the -R ChecksumType (algorithm) argument with a salt type algorithm.

  • [OPTIONAL] -R The algorithm of checksum to request in the response from the pillars. Allowed values are: MD5, SHA1, SHA256, SHA384, SHA512. If using a salt, prefix the listed types with HMAC_, eg. HMAC_MD5.

put-file

Puts a file into a collection. It takes the following arguments:

  • [MANDATORY] -c The id for the collection to place the the file in.

  • -f The path to the file, which is wanted to be put.
  • -u The URL where the file can be downloaded.
    • [MANDATORY] Must have either -f or -u arguments, though never both.
  • -C The checksum of the new file
    • -C is required, if -u argument is used, and optional if -f is used.
  • -i The id for the file to perform the operation on.
    • -i is required, if -u argument is used, and optional if -f is used.
  • [OPTIONAL] -S The salt of checksum to request in the response. Requires the -R ChecksumType argument.

  • [OPTIONAL] -R The algorithm of checksum to request in the response from the pillars.  Allowed values are: MD5, SHA1, SHA256, SHA384, SHA512. If using a salt, prefix the listed types with HMAC_, eg. HMAC_MD5.

  • [OPTIONAL] -d For removing the file from the file-server after the put-file operation is completed.

delete-file

Deletes a file in the bit-repository. It takes the following arguments:

  • [MANDATORY] -p The id of the pillar where the file should be delete.

  • [MANDATORY] -i The id for the file to perform the operation on
  • [MANDATORY] -c The id for the collection to place the the file in.

  • [MANDATORY] -C The checksum of the file to be delete (in the collection default checksum specificiation).

  • [OPTIONAL] -S The salt of checksum to request in the response. Requires the -R ChecksumType (algorithm) argument with a salt type algorithm.

  • [OPTIONAL] -R The algorithm of checksum to request in the response from the pillars. Allowed values are: MD5, SHA1, SHA256, SHA384, SHA512. If using a salt, prefix the listed types with HMAC_, eg. HMAC_MD5.

replace-file

Replaces a file in the bit-repository with the provided file. It takes the following arguments:

  • [MANDATORY] -c The id for the collection to perform the operation on

  • [MANDATORY] -C The checksum of the file to be replaced.

  • [MANDATORY] -p The id of the pillar where the should be performed.

  • -f The path to the new file for the replacement.
  • -u The URL where the replacement file can be downloaded.
    • [MANDATORY] Must have either -f or -u arguments, though never both.
  • -r The checksum of the new file
    • -r is required, if -u argument is used, and optional if -f is used.
  • -i The id for the file to perform the operation on.
    • -i is required, if -u argument is used, and optional if -f is used.
  • -R [OPTIONAL] The algorithm of checksum to request in the response from the pillars. Allowed values are: MD5, SHA1, SHA256, SHA384, SHA512. If using a salt, prefix the listed types with HMAC_, eg. HMAC_MD5.
  • -S [OPTIONAL] The salt of checksum to request in the response. Requires the -R ChecksumType (algorithm) argument with a salt type algorithm.