[lxc-devel] [PATCH 1/2] Add mount hook script to provide systemd containers with minimal /dev
Stéphane Graber
stgraber at ubuntu.com
Mon Dec 10 14:20:17 UTC 2012
I don't believe this is the right way to fix your problem.
Serge and Michael spent quite a while discussing this issue and coming
up with lxc.autodev that's been merged a couple of weeks ago in the
staging branch and does pretty much the same thing as your change, but
the "right way" directly in lxc-start.
On 12/10/2012 12:33 AM, Alexander Vladimirov wrote:
> ---
> Makefile.am | 4 ++--
> configure.ac | 4 ++++
> hooks/Makefile.am | 4 ++++
> hooks/mount.in | 11 +++++++++++
> 4 files changed, 21 insertions(+), 2 deletions(-)
> create mode 100644 hooks/Makefile.am
> create mode 100644 hooks/mount.in
>
> diff --git a/Makefile.am b/Makefile.am
> index 05a03f4..b424f2e 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -2,8 +2,8 @@
>
> ACLOCAL_AMFLAGS = -I config
>
> -SUBDIRS = src templates doc
> -DIST_SUBDIRS = config src templates doc
> +SUBDIRS = src hooks templates doc
> +DIST_SUBDIRS = config src hooks templates doc
> EXTRA_DIST = autogen.sh lxc.spec CONTRIBUTING MAINTAINERS ChangeLog
>
> pcdatadir = $(libdir)/pkgconfig
> diff --git a/configure.ac b/configure.ac
> index 900e1e7..2d4365f 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -73,6 +73,7 @@ AS_AC_EXPAND(LXC_GENERATE_DATE, "$(date)")
> AS_AC_EXPAND(LXCPATH, "${with_config_path}")
> AS_AC_EXPAND(LXCROOTFSMOUNT, "${with_rootfs_path}")
> AS_AC_EXPAND(LXCTEMPLATEDIR, ['${datadir}/lxc/templates'])
> +AS_AC_EXPAND(LXCHOOKDIR, ['${datadir}/lxc/hooks'])
>
> AC_SUBST(LXCINITDIR, ['${libexecdir}'])
>
> @@ -158,6 +159,9 @@ AC_CONFIG_FILES([
> templates/lxc-sshd
> templates/lxc-archlinux
>
> + hooks/Makefile
> + hooks/mount
> +
> src/Makefile
> src/lxc/Makefile
> src/lxc/lxc-ps
> diff --git a/hooks/Makefile.am b/hooks/Makefile.am
> new file mode 100644
> index 0000000..8fbf97c
> --- /dev/null
> +++ b/hooks/Makefile.am
> @@ -0,0 +1,4 @@
> +hooksdir=@LXCHOOKDIR@
> +
> +hooks_SCRIPTS = \
> + mount
> diff --git a/hooks/mount.in b/hooks/mount.in
> new file mode 100644
> index 0000000..46c001e
> --- /dev/null
> +++ b/hooks/mount.in
> @@ -0,0 +1,11 @@
> +#!/bin/sh
> +
> +dev_path="/usr/lib/lxc/rootfs/dev"
> +mkdir -p "${dev_path}/pts"
> +mknod -m 666 "${dev_path}/null" c 1 3
> +mknod -m 666 "${dev_path}/zero" c 1 5
> +mknod -m 666 "${dev_path}/full" c 1 7
> +mknod -m 666 "${dev_path}/random" c 1 8
> +mknod -m 666 "${dev_path}/urandom" c 1 9
> +mknod -m 666 "${dev_path}/tty" c 5 0
> +mknod -m 600 "${dev_path}/console" c 5 1
>
--
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 899 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20121210/9b179bf2/attachment.pgp>
More information about the lxc-devel
mailing list