Commit Graph

106 Commits

Author SHA1 Message Date
Stéphane Graber
740ee8c775 Fix check for openpty
The previous implementation of the openpty check was always returning
'no' as openpty is typically defined in util.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2013-01-11 15:59:33 -05:00
Stéphane Graber
9be380b07b Add check for sys/timerfd.h
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2013-01-11 15:14:44 -05:00
Dwight Engen
59ec0a36c7 use pkg-config to ensure python3-devel is installed
The Python.h header varies in location by distribution, so instead use
pkg-config to ensure the python3 devel package is installed. Tested with
Ubuntu 12.04 and Fedora 17. Fixes --enable-python on Fedora 17.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2013-01-11 12:45:48 -05:00
Stéphane Graber
edaf8b1bf1 Add local implementation of mntent.h
Bionic (at least) is missing some of the usual mntent functions.
This adds code defining those that we need when they're missing from the C
library.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2013-01-09 10:22:48 -05:00
Stéphane Graber
ffbf58150c Make utmpx.h optional
This adds code detecting the presence of utmpx.h and in its absence, turns the
utmp related functions into no-ops.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2013-01-09 10:13:59 -05:00
Stéphane Graber
2d76d1d7e5 Workaround missing functions in other libc
Some libc implementation (bionic) is lacking some of the syscall functions
that are present in the glibc.

For those, detect at build time the they are missing and implement a minimal
syscall() wrapper that will essentially give the same result as the glibc
function.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2013-01-09 10:13:45 -05:00
Stéphane Graber
6ff05e18a3 personality.h: Make the personality code optional
Some platforms don't have personality.h in their C library, this change
adds buildtime detection for the header and turns off the personality setting
code in those cases.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2013-01-09 10:13:41 -05:00
Stéphane Graber
495d2046f6 Don't hard depend on capability.h and libcap
In the effort to make LXC work with non-standard Linux distros, this change
allows for the user to build LXC without capability support through a new
--disable-capabilities option to configure.

This effectively will cause LXC not to link against libcap and will turn all
the _cap_ functions into no-ops.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2013-01-09 10:11:56 -05:00
Stéphane Graber
e827ff7e2f tty.h: Ship our own minimal openpty.h
bionic is missing an openpty() function, so ship our own and only
build it and use it on bionic.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2013-01-09 10:10:32 -05:00
Stéphane Graber
1ba0013f21 Support both getline and fgetln
Some libc implementations don't have the getline function but instead
have an equivalent fgetln function.

Add code to detect both and use whatever is available.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2013-01-09 10:09:36 -05:00
Stéphane Graber
8aa4885c22 configure.ac: Cleanup, comments, indent, ...
This commit doesn't do any functional change to configure.ac but does a fair
amount of cleaning up.

