In vm_install_base(), copy the host resolv.conf into
the build chroot before attempting to do anything that
requires working DNS (i.e., pkg bootstrap).

In vm_extra_pre_umount(), remove the resolv.conf before
the disk image is unmounted from the backing md(4).

Reported by:	cperciva
Sponsored by:	The FreeBSD Foundation
Silence errors when umounting the chroot's /dev, since it probably doesn't
exist when we're running this.

Unmount filesystems before attempting to destroy the md which holds them.
Unmount filesystem and destroy md before we read the vnode from disk and
package it into a disk image.  Otherwise we end up packaging an unclean
filesystem.
Merge duplicative vm-CLOUDTYPE targets before additional duplication gets
added by the impending arrival of ec2 and gcloud.
Add NOSWAP option which can be set by a vmimage.conf file to specify that
no swap space should be created in the image.  This will be used by EC2
builds, since FreeBSD/EC2 allocates swap space on "ephemeral" disks which
are physically attached to the Xen host node.
Change how packages are installed into VM images: Rather than chrooting
into the image and running 'pkg install' from there, use 'pkg fetch' to
download packages into a temporary location and then 'pkg add' to install
them into the image.

This simplifies the code by avoiding the need to copy /etc/resolv.conf
into the image and then delete it later, and makes it possible to cross
build (e.g., to create an amd64 image when running on i386 hardware; or
in the future for building disk images for embedded platforms).

Because pkg was implicitly installed when VM_EXTRA_PACKAGES was non-empty,
add it to VM_EXTRA_PACKAGES in azure.conf and openstack.conf to maintain
the current behaviour.

By default repo-FreeBSD.sqlite is copied into the image, (a) to match
previous behaviour, where the file would be downloaded by the chrooted
pkg invocation; and (b) because it may be useful for testing purposes,
e.g., to see why a package didn't get installed.  Because this file is
large (46 MB) and not likely to be useful in -RELEASE images which are
being launched into Clouds several months later, it can be disabled by
setting NOREPOSQLITE.

As far as I know this commit does not change the disk images produced in
any filesystem-visible way.
Revert r274773, after I *specifically* objected to this change
numerous times.

Sponsored by:	The FreeBSD Foundation