#!/bin/bash ascii_tarball() { cat < $CONFFILE lxc.utsname = $UTSNAME lxc.network.type = veth lxc.network.flags = up lxc.network.link = br0 lxc.network.ipv4 = $IPV4 lxc.network.name = eth0 lxc.mount = $MNTFILE lxc.rootfs = $ROOTFS EOF cat < $MNTFILE /lib $(pwd)/$ROOTFS/lib none ro,bind 0 0 /bin $(pwd)/$ROOTFS/bin none ro,bind 0 0 /usr $(pwd)/$ROOTFS/usr none ro,bind 0 0 /sbin $(pwd)/$ROOTFS/sbin none ro,bind 0 0 EOF if [ "$(uname -m)" = "x86_64" ]; then cat <> $MNTFILE /lib64 $(pwd)/$ROOTFS/lib64 none ro,bind 0 0 EOF fi @BINDIR@/lxc-create -n $NAME -f $CONFFILE rm -f $MNTFILE rm -f $CONFFILE echo "Done." echo -e "\nYou can run your container with: \n\t\ 'lxc-execute -n $NAME /usr/sbin/sshd &'\n" } destroy() { echo -n "What is the container name ? [$NAME] " read _NAME_ if [ ! -z "$_NAME_" ]; then NAME=$_NAME_ fi ROOTFS="./rootfs.$NAME" echo -n "Shall I remove the rootfs [y/n] ? " read if [ "$REPLY" = "y" ]; then rm -rf $ROOTFS fi @BINDIR@/lxc-destroy -n $NAME } help() { cat <