Rework init scripts

This commit is based on the work of:
    Signed-off-by: Michael H. Warfield <mhw@WittsEnd.com>

A generic changelog would be:
 - Bring support for lxcbr0 to all distributions
 - Share the container startup and network configuration logic across
   distributions and init systems.
 - Have all the init scripts call the helper script.
 - Support for the various different distro-specific configuration
   locations to configure lxc-net and container startup.

Changes on top of Mike's original version:
 - Remove sysconfig/lxc-net as it's apparently only there as a
   workaround for an RPM limitation and is breaking Debian systems by
   including a useless file which will get registered as a package provided
   conffile in the dpkg database and will therefore cause conffile prompts
   on upgrades...
 - Go with a consistant coding style in the various init scripts.
 - Split out the common logic from the sysvinit scripts and ship both in
   their respective location rather than have them be copies.
 - Fix the upstart jobs so they actually work (there's no such thing as
   libexec on Debian systems).

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
fixups to init script rework

- move action() from common to sysvinit wrapper since its only really
  applicable for sysvinit and not the other init systems

- fix bug in action() fallback, need to shift away msg before executing action

- make lxc-net 98 so it starts before lxc-container (99), otherwise the lxcbr0
  won't be available when containers are autostarted

- make the default RUNTIME_PATH be /var/run instead of /run. On older
  distros (like ol6.5) /run doesn't exist. lxc-net will create this directory
  and attempt to create the dnsmasq.pid file in it, but this will fail when
  SELinux is enabled because the directory will have the default_t type.
  Newer systems have /var/run symlinked to /run so you get to the same place
  in that case.

- add %postun to remove lxc-dnsmasq user when pkgs are removed

- fix bug in lxc-oracle template that was creating /var/lock/subsys/lxc as
  a dir and interfering with the init scripts

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
add file/func/line to debug info

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
apparmor: restrict signal and ptrace for processes

Restrict signal and ptrace for processes running under the container
profile. Rules based on AppArmor base abstraction. Add unix rules for
processes running under the container profile.

Signed-off-by: Jamie Strandboge <jamie@canonical.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
sysconfig/lxc: Reverse sourcing logic

This prevents scripts running with -e to fail when lxc-net doesn't
exist.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
pivot_root: umount ., not /

This fixes pivot_root on 3.11 and older kernels.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
change version to 1.1.0.alpha1 in configure.ac

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