Skip to content

A simple utility to allow users to create a Bag from a directory on their file system.

License

Notifications You must be signed in to change notification settings

jhsimpson/createbag

 
 

Repository files navigation

Create Bag

A simple utility to allow users to create a Bag from a directory on their file system.

This utility is not a replacement for a full-featured tool such as the Library of Congress's Bagger (included in their Transfer Tools). Instead, its purpose is to hide the details of creating a Bag from the end user by providing a simple, familiar user interface. Settings for Bag creation are contained in a configuration file (that would be modified by a network administrator, for example).

Features

  • Runs on Linux, OSX and Windows (after installation of prerequisites).
  • On Linux and Windows, uses standard Graphical User Interface file/directory browser to allow user to select which directory to create Bag from; on OSX, shows up as an option in the Finder context menu.
  • Configuration options:
    • The ability to specify which configuration file to use (as a command-line parameter)
    • Definition of the title of the main application window and the file chooser window title
    • Definition of custom BagIt tags
    • Options to enable some auto-generated BagIt tags (currently Source-Directory and Source-User)
    • Choice of checksum algorithms (md5, sha1, sha256, and sha512)
    • The option to define a list of "shortcuts" (i.e., links to directories) that appear in the file chooser dialog box.
    • The option to copy the contents of the selected directory to specific destination directory before creating the Bag. Note that since the Bag is created from the copy, checksums are generated for the copies, not the original files.

This last option, the 'create_bag_in' configuration option, is important. If this option is not set, the Bag is created in the directory selected by the user; that is, the directory's contents are rearranged into a Bag structure. The value of this option is set to '/tmp' by default; Windows users will need to set it manually before running the utility.

Dependencies

Windows

No dependencies; all required libraries are packaged into executable.

OSX / Linux

  • Python 2.7.8, but should work with any recent version of Python
  • Python GTK+3
    • On Linux, Python bindings for GTK+3 should already be installed
    • On OSX, this isn't used.
  • bagit
    • On all platforms, install with pip install bagit (you may need to do easy_install pip first on OSX if it's your first time adding Python packages; this will probably be added to the OSX installer soon.)

Usage

Linux / Windows

On Windows, an executable is provided as an alternative to command line usage; simply download and run 'createbag.exe,' optionally providing a config file in the same directory as config.cfg. On Linux, invoke the utility from the command line like this:

python createbag.py

Create Bag allows you to specify which configuration file to use, as a command-line argument. If run as above, with no argument, the script looks for the file 'config.cfg' in the same directory as the script. To indicate another location for the configuration file, run the script with the file's path as an argument, like this:

python createbag.py /path/to/the/config.file

When the utility starts, a small window with two buttons appears:

Create a Bag

Clicking on the "Choose a directory to create Bag from" will open up a standard file/directory browser:

Choose a directory

Choosing a directory and clicking on "Create Bag" will create the Bag, after which the following dialog box will appear:

Bag created

Clicking on "OK" will take the user back to the startup window:

Create a Bag

OSX

Download and install app bundle as normal (available via git clone; direct links forthcoming). You can then create a bag using this script by right-clicking on any folder in your Finder and selecting "Create Bag" from the context menu:

Create a Bag in OS X

To do

  • Add better error handling (e.g., options for going back to main application window on Bag creation error, etc.) to OSX/Linux versions.
  • Add error logging, with log path as a configuration option.

Pull requests implementing these features are welcome.

License

The Unlicense (http://unlicense.org/). Refer to the LICENSE file for more information.

About

A simple utility to allow users to create a Bag from a directory on their file system.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 95.1%
  • Shell 4.9%