lxc-cirros.in revision 4165b2c65648b5df521c6e83b1cbad91d0896a00
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano# template script for generating ubuntu container for LXC
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano# This script consolidates and extends the existing lxc ubuntu scripts
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano# Copyright � 2013 Canonical Ltd.
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano# Author: Scott Moser <scott.moser@canonical.com>
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano# This program is free software; you can redistribute it and/or modify
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano# it under the terms of the GNU General Public License version 2, as
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano# published by the Free Software Foundation.
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano# This program is distributed in the hope that it will be useful,
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano# but WITHOUT ANY WARRANTY; without even the implied warranty of
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano# GNU General Public License for more details.
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano# You should have received a copy of the GNU General Public License along
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano# with this program; if not, write to the Free Software Foundation, Inc.,
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1490112767ea6e06ea78e80d905b9dad41051798Daniel LezcanoDOWNLOAD_URL="http://download.cirros-cloud.net/"
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano${0##*/} [options]
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano -a | --arch A architecture to use [${ARCHES[*]}]
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano default: ${DEF_ARCH}
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano -h | --help this usage
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano -v | --verbose increase verbosity
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano -S | --auth-key K insert auth key 'K'
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano -v | --version V version [${STREAMS[*]}]
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano default: ${DEF_VERSION}
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano -u | --userdata U user-data file
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano --tarball T read from tarball 'T' rather than downloading
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano or using cache.
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano --source S insert userdata/metadata via source S
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano [${SOURCES[*]}]
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcanobad_Usage() { Usage 1>&2; [ $# -eq 0 ] || error "$@"; return 1; }
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano local level=${1}; shift;
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano local path=$1 rootfs=$2 name=$3 arch=$4 release=$5
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano# Template used to create this container: cirros
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcanolxc.rootfs = $rootfs
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano#lxc.mount = $path/fstab
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcanolxc.pivotdir = lxc_putold
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcanolxc.pts = 1024
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcanolxc.utsname = $name
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcanolxc.arch = $arch
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcanolxc.cap.drop = sys_module mac_admin mac_override sys_time
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano# When using LXC with apparmor, uncomment the next line to run unconfined:
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano#lxc.aa_profile = unconfined
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano# To support container nesting on an Ubuntu host, uncomment next two lines:
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano#lxc.aa_profile = lxc-container-default-with-nesting
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano#lxc.hook.mount = /usr/share/lxc/hooks/mountcgroups
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcanolxc.cgroup.devices.deny = a
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano# Allow any mknod (but not using the node)
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcanolxc.cgroup.devices.allow = c *:* m
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcanolxc.cgroup.devices.allow = b *:* m
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcano# /dev/null and zero
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcanolxc.cgroup.devices.allow = c 1:3 rwm
1490112767ea6e06ea78e80d905b9dad41051798Daniel Lezcanolxc.cgroup.devices.allow = c 1:5 rwm
while [ $# -ne 0 ]; do
cur=$1; next=$2;