From daaf41b36790bdaae855048e56ed090b17a77c97 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Graber?= Date: Mon, 18 Feb 2013 18:59:42 -0500 Subject: [PATCH] lxc-ubuntu{-cloud}: Config layout tweaking MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This commit tweaks the layout of the config file for the Ubuntu templates. With this, we now get a clear network config group, then a path related group, then a bunch of random config options and the end of the config is apparmor, capabilities and cgroups. Signed-off-by: Stéphane Graber Acked-by: Serge Hallyn --- templates/lxc-ubuntu-cloud.in | 14 +++++++------- templates/lxc-ubuntu.in | 11 +++++------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/templates/lxc-ubuntu-cloud.in b/templates/lxc-ubuntu-cloud.in index de9f3c31d..9ee8fb127 100644 --- a/templates/lxc-ubuntu-cloud.in +++ b/templates/lxc-ubuntu-cloud.in @@ -41,21 +41,21 @@ copy_configuration() # associated hwaddr. nics=`grep -e '^lxc\.network\.type[ \t]*=[ \t]*veth' $path/config | wc -l` if [ $nics -eq 1 ]; then - grep -q "^lxc.network.hwaddr" $path/config || cat <> $path/config -lxc.network.hwaddr = 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//') -EOF + grep -q "^lxc.network.hwaddr" $path/config || sed -i -e "/^lxc\.network\.type[ \t]*=[ \t]*veth/a lxc.network.hwaddr = 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//')" $path/config fi grep -q "^lxc.rootfs" $path/config 2>/dev/null || echo "lxc.rootfs = $rootfs" >> $path/config cat <> $path/config -lxc.utsname = $name +lxc.mount = $path/fstab +lxc.pivotdir = lxc_putold +lxc.devttydir =$ttydir lxc.tty = 4 lxc.pts = 1024 -lxc.mount = $path/fstab + +lxc.utsname = $name lxc.arch = $arch -lxc.cap.drop = sys_module mac_admin -lxc.pivotdir = lxc_putold +lxc.cap.drop = sys_module mac_admin mac_override # When using LXC with apparmor, uncomment the next line to run unconfined: #lxc.aa_profile = unconfined diff --git a/templates/lxc-ubuntu.in b/templates/lxc-ubuntu.in index a2fc95201..39c5a1c42 100644 --- a/templates/lxc-ubuntu.in +++ b/templates/lxc-ubuntu.in @@ -319,22 +319,21 @@ copy_configuration() # associated hwaddr. nics=`grep -e '^lxc\.network\.type[ \t]*=[ \t]*veth' $path/config | wc -l` if [ $nics -eq 1 ]; then - grep -q "^lxc.network.hwaddr" $path/config || cat <> $path/config -lxc.network.hwaddr = 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//') -EOF + grep -q "^lxc.network.hwaddr" $path/config || sed -i -e "/^lxc\.network\.type[ \t]*=[ \t]*veth/a lxc.network.hwaddr = 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//')" $path/config fi grep -q "^lxc.rootfs" $path/config 2>/dev/null || echo "lxc.rootfs = $rootfs" >> $path/config cat <> $path/config -lxc.utsname = $name +lxc.mount = $path/fstab +lxc.pivotdir = lxc_putold lxc.devttydir =$ttydir lxc.tty = 4 lxc.pts = 1024 -lxc.mount = $path/fstab + +lxc.utsname = $name lxc.arch = $arch lxc.cap.drop = sys_module mac_admin mac_override -lxc.pivotdir = lxc_putold # When using LXC with apparmor, uncomment the next line to run unconfined: #lxc.aa_profile = unconfined -- 2.47.2