Add support for -U, the unmap operation

Without any arguments, use crypttab. Otherwise try to unmap whatever is
given on the command line. This does not support automatically unmapping
volumes which are not in crypttab.

One FIXME might be that when using crypttab, volumes should be handled
in the reverse order.
Check for udevd to avoid waiting for devices

Without udevd, it is unlikely that new devices are going to show up. So
we will know not to wait for them.

Suggested-by: Dave Reisner <dreisner@archlinux.org>
Add function for finding and waiting on a device

This will be for the encrypted device and if the key is a file on an
external device.
Add function for parsing comma separated option list

As far as the structure of the rest of the code goes, this one is a
little different because it sets the swap variable. I'm trying to think
of a cleaner way to do this.

With the exception of some special values, convert the comma separated
list of options to pass directly to cryptsetup. This means we don't have
to explicitly support all of cryptsetups options.

'size' and 'device-size' are needed because (yes) systemd and Debian use
size for cryptsetup's --key-size option. "cryptsetup --size create"
limits the size of a device.

'swap' means run mkswap after mounting, this is standard as far as the
Debian and systemd format goes.

'luks' and 'plain' are also used by Debian and systemd, but they seem
like superfluous configuration because "cryptsetup isLuks" gives this
information.

'noauto' will work with the default $FILTER (-O) of !noauto

'tmp' isn't yet supported, but is by Debian and systemd. I'd like to
support this later on

There is a list of options which are supported by Debian that we'll
ignore.
Add ct_map function (without support for key device)

Resolve device, parse options, run cryptsetup and run mkswap if needed
Check device with blkid before cryptsetup create

Currently in rc.sysinit we check that blkid returns 2 before running
mkswap. This is a little bit stronger. Even without mkswap "cryptsetup
create" can be dangerous, so do the blkid check for all plain (non-LUKS)
mappings. Furthermore, just check for a non-zero return status, if this
is too broad we can get more specific.

Note: A user can still destroy her data if she enters the wrong password
for a cryptsetup create. This we'll leave as the user's fault; she
should be aware of the limitations of a plain mapping and the
--verify-passphrase cryptsetup option.
Add support to ct_map for key devices

The key field may be device:key:fstype or device:key in which case the
device is resolved and mounted if necessary. For these, key must be
relative to the root of the filesystem on the device.

The keydevice is mounted to $(mktemp -d). It is only unmounted if we
mounted it.
Add support for -M, the map operation

There are a few different syntaxes here. With no arguments, the
ct_read_crypttab iterator is used. With 1 argument, a volume is found in
crypttab. With 2-4 arguments, the volume is defined on the command line
and crypttab is not used.
Support Arch Linux idioms for the key field (ASK,SWAP)
Legacy support for key as <dev>:<offset>:<length>

Give a deprecation notice though.
Support the tmp= option for running mkfs on mapped device

It seems like some people use this. Use a new variable "tmpfs" to
contain the file system type. Default to ext4 (Debian does this). Use
the same variable to track the swap option too because we can only do
one or the other.
Add Arch Linux mkinitcpio hook for encrypted root

This should support all of the current syntax. If that sentance is
false, please let me know. This might be a good time to drop support for
root=... without a cryptdevice=...?
Support encrypted /usr with the the hook as well
Add manpage and example for crypttab

There are a couple of issues with the asciidoc. I'm also really tired
right now so I'm sure there's plenty of awkward wording (this msg
included).

The format should be described almost completely in the manpage. The
only thing I think I'm leaving out intentionally right now though is the
support for dev:offset:length for the key field.

The example file should include enough information to be useful, but
little enough to be a good overview. And certainly not enough to be
dangerous.
Add manpage for cryptmount

Ditto the last commit about awkward wording, even though I'm not quite
as tired =)
Add a Makefile

This might be more than it needs to be. I anticipate systemd deciding to
provide a crypttab man page at some point so I wanted to be someone
flexible here.
Add PKGBUILD