Fix lxc-ubuntu and lxc-ubuntu-cloud to properly deal with /dev/shm.

Now that initscripts in Debian and Ubuntu has been updated to no longer
do silly things with /dev/shm and /run/shm on installation/update, the
check needs updating to detect any remaining broken case and fix it.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Use lxc_putold as the pivot_root put dir in the ubuntu templates

By default we use mnt, but that means that lxc fstab entries do not work
when placed under the container's /mnt/.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
Remove duplicate copy of runapitests.bash

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Rename runapitests.bash to runapitests.sh and make it use /bin/sh

This is a simple POSIX shell script, so no need for the weird extension
or for the explicit use of /bin/bash

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Add lxc.aa_profile example to all templates

LXC has optional apparmor support, default profile is lxc-container-default.
This change adds a commented "lxc.aa_profile = default" line to all templates,
uncommenting this will bypass apparmor for the container.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Don't update the host-name field in dhclient.conf when not hardcoded.

On Debian and Ubuntu, the default host-name field in dhclient.conf is
set to either "<hostname>" or "gethostname()" both of which get replaced
by the machine's hostname at query time.

The sed call currently present in lxc-clone hardcodes the hostname in
dhclient.conf, causing dpkg to prompt on isc-dhcp updates.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
lxc-clone: fix handling of lxc.mount entries

The 'lxc.mount =' entry can have more than one space, or tabs, before the =.
We only need to disambiguate from 'lxc.mount.entry'.  So just check for a
space or tab after mount.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
When creating the lxc cgroup directory, ignore -EEXIST

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com
Make lxc-execute without rootfs work.

That means, don't try to pin a null rootfs, and don't try to mount /proc
since /var/lib/lxc/root/proc doesn't exist to be mounted onto.
The apparmor patches are not yet upstream, so this patch will not go
upstream by itself.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
sshd: run dhclient; allow adding a root ssh key

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
Various fedora template improvements

1. don't add network segment to config
2. check for 'curl'
3. don't add $name to $path, it's already in there
4. don't add devpts to fstab, that's wrong.
5. $UTSNAME doesn't exist
6. set root pwd to root instead of rooter.
7. install fedora-release package.
8. add a console on /dev/console.
9. create empty fstab
10. don't mount devpts in rc.sysinit.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
Merge branch 'upstream.1.withpatches' of https://github.com/stgraber/lxc into upstream.1.withpatches