From: KATOH Yasufumi Date: Mon, 13 Jan 2014 11:57:53 +0000 (+0900) Subject: plamo: Update template to use lxc.include and add plamo.common.conf X-Git-Tag: lxc-1.0.0.beta2~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf3e09c00eab82850782ad6ec74e4403d84ae866;p=thirdparty%2Flxc.git plamo: Update template to use lxc.include and add plamo.common.conf Signed-off-by: KATOH Yasufumi Signed-off-by: Serge Hallyn --- diff --git a/config/templates/Makefile.am b/config/templates/Makefile.am index 3c6cc2eb9..e864e1a22 100644 --- a/config/templates/Makefile.am +++ b/config/templates/Makefile.am @@ -1,6 +1,7 @@ templatesconfigdir=@LXCTEMPLATECONFIG@ templatesconfig_DATA = \ + plamo.common.conf \ ubuntu-cloud.common.conf \ ubuntu-cloud.lucid.conf \ ubuntu-cloud.userns.conf \ diff --git a/config/templates/plamo.common.conf.in b/config/templates/plamo.common.conf.in new file mode 100644 index 000000000..50783c3b2 --- /dev/null +++ b/config/templates/plamo.common.conf.in @@ -0,0 +1,26 @@ +# Default console settings +lxc.tty = 4 +lxc.pts = 1024 + +# Default mount +lxc.mount.auto = proc sys cgroup + +# Default capabilities +lxc.cap.drop = sys_module mac_admin mac_override sys_time + +lxc.cgroup.devices.deny = a +# /dev/null and zero +lxc.cgroup.devices.allow = c 1:3 rwm +lxc.cgroup.devices.allow = c 1:5 rwm +# consoles +lxc.cgroup.devices.allow = c 5:0 rwm +lxc.cgroup.devices.allow = c 5:1 rwm +# /dev/{,u}random +lxc.cgroup.devices.allow = c 1:8 rwm +lxc.cgroup.devices.allow = c 1:9 rwm +lxc.cgroup.devices.allow = c 5:2 rwm +lxc.cgroup.devices.allow = c 136:* rwm +# rtc +lxc.cgroup.devices.allow = c 254:0 rm +# fuse +lxc.cgroup.devices.allow = c 10:229 rwm diff --git a/configure.ac b/configure.ac index 327dc7bad..e1536931d 100644 --- a/configure.ac +++ b/configure.ac @@ -532,6 +532,7 @@ AC_CONFIG_FILES([ config/Makefile config/etc/Makefile config/templates/Makefile + config/templates/plamo.common.conf config/templates/ubuntu-cloud.common.conf config/templates/ubuntu-cloud.lucid.conf config/templates/ubuntu-cloud.userns.conf diff --git a/templates/lxc-plamo.in b/templates/lxc-plamo.in index 8705a057b..a40bec723 100644 --- a/templates/lxc-plamo.in +++ b/templates/lxc-plamo.in @@ -28,6 +28,8 @@ # ref. https://github.com/Ponce/lxc-slackware/blob/master/lxc-slackware # lxc-ubuntu script +LXC_TEMPLATE_CONFIG="@LXCTEMPLATECONFIG@" + [ -r /etc/default/lxc ] && . /etc/default/lxc MIRRORSRV=${MIRRORSRV:-"ftp.ne.jp"} @@ -243,35 +245,23 @@ configure_plamo() { } copy_configuration() { + + # Create the fstab (empty by default) + touch $path/fstab + if ! cat <<- EOF >> $path/config ; then lxc.utsname = $name - - lxc.tty = 4 - lxc.pts = 1024 - lxc.mount.auto = proc sys cgroup lxc.arch = $arch - lxc.cap.drop = sys_module mac_admin mac_override sys_time - - lxc.cgroup.devices.deny = a - # /dev/null and zero - lxc.cgroup.devices.allow = c 1:3 rwm - lxc.cgroup.devices.allow = c 1:5 rwm - # consoles - lxc.cgroup.devices.allow = c 5:0 rwm - lxc.cgroup.devices.allow = c 5:1 rwm - # /dev/{,u}random - lxc.cgroup.devices.allow = c 1:8 rwm - lxc.cgroup.devices.allow = c 1:9 rwm - lxc.cgroup.devices.allow = c 5:2 rwm - lxc.cgroup.devices.allow = c 136:* rwm - # rtc - lxc.cgroup.devices.allow = c 254:0 rm - # fuse - lxc.cgroup.devices.allow = c 10:229 rwm + lxc.mount = $path/fstab EOF echo "Failed to add configuration." return 1 fi + + if [ -e "${LXC_TEMPLATE_CONFIG}/plamo.common.conf" ] ; then + echo "lxc.include = ${LXC_TEMPLATE_CONFIG}/plamo.common.conf" >> $path/config + fi + return 0 }