Fedora™ Client Command-Line Utilities

Software Release 1.2.1

Fedora™ Development Team

$Id: client-cmdline.dbx,v 1.14 2004/04/16 12:57:45 rlw Exp $


Table of Contents

Introduction
fedora-dsinfo
fedora-export
fedora-find
fedora-ingest
fedora-ingest-demos
fedora-convert-demos
fedora-purge

Introduction

The Fedora client distribution comes with several command-line utilities that can be used to run some common operations without bringing up the GUI or writing your own SOAP client. A description and usage instructions for each follows.

This guide assumes you have correctly installed the Fedora client distribution as per the install guide, including having set up your PATH and FEDORA_HOME appropriately. The command-line scripts are located in FEDORA_HOME/client/bin/. In Windows, these commands resolve to batch files (.bat); in Unix, they resolve to shell scripts (.sh).

fedora-dsinfo

fedora-dsinfo [hostname] [port-number] [user] [pass] [pid]

Where:

  • [hostname] - The hostname of the Fedora server; default is localhost.

  • [port-number] - The port number on which the Fedora server is running; default is 8080.

  • [user] - The Fedora user (e.g. fedoraAdmin).

  • [pass] - The Fedora user's password.

  • [pid] - The pid of the object whose datastream information should be shown.

Example:

fedora-dsinfo localhost 8080 fedoraAdmin fedoraAdmin demo:5

Displays key information about each of an object's datastreams.

fedora-export

fedora-export HST:PRT USR PSS PID|FTYPS PATH

Where:

  • HST - The repository's hostname.

  • PRT - The repository's port number.

  • USR - The id of the repository user.

  • PSS - The password of the repository user.

  • PID - The id of the object to export from the repository.

  • FTYPS - Any combination of the characters O, D, and M, specifying which Fedora object type(s) should be exported. O=regular objects, D=behavior definitions, M=behavior mechanisms.

  • PATH - The directory to export to.

Examples:

fedora-export example.com:80 fedoraAdmin fedoraAdmin changeme:1 .

fedora-export example.com:80 fedoraAdmin fedoraAdmin DMO /tmp/fedoradump

Exports one or more objects from a Fedora repository.

fedora-find

fedora-find [hostname] [port-number] [fieldList] [searchString]

Where:

  • [hostname] - The hostname of the Fedora server; default is localhost.

  • [port-number] - The port number on which the Fedora server is running; default is 8080.

  • [fieldList] - A space-delimited list of fields. These are the fields that will be displayed for each object that matches the searchString. See http://host:port/fedora/search for a complete list of displayable fields and descriptions of each.

  • [searchString] - A simple text string to search all fields for. This may include wildcard characters and is case-insensitive.

Example:

fedora-find localhost 8080 "pid fType title description" "fedora"

(shows the pid, Fedora object type, title, and description fields of each object that has the word fedora somewhere in it's indexed fields.)

A simple way to search a repository's indexed fields. More advanced searches can be done with the web-based search interface at http://host:port/fedora/search, or the Admin GUI's search interface.

fedora-ingest

fedora-ingest f[ile] PATH THST:TPRT TUSR TPSS [LOG]

fedora-ingest d[ir] PATH FTYPS THST:TPRT TUSR TPSS [LOG]

fedora-ingest r[epos] SHST:SPRT SUSR SPSS PID|FTYPS THST:TPRT TUSR TPSS [LOG]

Where:

  • PATH - the local file or directory name.

  • FTYPS - any combination of the characters O, D, and M, specifying which Fedora object type(s) should be ingested. O=regular objects, D=behavior definitions, and M=behavior mechanisms.

  • PID - the id of the object to ingest from the source repository.

  • SHST/THST - the source or target repository's hostname.

  • SPRT/TPRT - the source or target repository's port number.

  • SUSR/TUSR - the id of the source or target repository user.

  • SPSS/TPSS - the password of the source or target repository user.

  • LOG - the optional log message. If unspecified, the log message will indicate the source of the object(s).

Examples:

fedora-ingest file obj1.xml example.com:80 fedoraAdmin fedoraAdmin

fedora-ingest dir c:\archive M example.com:80 fedoraAdmin fedoraAdmin ""

fedora-ingest dir c:\archive ODM example.com:80 fedoraAdmin fedoraAdmin ""

Ingests one or more objects into the repository, either from disk or from another Fedora repository.

fedora-ingest-demos

fedora-ingest-demos [hostname] [port-number] [user] [pass]

Where:

  • [hostname] - The hostname of the Fedora server; default is localhost.

  • [port-number] - The port number on which the Fedora server is running; default is 8080.

  • [user] - The Fedora user (e.g. fedoraAdmin).

  • [pass] - The Fedora user's password.

Example:

fedora-ingest-demos localhost 8080 fedoraAdmin fedoraAdmin

A convenient script to ingest all included demo objects for a new Fedora installation. See the Demo guide for descriptions of these objects. Note: This script should not be run until you have ensured that the hostname and port numbers in the demo objects have been corrected (with the fedora-convert-demos script) to use the actual hostname and port of your Fedora server.

fedora-convert-demos

fedora-convert-demos [fromHostName] [fromPortNum] [toHostName] [toHostNum] [fedoraHomeDir]

Where:

  • [fromHostName] - The hostname currently being used in the demo object files.

  • [fromPortNum] - The port number currently being used in the demo object files.

  • [toHostName] - The hostname of the repository.

  • [toPortNum] - The port number of the repository.

  • [fedoraHomeDir] - Fedora's install base directory. This is the directory that contains the client directory.

Example:

fedora-convert-demos localhost 8080 www.fedora.info 80 c:\fedora-1.2.1

Converts URLs in the demo objects from one host/port combination to another. After running this script with your repository's hostname, the demo objects can successfully be ingested.

Background: The demo objects that come with the Fedora client have embedded URLs inside them that assume the server is running on a machine called localhost on port number 8080. Those URLs must be changed to reflect the actual host and port the server is running on. Rather than search through all the demo files and change the references by hand, you can just run this script. It is not necessary to run this script if you have already run fedora-ingest-demos succcessfully and wish to change the hostname and port of the Fedora server, as the demo objects are already in the repository and the references inside them will automatically be corrected by the server.

fedora-purge

fedora-purge [hostname] [port-number] [user] [pass] [pid] [logMessage]

Where:

  • [hostname] - The hostname of the Fedora server; default is localhost.

  • [port-number] - The port number on which the Fedora server is running; default is 8080.

  • [user] - The Fedora user (e.g. fedoraAdmin).

  • [pass] - The Fedora user's password.

  • [pid] - The PID of the object to permanently remove.

  • [logMessage] - A log message explaining the removal.

Example:

fedora-purge localhost 8080 fedoraAdmin fedoraAdmin demo:6 "It was just a test object"

Permanently removes an object from the repository. Note: Behavior Definition objects (BDefs) cannot be removed if there are objects that depend on them. When removing a BDef from the repository, first the dependent object(s) should be removed, then the implementing Behavior Mechanism(s), then the BDef itself.