Make sure we unmount stale proc mounts on the chroot host.

(cherry picked from commit 722949f475fbd71cb9c0b036d394e0c1c7e9d26e)
Make sure test results are collected even in the case of failure.

We do this by making it part of the test step itself.

(cherry picked from commit b1e2bfa21fb707f5fb9f55bb881ddf329b50845b)
Add environment printout to detect-environment, for debugging.

(cherry picked from commit 854c8aa8332ffd6f0de74d22bc2ab43b37097896)
Helper packages for Debian-based development.

Add contrib/cf-deb-dep/ to automate pulling in needed Debian packages
and help with keeping up to date on what's needed.

(cherry picked from commit 95fa10c83414e7149e84f9956761c38be6c18944)
Don't complain about an already running CFEngine.

Move the stop section to the beginning of the pre-script, so that the
port checks come afterwards.

(cherry picked from commit e4ace02de4e0b5cf4bcf14b4e9f0e317bc071399)
Make sure libvirt doesn't try to pick up the system libcurl.

It will fail later because the package will not contain libvirt.

(cherry picked from commit 4120a6b643719bfc40df281215becbc7a8aa8406)
Redmine #6581: Fix upgrade overwriting config files with templates.

This required several things:

- Almost all of the post script was only executed on install, not
  upgrade. Now most (but not all) sections are performed on both.
- The config files contain the private keys, but we don't have a
  dedicated file for them, so we need to fish them out of the config
  files, store them somewhere, and then restore them after the file
  has been upgraded.
- Lots of indentation corrections.
- Don't regenerate new SSL certificate if we already have one.

(cherry picked from commit ca6ecd701e92734aebc3b7748bd5676066cafe35)
Redmine #6581: Don't perform uninstall steps if we are upgrading.

This fixes the daemons being stopped after an upgrade.

Note that this will only have an effect when we upgrade from a package
that includes this change, because the uninstall script is always
taken from the *old* package. Hence, the earliest package that this
change will have any effect for, is the second version that includes
the change, which at the time of writing is probably going to be
3.6.3.

(cherry picked from commit 8dd4e122c107f59b014055b09ed0b0b5e43553ed)
Redmine #6581: Make sure that daemons are restarted when upgrading.

(cherry picked from commit f6d14ef3a18e78bfc900add29f8104638244bd87)
Redmine #6611: Fix incorrect key extraction when upgrading from < 3.6.1

Versions before 3.6.1 don't have the appsettings.php secret key at
all, so we need to detect when our extraction has failed and delete
the key file so that we will generate a key instead. We do this by
matching the extracted key file against the regular expression and by
making sure it contains exactly one such line.

(cherry picked from commit 4e09afd99db8c46fcefbc9b6afdbd077a12fcb59)
Fix libldap linking to /var/cfengine/lib/libcrypto.so instead of /usr/lib/.

(cherry picked from commit 59a3cd30f70a02fd13aaedcb6c0ca57f788e2d48)
Remove shady stuff.

(cherry picked from commit 82a46bff88e7d655f699aa8ccd04ad3d58b50990)
zlib: Make sure all .so files are part of run time dependencies.

The old code omitted .so without a numbered suffix, which would make
it a build time dependency instead of run time dependency.
(cherry picked from commit 72ed4e0a0fb10ee89a47b5ed4a106576c5179299)
Repeat fix 72ed4e0a for all dependencies.

As it turns out all Solaris dependencies suffer from the same problem,
so fix them all (and do FreeBSD as well, while we're at it). The fix
is:

Make sure all .so files are part of run time dependencies. The old
code omitted .so without a numbered suffix, which would make it a
build time dependency instead of run time dependency.
(cherry picked from commit d17db809b2e091fb38f3e853ed45c63688e709cc)
Inside WORKDIR/build/buildscripts we need the full .git/ directory to be available in order for the "revision" file to take the correct git SHA.

(cherry picked from commit 09e2383e5173ab33d3e1914174f3fe6f48b2c26a)
Remove stale comment.

(cherry picked from commit f4e3456993536653bc2b815c8f46eb50f311b3cb)
Revert "add all dependencies needed by libgcc and associates for aix"

This reverts commit 19721c335ae2b8cc6edadeefb1d3eb722c8b60db.

It introduces way more problems than it solves, and in general it is
not safe to assume that the very platform specific libraries libc and
libpthread are going to work on all platforms we install the AIX
package on. This unfortunately also means that we cannot support AIX
platforms with a lower patch level than our build machine.

Redmine #6679.

Conflicts:

	deps-packaging/libgcc/cfbuild-libgcc.spec
(cherry picked from commit 7992a894b49f9a0c56729723fecd95fec94a3ca0)
Redmine #6678: Prevent installation on AIX boxes with old libraries.

We specify libc/pthread dependencies to avoid linking error at run
time.
(cherry picked from commit 03327de62e22e87139e9475b142745e2c180eb58)
Bump minor-patch level for AIX.

We needed one more fix in the packaging, but the 3.6.2 package was
already out.
Bind redis to listen only on local host.

Redmine: #6720
(cherry picked from commit 459fe5cc10240a56bda7f2522faedc03233177e7)