detect APT_PROXY from host apt.conf

Introduce a new HTTP_PROXY variable in /etc/default/lxc.  If unset or
set to none, then behavior continues as before.  If set to 'apt', then
any http::proxy set in apt.conf will be used as http_proxy for
debootstrap, and specified in the container's
/etc/apt/apt.conf.d/70proxy.  If set to something else, then the
value of HTTP_PROXY will be used as http_proxy for debootstrap and
specified in the container's 70proxy.

Changelog: (apr 23) merge the two apt proxy detection functions.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
Support stopping containers concurrently

Trying to stop multiple containers concurrently ends up with "cgroup is not mounted" errors as multiple threads corrupts the shared variables.
Fix that stack corruption and start to use getmntent_r to support stopping multiple containers concurrently.

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
cgroup: Remove unused mntent variables

Spotted by coverity, we were now assigning mntent but only every using
mntent_r, so drop those variables and assignation.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
python: Fix convert_tuple_to_char_pointer_array

This finally fixes a few issues with the magic
convert_tuple_to_char_pointer_array function.

This now clearly copies the char* from the python object so we don't
end up keeping reference to those.

Also add the few required free calls to free the content of the array.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
python: Make the code compatibly with 3.2

The previous change used some 3.3-specific functions.
We still support 3.2 so revert to 3.2-compatible calls.

Reported-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Support starting containers concurrently

Trying to start multiple containers concurrently may cause
lxc_monitor_read_timeout to fail as select call could be
interrupted by a signal, handle it.

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
ubuntu: Don't break when the locale is C.*

Update the code to also match C.* so that C.UTF-8 doesn't make the
container creation fail.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Allow multiple monitor clients

This fixes a long standing issue that there could only be a single
lxc-monitor per container.

With this change, a new lxc-monitord daemon is spawned the first time
lxc-monitor is called against the container and will accept connections
from any subsequent lxc-monitor.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
lxc-create: cleanup whenever exiting with error

Otherwise we leave bad containers sitting around and further confuse
things on retries.

Reported-by: Mukanyiligira Didacienne <siyana223@gmail.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
close fd on error path

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
monitor.c: sanity check on waitpid return value

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Revert "monitor.c: sanity check on waitpid return value"

It's reported to errors in parallel starts.

Reported-by: "S.Çağlar Onur" <caglar@10ur.org>

This reverts commit 6b7916695264238a490971e8cd87612154fc18b1.
configure: support for the "docbook2man" utility to build the documentation

This adds docbook2man as an alternative name for the docbook compiler.
As that name was used on Debian based systems for an older version of the tool,
this change also adds a check so that docbook2man is never used on Debian based
systems.

Signed-off-by: Peter Simons <simons@cryp.to>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>