3 releases (breaking)

0.3.0 Mar 1, 2022
0.2.0 Feb 26, 2022
0.1.0 Feb 11, 2022

#5 in #bags

Apache-2.0

77KB
2K SLoC

bagr

bagr is a command line utility for interacting with BagIt bags.

It is still under active development, but bag creation is feature complete.

Install

Pre-built

The releases page has pre-built binaries that should work on common OSes and architectures. You do not need to install Rust to use them.

  1. Download and unzip the appropriate binary
  2. Execute ./bagr help to verify it works

Local Build

  1. Install Rust
  2. Execute: cargo install bagr
  3. Verify the install: bagr help

Usage

Create a new bag

By default, bagr will turn the contents of the current directory into a bag by invoking:

bagr bag .

If instead, you'd like to create a bag by copying the contents of a source directory into a destination bag, then you can do by invoking:

bagr bag src/dir dst/bag

By default, sha512 is used; this algorithm can be changed using the --digest-algorithm option.

On Mac systems, .DS_Store files can often sneak into unwanted places. These files can be excluded from the bagging process by using the --exclude-hidden-files flag. Note this will delete hidden files when creating a bag in place.

Update an existing bag

If you've modified the payload or tag files of a bag after creating it, bagr can also be used to recompute all of the digests and update the appropriate manifest files by executing the following:

bagr rebag path/to/bag

By default, it will use the same digest algorithms as were originally used in the bag. If you wish to change the algorithms, you can do so by specifying the --digest-algorithm option.

Limitations

  1. Tag files must be UTF-8 encoded
  2. fetch.txt is not supported
  3. BagIt versions prior to 1.0 are not supported

Roadmap

  1. Implement bag validation
  2. Support fetch.txt
  3. Support BagIt 0.97
  4. Support BagIt Profiles
  5. Support non-UTF-8 character encodings

Dependencies

~8–17MB
~212K SLoC