bio(1) Barry Input / Output

SYNOPSIS

bio -i <input type> [input args] -o <output type> [output args] [-o <output type> ...]

DESCRIPTION

bio is a command line tool that treats devices, backups, and data streams as input and output. bio supports the following types of IO (actual type name shown in bold):

device

tar (backup files)

boost (serialization files and streams)

mime streams

ldif streams

human readable and hex text dump

sha1 sum output

cstore for extracting Content Store records

Each command line consists of at least one input and output option, along with their switches. More than one output can be used, as long as they do not conflict with each other. For example, it is not possible to read and write from the same device PIN.

This tool combines a lot of the functionality of btool, btardump, brecsum, and bs11nread, but does it more flexibly, and improves functionality in some cases, such as Boost archives being able to contain more than one database.

DEVICE TYPE OPTIONS

The device type is used to read or write from a device connected via USB. Some of the options below are valid only in one input or output mode, some in both.

-d db
Name of database to load, when using the device type as input. Can be used multiple times. See btool -t for a list of databases on the device.
-A
Selects all databases found on the device, instead of adding them manually via the -d option.
-p pin
PIN of device to talk to. Valid for both input and output. Only needed if you have more than one Blackberry connected at once.
-P password
Simplistic method to specify device password. In a real application, this would be done using a more secure prompt.
-w mode
Set write mode when using the device type in output mode. This must be specified, or nothing will be written. Can be one of: erase, overwrite, addonly, addnew.

erase Erases all records from existing database and adds all new records to the device, using their Unique IDs, if available. This is what you would normally use to restore a backup.

overwrite Adds any new records, and for records with Unique IDs that already exist on the device, overwrite them.

addonly Adds any new records, but if a record exists in the device with the same Unique ID, skip that record and don't write it to the device.

addnew Adds all incoming records as brand new records, generating a new Unique ID for each one, and leaving any existing records intact. This may cause data duplication if you're restoring data that initially came from this same device. Use this for copying data from another device, while keeping your existing records.

TAR TYPE OPTIONS

The tar type is used to read or write from a backup file created by btool or the backup GUI.

-d db
Name of database to load, when using the tar type as input. Can be used multiple times. Note that if no -d options are specified, bio defaults to reading all available databases.
-f file
The tar backup file to read or write from. Bio uses gzip compressed tar files, so suitable extensions would be .tgz and .tar.gz. Unfortunately, due to internal limitations, an actual file must be specified here, and not - for stdin / stdout.

BOOST TYPE OPTIONS

The boost type is used to read and write parsable records in Boost Serialization format. These files were historically written and read by btool and bs11nread. Bio is more flexible, in that it can contain multiple databases in one serialization archive.

-f file
Filename to read from or write to. Use - to specify stdin or stdout. If not specified for input, defaults to stdin, but since output can contain non-ASCII chars, you must use -f - if you want to write to stdout.

LDIF TYPE OPTIONS

The ldif type is used to read or write ldif output, like the output of the LDAP command line tool ldapsearch.

-c dn
When using ldif as output, specify the base DN.
-C dnattr
Again, for output, specify the attribute name to use when building the FQDN.

MIME TYPE OPTIONS

The mime type is used to read or write VCARD, VEVENT, VTODO, or VJOURNAL records based on the Address Book, Calendar, Tasks, or Memos databases respectively.

-f file
Filename to read from or write to. Defaults to - for stdin or stdout.

DUMP TYPE OPTIONS

The dump type is used only for output, and sends human readable record data to stdout. Parsable records are parsed; unknown records are dumped in hex format.

-n
Use hex format for all records.

SHA1 TYPE OPTIONS

The sha1 type is used to mimic the behaviour of the brecsum command. It calculates a SHA1 sum on the raw record data and sends the sum to stdout.

-t
Include the DB Name, Type, and Unique record ID in the checksum for each record.

CSTORE TYPE OPTIONS

The cstore type is used to parse Content Store records.

-l
List the filenames and folders found in the Content Store database.
-f file
Select a filename from the above list to extract and save locally. Specify the entire path as shown in the -l list. If the file is found in the device, it will be written to the current directory, using the base filename as the name. If a file by that name exists already, the filename will be modified to avoid overwriting local files.

STANDALONE OPTIONS

-h
Displays a detailed summary of command line options.
-I cs
Set the international charset for string conversions. Valid values here are available with iconv --list
-S
Show list of supported database parsers and builders.
-v
Dump verbose low level protocol data during USB operations, to stdout.

EXAMPLES

1) Backup a full device to tar backup:
bio -i device -A -o tar -f mybackup.tar.gz
2) Read a backup file and convert the Address Book to MIME
bio -i tar -f mybackup.tar.gz -d "Address Book" -o mime
3) Restore a single database to a device
bio -i tar -f mybackup.tar.gz -d "Address Book" -o device -w erase
4) Copy the Calendar from one device to another, and dump
the records to stdout in human readable format at the same time
bio -i device -p 3009efe3 -d Calendar -o device -p 204062f3 -w erase -o dump
5) Read LDIF input and convert the contacts to MIME format
ldapsearch -x | bio -i ldif -o mime
6) Test the record code by running the Tasks database through
the Boost storage and back to human readable
bio -i device -d Tasks -o dump

vs.

bio -i device -d Tasks -o boost -f - | bio -i boost -f - -o dump

AUTHOR

bio is part of the Barry project.