lxc-debian.in revision 8da006e44b58824d803fe6586fb5174e8e2ebb6a
ca68055161f6beb2ec248e789ab787e6de69bd18Christian Clausen# lxc: linux Container library
ca68055161f6beb2ec248e789ab787e6de69bd18Christian Clausen# Daniel Lezcano <daniel.lezcano@free.fr>
ca68055161f6beb2ec248e789ab787e6de69bd18Christian Clausen# This library is free software; you can redistribute it and/or
ca68055161f6beb2ec248e789ab787e6de69bd18Christian Clausen# modify it under the terms of the GNU Lesser General Public
ca68055161f6beb2ec248e789ab787e6de69bd18Christian Clausen# License as published by the Free Software Foundation; either
ca68055161f6beb2ec248e789ab787e6de69bd18Christian Clausen# version 2.1 of the License, or (at your option) any later version.
ca68055161f6beb2ec248e789ab787e6de69bd18Christian Clausen# This library is distributed in the hope that it will be useful,
ca68055161f6beb2ec248e789ab787e6de69bd18Christian Clausen# but WITHOUT ANY WARRANTY; without even the implied warranty of
ca68055161f6beb2ec248e789ab787e6de69bd18Christian Clausen# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
ca68055161f6beb2ec248e789ab787e6de69bd18Christian Clausen# Lesser General Public License for more details.
ca68055161f6beb2ec248e789ab787e6de69bd18Christian Clausen# You should have received a copy of the GNU Lesser General Public
ca68055161f6beb2ec248e789ab787e6de69bd18Christian Clausen# License along with this library; if not, write to the Free Software
ca68055161f6beb2ec248e789ab787e6de69bd18Christian Clausen# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
ca68055161f6beb2ec248e789ab787e6de69bd18Christian Clausen# Detect use under userns (unsupported)
rootfs=$1
hostname=$2
num_tty=$3
$(for tty in $(seq 1 "$num_tty"); do echo "c${tty}:12345:respawn:/sbin/getty 38400 tty${tty} linux" ; done;)
-i /etc/locale.gen 2> /dev/null
DPKG_MAINTSCRIPT_PACKAGE=openssh DPKG_MAINTSCRIPT_NAME=postinst chroot "$rootfs" /var/lib/dpkg/info/openssh-server.postinst configure
path=$1
rootfs=$2
config=$3
num_tty=$4
local tty_services
packages=\
$init,\
ifupdown,\
locales,\
dialog,\
netbase,\
iproute,\
cache=$1
arch=$2
release=$3
if [ ! -f $releasekeyring ]; then
wget https://ftp-master.debian.org/keys/${gpgkeyname}.asc -O - --quiet \
if [ $? -ne 0 ]; then
if [ $? -ne 0 ]; then
trap EXIT
trap SIGINT
trap SIGTERM
trap SIGHUP
cache=$1
arch=$2
rootfs=$3
release=$4
rootfs=$1
release=$2
arch=$3
flock -x 9
if [ $? -ne 0 ]; then
if [ $? -ne 0 ]; then
if [ $? -ne 0 ]; then
path=$1
rootfs=$2
hostname=$3
arch=$4
num_tty=$5
grep -q "^lxc.network.hwaddr" "$path/config" || sed -i -e "/^lxc\.network\.type[ \t]*=[ \t]*veth/a lxc.network.hwaddr = 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//')" "$path/config"
if [ $? -ne 0 ]; then
local pack_list
flock -x 9
cat <<EOF
SECURITY_MIRROR The Debian package security mirror to use. See also the --security-mirror switch above.
options=$(getopt -o hp:n:a:r:c -l arch:,clean,help,enable-non-free,mirror:,name:,packages:,path:,release:,rootfs:,security-mirror: -- "$@")
eval set -- "$options"
type debootstrap
if [ -z "$path" ]; then
current_release=$(wget "${MIRROR}/dists/stable/Release" -O - 2> /dev/null | head |awk '/^Codename: (.*)$/ { print $2; }')
if [ -z "$rootfs" ]; then
if [ ! -z "$clean" ]; then