mindref-etc / apply-lxc

#!/bin/sh

if [ -z "`dpkg -s lxc 2>/dev/null | grep 'ok installed'`" ]; then
    apt-get -y install bridge-utils debootstrap lxc
    mkdir /cgroup
    echo "cgroup /cgroup cgroup defaults 0 0" >> /etc/fstab
    mount -a    
fi

iface='/etc/network/interfaces'

if [ -z "`cat $iface | grep br0`" ]; then
    sed -e 's/allow-hotplug eth0/#allow-hotplug eth0/' \
        -e 's/iface eth0/#iface eth0/' $iface > /tmp/x && mv /tmp/x $iface

    cat <<EOF >> $iface
auto br0
iface br0 inet dhcp
    bridge_ports eth0
    bridge_fd 0
    bridge_maxwait 0
EOF

    /etc/init.d/networking restart
fi

if [ ! -h /etc/lxc/packages ]; then
    ln -s /usr/local/etc/lxc/packages /etc/lxc/packages
fi
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.