It re-orders the various blocks by type (options, checks, expands, ...).
It also consistently uses tabs for indents.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2013-01-09 09:36:25 -05:00
Stéphane Graber
a6168a17ee configure.ac: Add code to detect bionic C library
This adds a new IS_BIONIC define that can be used to detect whether we are
building with eglibc or with bionic.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2013-01-09 09:35:19 -05:00
Natanael Copa
2a9a0a0807 templates: initial support for Alpine Linux
Requires apk-tools (http://git.alpinelinux.org/cgit/apk-tools)

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2012-12-25 12:59:36 +01:00
Daniel Lezcano
56655134e4 Version 0.9.0.alpha2 2012-12-14 09:42:55 +01:00
Daniel Lezcano
d984bb4e75 Version 0.9.0.alpha1
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2012-12-13 21:51:03 +01:00
Serge Hallyn
769872f9f2 support new libseccomp api
Detect the new api by existence in seccomp.h of the scmp_filter_ctx
type in configure.ac.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2012-12-11 12:33:40 -06:00
Stéphane Graber
2495cc911b python: Remove hardcoded LXCPATH
Switch the python scripts to using @LXCPATH@.

According to grep, this was the last occurence of a /var/*/lxc
path in the code.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2012-12-06 09:43:33 -05:00
Stéphane Graber
7c38257226 lxc-ubuntu: Don't hardcode path to cache
Use LOCALSTATEDIR to generate the path to the cache.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2012-12-06 09:43:23 -05:00
Stéphane Graber
6a85cf9124 Install legacy scripts when built without python.
Re-introduce the old lxc-ls script and manpage under a new legacy
sub-directory.

Those will be installed in place of their python equivalent when LXC
is built without --enable-python.

Any other script ported to python should be added to those lists.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2012-12-04 14:01:30 -05:00
Stéphane Graber
4e7186c535 Rewrite lxc-ls in python
This rewrite is mostly compatible with the shell version.
--active and -1 still work and behave as they used to.

This adds --running, --stopped and --frozen as state filters.

A new "fancy" view is also implemented (can be used with --fancy) and
will show containers in a column-based interface with the following fields:
 - name
 - state
 - ipv4
 - ipv6
 - pid of init

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2012-12-04 14:00:56 -05:00
Stéphane Graber
8e100cef8b lxc-ubuntu: Rename from lxc-ubuntu.in
lxc-ubuntu no longer uses any build time variables, therefore it can
now be simply copied to the target without any autoconf magic.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2012-11-29 10:26:26 -05:00
Stéphane Graber
7822022c4c Detect which name to use for docbook2x-man
docbook2x-man doesn't have the same name on Debian based systems as
on RedHat based systems, add some magic to configure.ac to detect and
substitute the proper name in Makefile.am

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2012-11-12 15:38:50 -05:00
Stéphane Graber
ad563aea97 Set automake flags and CFLAGS
Set automake's flags to -Wall -Werror as well as the general
CFLAGS to -Wall and -Werror when building using gcc.

This should catch any regression on build warnings now that we are in
a pretty clean state.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2012-11-12 14:32:39 -05:00
Diego Elio Pettenò
64c3c9020b build: make sure to expand all variables that are substituted.
This fixes lxc-sshd still referring to '${libdir}'.

Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2012-11-12 13:47:44 -05:00
Dwight Engen
6f75ba0bda Add distro config file /etc/lxc/lxc.conf
This allows a distro to put the distro specific default network
configuration (for example bridge device, link type), or other lxc
configuration in the case that -f is not passed by the user to
lxc-create, in which case lxc-create will use the distro conf file as
the basis for the containers config.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2012-11-12 13:18:32 -05:00
Serge Hallyn
708f4a80ea add oracle template (From: Dwight Engen)
This is a new template to create containers based on Oracle Linux. A version
such as 5.8, 6.3, or 6.latest can be specified with -R in which case a rootfs
will be created from rpms downloaded from the Oracle public-yum repo.
Alternatively the path to an existing rootfs of Oracle 5 or 6 may be given to
the template with the -t option.

The architecture of the downloaded rpms installed in the container can be
specified with the -a template option.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2012-11-12 13:18:32 -05:00
Dwight Engen
5b12984bf9 fix expansion of LXCPATH,LXCROOTFSMOUNT,LXCTEMPLATEDIR
These variables are not expanded correctly in doc/lxc-create.sgml.in
and a workaround is in place to ensure ${localstatedir}, and ${datadir}
are set in the various shell scripts that use it. There is no workaround
to ensure ${datadir} is set in src/lxc/lxc-create.in, nor is
${localstatedir} set in templates/lxc-altlinux.in so I think that these
are currently broken.

Using AS_AC_EXPAND instead of AC_SUBST fixes these problems and removes
the need for the workarounds. In addition the lxc-start-ephemeral.in
script can be autoconf'ed instead of sed'ed by the makefile.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
2012-11-12 13:18:31 -05:00
Stéphane Graber
95a717e9b9 Fix previous commit, removing hardcoded /var/lib/lxc from lxc-start-ephemeral
The previous commit was missing part of the changes, leading to a non-working
version of lxc-start-ephemeral.

This commit adds the missing parts.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2012-11-12 13:17:54 -05:00
Stéphane Graber
525421c923 Make building the API tests/examples optional
Add a new --enable-tests option to configure which is used to
optionally build the tests/examples. Default is off.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2012-11-12 13:17:30 -05:00
Stéphane Graber
be2e4e54da Add python-lxc based on the new liblxc API.
This adds a basic python binding done in C and a python overlay to
extend some features and provide a user-friendlier API.

This python API only supports python 3.x and was tested with >= 3.2.

It's disabled by default in configure and can be turned on by using
--enable-python.

A basic example of the API can be found in src/python-lxc/test.py.
More documentation and examples will be added soon.
2012-11-12 13:16:16 -05:00
Stéphane Graber
72d0e1cb2f Merge the liblxc API work by Serge Hallyn.
This turns liblxc into a public library implementing a container structure.
The container structure is meant to cover most LXC commands and can easily be
used to write bindings in other programming languages.

More information on the new functions can be found in src/lxc/lxccontainer.h
Test programs using the API can also be found in src/tests/

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2012-11-12 13:16:16 -05:00
Serge Hallyn
e767dd5599 fix configure.ac for seccomp and apparmor
Use --enable-XXX=check when not specified to get reasonable defaults.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2012-11-12 12:04:30 -05:00
Serge Hallyn
8f2c3a702a Introduce support for seccomp.
Hi,

This patch is so far just a proof of concept.  The libseccomp api will be
changing soon so it probably wouldn't be worth pulling this until it is
updated for the new API.

This patch introduces support for seccomp to lxc.  Seccomp lets a program
restrict its own (and its children's) future access to system calls.  It
uses a simple whitelist system call policy file.  It would probably be
better to switch to something more symbolic (i.e specifying 'open' rather
than the syscall #, especially given container arch flexibility).

I just wanted to get this out there as a first step.  You can also get
source for an ubuntu package based on this patch at
https://code.launchpad.net/~serge-hallyn/ubuntu/quantal/lxc/lxc-seccomp

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
2012-11-12 12:04:30 -05:00
Daniel Lezcano
4aa7ac3569 Version 0.8.0
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2012-11-11 03:34:22 +01:00
Stéphane Graber
8215fe8e41 Remove lxc-start-ephemeral from configure.ac
lxc-start-ephemeral.in ended up in configure.ac as a result of the
cherry-pick. This new tool hasn't been pulled in yet.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2012-10-25 10:43:59 +02:00
Dwight Engen
0b53175846 fix "make rpm"
RPM doesn't like "-" in the version number and gives:
"error: line 24: Illegal char '-' in: Version: 0.8.0-rc2"
Other packages (bind-utils for example) have used . instead
of - as a seperator.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2012-10-25 10:37:38 +02:00
Dwight Engen
d595c68add fix expansion of LXCPATH,LXCROOTFSMOUNT,LXCTEMPLATEDIR
These variables are not expanded correctly in doc/lxc-create.sgml.in
and a workaround is in place to ensure ${localstatedir}, and ${datadir}
are set in the various shell scripts that use it. There is no workaround
to ensure ${datadir} is set in src/lxc/lxc-create.in, nor is
${localstatedir} set in templates/lxc-altlinux.in so I think that these
are currently broken.

Using AS_AC_EXPAND instead of AC_SUBST fixes these problems and removes
the need for the workarounds. In addition the lxc-start-ephemeral.in
script can be autoconf'ed instead of sed'ed by the makefile.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
2012-10-25 10:34:28 +02:00
Stéphane Graber
70542ef9a1 Don't hardcode path to templates
configure.ac used to set the template path to /usr/share/lxc/templates.
Instead use ${datadir} to make it follow ${prefix}.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2012-10-25 10:29:30 +02:00
Serge Hallyn
e075f5d9b6 Introduce apparmor support
This could be done as generic 'lsm_init()' and 'lsm_load()' functions,
however that would make it impossible to compile one package supporting
more than one lsm.  If we explicitly add the selinux, smack, and aa
hooks in the source, then one package can be built to support multiple
kernels.

The smack support should be pretty trivial, and probably very close
to the apparmor support.

The selinux support may require more, including labeling the passed-in
fds (consoles etc) and filesystems.

If someone on the list has the inclination and experience to add selinux
support, please let me know.  Otherwise, I'll do Smack and SELinux.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2012-07-31 16:04:33 +02:00
Serge Hallyn
72be4f89b0 Add lxc-shutdown script
It optionally waits (an optional timeout # of seconds) for the container to
be STOPPED.  If given -r, it reboots the container (and exits immediately).
I decided to add the timeout after all because it's harder to finagle into
an upstart post-stop script than a full bash script.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2012-07-31 16:04:33 +02:00
Daniel Baumann
814463cf0b Trimming directories to use
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2012-07-31 16:01:20 +02:00
David Ward
00ad19d4db lxc-setcap/lxc-setuid: add autoconf expansion for $libexecdir
Support new default location for LXCINITDIR.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2012-05-04 00:50:15 +02:00
David Ward
910bb4fa53 use syscall numbers from Linux kernel headers
__NR_setns is defined in the Linux kernel headers in linux/unistd.h.
The full Linux kernel sources are not necessary for compilation.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2012-05-04 00:50:15 +02:00
Daniel Lezcano
ed55bf5203 lxc-0.8.0-rc2 2012-03-20 23:27:47 +01:00
Daniel Lezcano
09f2410e84 lxc-0.8.0-rc1
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2012-03-02 00:07:06 +01:00
Serge Hallyn
d1458ac8d1 Add ubuntu-cloud template
This is a new template to create containers based on the ubuntu
cloud images, rather than using debootstrap.

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2012-02-26 10:44:40 +01:00
Jon Nordby
ce6ce9d662 fix-automake-1.13
## 0001-Replace-pkglib_PROGRAMS-with-pkglibexec_PROGRAMS.patch [diff]
From 95c566740bba899acc7792c11fcdb3f4d32dcfc9 Mon Sep 17 00:00:00 2001
From: Jon Nordby <jononor@gmail.com>
Date: Fri, 10 Feb 2012 11:38:35 +0100
Subject: [PATCH] Replace pkglib_PROGRAMS with pkglibexec_PROGRAMS

Without this change, autogen.sh fails with automake 1.11.3

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2012-02-23 09:57:26 +01:00
Christian Seiler
49ee6cdcbf Add man page for lxc-attach
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2012-02-23 09:57:14 +01:00
Alexander Vladimirov
f6267d9011 add lxc-archlinux template
Hi, here's the patch which adds Arch linux container template

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-11-10 09:41:46 +01:00
Greg Kurz
1c41ddcb4a fixes for rpmbuild
This patch fixes some makefile/specfile issues when running
rpmbuild with the distributed lxc specfile:

- fixes usage of installation directories for config files,
  rootfs, templates and lxc-init so that they're calculated
  at make time instead of configure time. Thanks to this,
  all installed items go under $RPM_BUILD_ROOT when running
  rpmbuild
- introduce --disable-rpath option to configure to avoid
  check-rpaths errors when building non-root.
- introduce a lxc-libs package in the default spec file
  to allow concurrent installation of 32 bit and 64 bit
  libraries.

v2: - fix circular reference in lxc.pc
    - ship lxc.pc with lxc-devel

Signed-off-by: Greg Kurz <gkurz@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
2011-09-13 15:08:04 +02:00