lxc-debian.in revision f7365a247b7582f858fab6a92270c21e43973bf5
642N/A# lxc: linux Container library 642N/A# Daniel Lezcano <daniel.lezcano@free.fr> 642N/A# This library is free software; you can redistribute it and/or 642N/A# modify it under the terms of the GNU Lesser General Public 642N/A# License as published by the Free Software Foundation; either 642N/A# version 2.1 of the License, or (at your option) any later version. 642N/A# This library is distributed in the hope that it will be useful, 642N/A# but WITHOUT ANY WARRANTY; without even the implied warranty of 642N/A# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 642N/A# Lesser General Public License for more details. 642N/A# You should have received a copy of the GNU Lesser General Public 642N/A# License along with this library; if not, write to the Free Software 642N/A# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 642N/A # therefore creating missing device nodes for tty1-4. 642N/A # configure the inittab 642N/Asi::sysinit:/etc/init.d/rcS 642N/Al0:0:wait:/etc/init.d/rc 0 642N/Al1:1:wait:/etc/init.d/rc 1 642N/Al2:2:wait:/etc/init.d/rc 2 642N/Al3:3:wait:/etc/init.d/rc 3 642N/Al4:4:wait:/etc/init.d/rc 4 642N/Al5:5:wait:/etc/init.d/rc 5 642N/Al6:6:wait:/etc/init.d/rc 6 642N/A# Normally not reached, but fallthrough in case of emergency. 642N/Az6:6:respawn:/sbin/sulogin 642N/A1:2345:respawn:/sbin/getty 38400 console 642N/Ac1:12345:respawn:/sbin/getty 38400 tty1 linux 642N/Ac2:12345:respawn:/sbin/getty 38400 tty2 linux 642N/Ac3:12345:respawn:/sbin/getty 38400 tty3 linux 642N/Ac4:12345:respawn:/sbin/getty 38400 tty4 linux 642N/Ap6::ctrlaltdel:/sbin/init 6 642N/Ap0::powerfail:/sbin/init 0 # disable selinux in debian # configure the network using the dhcp cat <<EOF > $rootfs/etc/network/interfaces cat <<EOF > $rootfs/etc/hostname # reconfigure some services # remove pointless services in a container # set initial timezone as on host echo "Timezone in container is not configured. Adjust it manually." echo "Root password is 'root', please change !" # check the mini debian was not already downloaded # download a mini debian into a cache echo "Downloading debian minimal ..." echo "Failed to download the rootfs, aborting." echo "Download complete." # make a local copy of the minidebian echo -n "Copying rootfs to $rootfs..." echo "Cache repository is busy." echo "Failed to download 'debian base'" echo "Failed to copy rootfs" # if there is exactly one veth network entry, make sure it has an cat <<EOF >> $path/config lxc.cap.drop = sys_module mac_admin mac_override sys_time # When using LXC with apparmor, uncomment the next line to run unconfined: #lxc.aa_profile = unconfined lxc.cgroup.devices.deny = a lxc.cgroup.devices.allow = c 1:3 rwm lxc.cgroup.devices.allow = c 1:5 rwm lxc.cgroup.devices.allow = c 5:1 rwm lxc.cgroup.devices.allow = c 5:0 rwm lxc.cgroup.devices.allow = c 4:0 rwm lxc.cgroup.devices.allow = c 4:1 rwm lxc.cgroup.devices.allow = c 1:9 rwm lxc.cgroup.devices.allow = c 1:8 rwm lxc.cgroup.devices.allow = c 136:* rwm lxc.cgroup.devices.allow = c 5:2 rwm lxc.cgroup.devices.allow = c 254:0 rm lxc.mount.entry = proc proc proc nodev,noexec,nosuid 0 0 lxc.mount.entry = sysfs sys sysfs defaults 0 0 echo "Failed to add configuration" # lock, so we won't purge while someone is creating a repository echo "Cache repository is busy." echo -n "Purging the download cache..." $1 -h|--help -p|--path=<path> [-a|--arch] [-r|--release=<release>] [-c|--clean] release: the debian release (e.g. wheezy): defaults to current stable arch: the container architecture (e.g. amd64): defaults to host arch if [
"$arch" =
"i686" ];
then elif [
"$arch" =
"x86_64" ];
then elif [
"$arch" =
"armv7l" ];
then if [
"$arch" ==
"i686" ];
then if [
"$arch" ==
"x86_64" ];
then echo "'debootstrap' command is missing" echo "'path' parameter is required" if [
"$(id -u)" !=
"0" ];
then echo "This script should be run as 'root'" head |awk '/^Codename: (.*)$/ { print $2; }'` echo "Invalid release ${release}, valid ones are: ${valid_releases[*]}" echo "failed to install debian" echo "failed to configure debian for a container" echo "failed write configuration file"