diff options
author | Bruce Ashfield <bruce.ashfield@windriver.com> | 2015-01-30 00:16:06 -0500 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2015-01-30 00:18:05 -0500 |
commit | 9e1c5f6e85c61839f4bc7dacbbcdcb887e2fc13d (patch) | |
tree | 5f2969845a8f436dc5c9708de7b84a236ce8d5af /recipes-containers | |
parent | 3381e4d5edb309c45ad2b947270f15c8679919c1 (diff) | |
download | meta-virtualization-9e1c5f6e85c61839f4bc7dacbbcdcb887e2fc13d.tar.gz |
lxc: add bridge setup configuration to -setup package
Now that we have a lxc-setup package, we can start to define networking
and other out of the box configuration details for those that opt to
install it.
These are by no means complete, and won't work for everyone, but they are
a start.
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'recipes-containers')
-rw-r--r-- | recipes-containers/lxc/lxc_1.0.7.bb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/recipes-containers/lxc/lxc_1.0.7.bb b/recipes-containers/lxc/lxc_1.0.7.bb index b1f47391..ecad31c9 100644 --- a/recipes-containers/lxc/lxc_1.0.7.bb +++ b/recipes-containers/lxc/lxc_1.0.7.bb | |||
@@ -103,3 +103,36 @@ pkg_postinst_${PN}() { | |||
103 | /etc/init.d/populate-volatile.sh update | 103 | /etc/init.d/populate-volatile.sh update |
104 | fi | 104 | fi |
105 | } | 105 | } |
106 | |||
107 | pkg_postinst_${PN}-setup() { | ||
108 | if [ "x$D" != "x" ]; then | ||
109 | exit 1 | ||
110 | fi | ||
111 | |||
112 | # setup for our bridge | ||
113 | echo "lxc.network.link=lxcbr0" >> ${sysconfdir}/lxc/default.conf | ||
114 | |||
115 | cat >> /etc/network/interfaces << EOF | ||
116 | |||
117 | auto lxcbr0 | ||
118 | iface lxcbr0 inet dhcp | ||
119 | bridge_ports eth0 | ||
120 | bridge_fd 0 | ||
121 | bridge_maxwait 0 | ||
122 | EOF | ||
123 | |||
124 | cat<<EOF>/etc/network/if-pre-up.d/lxcbr0 | ||
125 | #! /bin/sh | ||
126 | |||
127 | if test "x\$IFACE" = xlxcbr0 ; then | ||
128 | brctl show |grep lxcbr0 > /dev/null 2>/dev/null | ||
129 | if [ \$? != 0 ] ; then | ||
130 | brctl addbr lxcbr0 | ||
131 | brctl addif lxcbr0 eth0 | ||
132 | ip addr flush eth0 | ||
133 | ifconfig eth0 up | ||
134 | fi | ||
135 | fi | ||
136 | EOF | ||
137 | chmod 755 /etc/network/if-pre-up.d/lxcbr0 | ||
138 | } | ||