dar

Introduction

The Debian Archive or dar tool can be used to manipulate a Debian package (i.e .deb file.)

It has the capability to load the entire file and then extract each file or, read files and generate a Debian package.

The tool is very basic and should only be used for debug purposes to bypass all the complexity of the wpkg tool. As of 0.7 it is a combination of ar, tar, and gzip/bz2. You can create a .tar.gz, .tar.bz2 or .deb file in one go and extract from a .tar.gz, .tar.bz2 or .deb file in one go.

The name, dar, comes from Debian and Archive. It is very similar to ar and tar, on purpose, since it handles both formats. Note that it handles the format exactly as ar and tar does within the official dpkg tool. In other words, the same "mistakes" are expected to appear in those files when created with dar.

Command Line and Options

dar <-opt> <archive> [<member> ...]

The tools expects at least one command (-t, -c, -x) and accepts additional options1.

The command must be followed by the name of an archive. If -c (create) is used, then that's the name of a new archive (if a file of that name already exists it will be overwritten.)

Optionally, you can specify a set of members. When creating an archive, you need at least one member filename.

The command line operations are:

• --help or -h — print out the help screen about the options and exit
• --version — prints out the version of the dar tool and exit
• --create or -c — create a new Debian Archive
• --extract or -x — extract files from a Debian Archive
• --list or -t — print the name of the files in a Debian Archive
• --verify — check the files in a Debian Archive

The optional command line options are:

• --verbose or -v — request more verbosity as the tool works
• --quiet or -q — request more quietness as the tool works
• --md5sums or -s — show the md5sums (works with --list)

The --verbose flag changes the output of the --list option to include all the information available about the files (meta data,) and requests the --verify option to print out the filenames as it is checking the archive. The --md5sums flag can also be used to see the md5 of each file in the archive. In case of a wpkgar archive, the md5sum saved in the archive is shown. Otherwise it is computed on the fly. The output of the dar tool with -t and -s flags used together is equivalent to md5sums.

The --quite flag cancels the --verbose flag effects.

The --verfiy is the same as the --list except that by default it doesn't print anything on the screen.

Note that

dar -c file.tar m1 m2 m3

is similar to:

tar -cf file.tar m1 m2 m3

With dar you can also compress the output just by adding the compression extension:

dar -c file.tar.gz m1 m2 m3

compresses the file.tar result using gzip with compression level of 9.

The extension is used to know which Debian Archive format to use. The .tar is used for tarballs. The .deb (and .a) is used for ar archives.

Similarly, the compression is automatically used when a .gz is used.

Later versions will support additional compressions: .bz2, .lzam, and .xz are planned. At this time, these extensions are likely to break the tool with an exception.

Remote Web Files

Since the libdebpackages library supports reading  files from an Web server (via HTTP) it is possible to specify filenames on the command line that are found on websites. Note however that you will not be able to change their path. The full path on the server (path to the file appearing after the domain name) will end up being the full path in the resulting archive.

Just like with the --install command line option, the feature supports a username, a password, and a port specification. Once SSL support is added, it will also support secure connections.

Such filenames are expected to look like this:

http://alexis:secret@www.m2osw.com:80/path/to/my/file.html

The user name (alexis), password (secret), and port (80) are optional. The default port for HTTP is 80.

Network Files on MS-Windows

The tool also supports network files as defined by a double backslash introducer. Note that internally the names are transformed to a Netbios or Samba protocol. In other words the following filenames are equivalent:

\\server\share\path\to\my\file
smb://server/share/path/to/my/file

Note that if you are writing a path with backslashes in cygwin or another similar Unix shell, you probably will have to double the \ characters.

Netbios also supports SSL and a port, although we ignore the port at the moment. SSL can be specified with @SSL with the standard double backslash syntax and with smbs with the protocol standard.

\\server@SSL\share\path\to\my\file
smbs://server/share/path/to/my/file

If you are not already connected to that network drive (through Explorer or with the net command line) then it most certainly will require a user name and password. You can specify those with the smb protocol as in:

smb://user:secret@server/share/path/to/my/file

user and secret are the log on name and the password. Note that at this time the syntax does not support % encoding or any other kind of character escaping. This means you cannot have any special character in your user name and password (i.e. spaces, @, / or \, :, etc.)

• 1. Note that contrary to ar and tar, the dar command line options and operations must be preceeded by a dash (-) character.