format: Set MBR partition type byte appropriately (RHBZ#1000428).

Windows won't see a filesystem unless the MBR partition type
byte is set correctly.

$ ./run ./format/virt-format -a /tmp/test.img
$ ./run ./cat/virt-filesystems -a /tmp/test.img --all --long -h
Name       Type        VFS      Label  MBR  Size  Parent
/dev/sda1  filesystem  unknown  -      -    1.0G  -
/dev/sda1  partition   -        -      83   1.0G  /dev/sda
/dev/sda   device      -        -      -    1.0G  -

$ ./run ./format/virt-format -a /tmp/test.img --filesystem=ntfs
$ ./run ./cat/virt-filesystems -a /tmp/test.img --all --long -h
Name       Type        VFS   Label  MBR  Size  Parent
/dev/sda1  filesystem  ntfs  -      -    1.0G  -
/dev/sda1  partition   -     -      07   1.0G  /dev/sda
/dev/sda   device      -     -      -    1.0G  -

$ ./run ./format/virt-format -a /tmp/test.img --filesystem=vfat
$ ./run ./cat/virt-filesystems -a /tmp/test.img --all --long -h
Name       Type        VFS   Label  MBR  Size  Parent
/dev/sda1  filesystem  vfat  -      -    1.0G  -
/dev/sda1  partition   -     -      0b   1.0G  /dev/sda
/dev/sda   device      -     -      -    1.0G  -

$ ./run ./format/virt-format -a /tmp/test.img --lvm --filesystem=vfat
$ ./run ./cat/virt-filesystems -a /tmp/test.img --all --long -h
Name        Type        VFS   Label  MBR  Size   Parent
/dev/VG/LV  filesystem  vfat  -      -    1020M  -
/dev/VG/LV  lv          -     -      -    1020M  /dev/VG
/dev/VG     vg          -     -      -    1020M  /dev/sda1
/dev/sda1   pv          -     -      -    1020M  -
/dev/sda1   partition   -     -      8e   1.0G   /dev/sda
/dev/sda    device      -     -      -    1.0G   -

Thanks: Gerd Hoffmann (kraxel)
(cherry picked from commit d432ab2b5a965110bab542bfd397785eee9753dd)
daemon: tar: Use a temporary file to pass excludes to tar command (RHBZ#1001875).

Use tar -X option instead of tar --exclude=... option.

(cherry picked from commit 91c162586cc2170ea224016307016153f3d081b5)
Add a regression test of tar-out excludes option (RHBZ#1001875).

(cherry picked from commit 1b34d6171bb4aaa1134a9d867918d7163cc7e069)
rsync: Document use of glob + rsync-out in guestfish (RHBZ#1001876).

(cherry picked from commit c04fbbda3e1d2bf98e241a95e069ac1fe202c14f)
mke2fs: Document that too small blockscount will result in ext2 filesystem (RHBZ#1002032).

(cherry picked from commit 1c8986e45c3f1a7e2391bde2848667332495e3aa)
Rename virt-{cat,edit,filesystems,inspector,ls,rescue}.c to *.c.

This is just renaming of files.

(cherry picked from commit 72b0831ffa67383020fa94a6b534bf29af593cff)
daemon: Add comment about how zero_free_space would be better if we could do cancellation.

(cherry picked from commit 950afbb70584528b5a8b6f8ff9ce3d44c53b6934)
sparsify: Fix signal handling.

If you don't have a ^C (SIGINT) signal handler at all, then at_exit
handlers are not called so you end up leaving the large temporary
overlay file lying around.  That was fixed, incorrectly, by
commit 7283a5a2765c0670e9dceec70e626a49a30d269c.

However the code now would delete the overlay file in the SIGINT
handler but otherwise continue running until basically it tries to
read the overlay file (now deleted) and fails.  So it kind of worked,
by accident.

Fix this so that the signal handler calls exit, thus ensuring both
that the exit handler is called (to delete the file) and that the
program actually exits as soon as possible.

This also refactors the unlink_on_exit function into a utility.

(cherry picked from commit 13f3b4a83d6c0abac140d05089ae604bfeef31ef)
drives: Don't need to call free_drive_servers since preceding code checks servers == NULL.

(cherry picked from commit 912943034e21f6fd15b3c835a8130ae91ac724df)
daemon: augeas: Enhance error reporting for aug_init failures.

Thanks: Dominic Cleal.
(cherry picked from commit 3d132f29204e8c5c77f08841b5288dfe3013f4f0)
daemon: augeas: Don't test if AUG_NO_ERR_CLOSE is defined.

It's an enum, not a macro, and in any case it has been present in
augeas.h since 0.10.0, and the minimum version that libguestfs
requires is 1.0.0.

This fixes commit 3d132f29204e8c5c77f08841b5288dfe3013f4f0.

(cherry picked from commit 091eb0780349dade778d1ad3412ffacc7ffec9ec)
virt-df: parallel: Compile debugging messages in always.

Enable debugging messages whenever LIBGUESTFS_DEBUG=1 / -v option, so
that we can track down possible race condition seen in Koji.

(cherry picked from commit 67b9469754684bc0c79fffab7bbca9f6ffee84f0)
Don't redefine _FORTIFY_SOURCE

The macro _FORTIFY_SOURCE might be already defined by environment in
which case it shouldn't be overriden (might be if it has lower value).

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 012d8ebf02e0de672de3b2bcbf192aa2510e5caa)
Get rid of gnulib error

Even though this doesn't stop the compile phase, I find it a bit
distracting that this is what I get with bootstrap:

../.gnulib/gnulib-tool: *** cannot find ./configure.ac - make sure you
run gnulib-tool from within your package's directory
../.gnulib/gnulib-tool: *** Stop.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 475f5ce6a426d026927f31c045bd25160bf7a2f7)
launch: direct: Set QEMU_AUDIO_DRV=none to stop qemu opening audio devices.

Libvirt does the same thing, and it definitely has an effect
on ARM at least.

(cherry picked from commit 2550971d726820753df9d36700f2dd67dfddee7d)
inspection: Don't print a warning if \Windows\explorer.exe does not exist.

guestfs_case_sensitive_path does not test for file existence.  We have
to test for it explicitly.

This updates commit 9ea6e9701461e594033999150f930cc4fafec4d2.  See the
description of that commit for more details.

(cherry picked from commit bae6d5cc63763fe012c8876408e40d8dec2976e4)
docs: Remove misleading / outdated section about other arches from README.

(cherry picked from commit ccc9a891df8f8d0af1732bb5bc00b20f39ba24e6)
virt-df: parallel: Send debugging messages to stderr.

Not stdout (ordinary program output) since that gets eaten by
the tests.

This fixes commit 67b9469754684bc0c79fffab7bbca9f6ffee84f0.

(cherry picked from commit 5971fb2a70daf739dc73fe7d3525295011625cd9)
sysprep: Fix option quoting in manual page.

This fixes commit b65c1c667b26313abf312a7ab51f8bf947243d07.

(cherry picked from commit 4cdb5bcc5ea211daaab24adda23dbb5e71ba172e)
appliance: If --enable-valgrind-daemon then increase minimum memory to 768 MB.

tests/c-api would fail from time to time if --enable-valgrind-daemon
was configured.  There was no obvious memory leak.  It looks as if the
overhead of valgrind was sufficient to break long-running tests such
as this one.

(cherry picked from commit d0ef2ff9b654fb966a294beeab7992d61970c108)