Merge lp:~ubuntu-branches/ubuntu/quantal/lxc/quantal-201209191812 into lp:ubuntu/quantal/lxc
- Quantal (12.10)
- quantal-201209191812
- Merge into quantal
Status: | Rejected |
---|---|
Rejected by: | James Westby |
Proposed branch: | lp:~ubuntu-branches/ubuntu/quantal/lxc/quantal-201209191812 |
Merge into: | lp:ubuntu/quantal/lxc |
Diff against target: |
1131 lines (+1101/-0) (has conflicts) 4 files modified
.pc/0222-debian-dhcp3-package/templates/lxc-debian.in (+343/-0) .pc/0223-ubuntu-template-user-msg/templates/lxc-ubuntu.in (+714/-0) debian/patches/0222-debian-dhcp3-package (+19/-0) debian/patches/0223-ubuntu-template-user-msg (+25/-0) Conflict adding file .pc/0222-debian-dhcp3-package. Moved existing file to .pc/0222-debian-dhcp3-package.moved. Conflict adding file .pc/0223-ubuntu-template-user-msg. Moved existing file to .pc/0223-ubuntu-template-user-msg.moved. Conflict adding file debian/patches/0222-debian-dhcp3-package. Moved existing file to debian/patches/0222-debian-dhcp3-package.moved. Conflict adding file debian/patches/0223-ubuntu-template-user-msg. Moved existing file to debian/patches/0223-ubuntu-template-user-msg.moved. |
To merge this branch: | bzr merge lp:~ubuntu-branches/ubuntu/quantal/lxc/quantal-201209191812 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu branches | Pending | ||
Review via email: mp+125295@code.launchpad.net |
Commit message
Description of the change
The package importer has detected a possible inconsistency between the package history in the archive and the history in bzr. As the archive is authoritative the importer has made lp:ubuntu/quantal/lxc reflect what is in the archive and the old bzr branch has been pushed to lp:~ubuntu-branches/ubuntu/quantal/lxc/quantal-201209191812. This merge proposal was created so that an Ubuntu developer can review the situations and perform a merge/upload if necessary. There are three typical cases where this can happen.
1. Where someone pushes a change to bzr and someone else uploads the package without that change. This is the reason that this check is done by the importer. If this appears to be the case then a merge/upload should be done if the changes that were in bzr are still desirable.
2. The importer incorrectly detected the above situation when someone made a change in bzr and then uploaded it.
3. The importer incorrectly detected the above situation when someone just uploaded a package and didn't touch bzr.
If this case doesn't appear to be the first situation then set the status of the merge proposal to "Rejected" and help avoid the problem in future by filing a bug at https:/
(this is an automatically generated message)
Unmerged revisions
- 163. By Serge Hallyn
-
releasing version 0.8.0~rc1-4ubuntu36
- 162. By Serge Hallyn
-
0223-ubuntu-
template- user-msg: don't say default user is ubuntu when
it isn't. (LP: #1052315) - 161. By Serge Hallyn
-
0222-debian-
dhcp3-package: fix install of debian testing containers.
(LP: #1052972)
Preview Diff
1 | === added directory '.pc/0222-debian-dhcp3-package' |
2 | === renamed directory '.pc/0222-debian-dhcp3-package' => '.pc/0222-debian-dhcp3-package.moved' |
3 | === added file '.pc/0222-debian-dhcp3-package/.timestamp' |
4 | === added directory '.pc/0222-debian-dhcp3-package/templates' |
5 | === added file '.pc/0222-debian-dhcp3-package/templates/lxc-debian.in' |
6 | --- .pc/0222-debian-dhcp3-package/templates/lxc-debian.in 1970-01-01 00:00:00 +0000 |
7 | +++ .pc/0222-debian-dhcp3-package/templates/lxc-debian.in 2012-09-19 18:19:20 +0000 |
8 | @@ -0,0 +1,343 @@ |
9 | +#!/bin/bash |
10 | + |
11 | +# |
12 | +# lxc: linux Container library |
13 | + |
14 | +# Authors: |
15 | +# Daniel Lezcano <daniel.lezcano@free.fr> |
16 | + |
17 | +# This library is free software; you can redistribute it and/or |
18 | +# modify it under the terms of the GNU Lesser General Public |
19 | +# License as published by the Free Software Foundation; either |
20 | +# version 2.1 of the License, or (at your option) any later version. |
21 | + |
22 | +# This library is distributed in the hope that it will be useful, |
23 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
24 | + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
25 | +# Lesser General Public License for more details. |
26 | + |
27 | +# You should have received a copy of the GNU Lesser General Public |
28 | +# License along with this library; if not, write to the Free Software |
29 | +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
30 | + |
31 | +SUITE=${SUITE:-squeeze} |
32 | +MIRROR=${MIRROR:-http://cdn.debian.net/debian} |
33 | + |
34 | +configure_debian() |
35 | +{ |
36 | + rootfs=$1 |
37 | + hostname=$2 |
38 | + |
39 | + # squeeze only has /dev/tty and /dev/tty0 by default, |
40 | + # therefore creating missing device nodes for tty1-4. |
41 | + for tty in $(seq 1 4); do |
42 | + if [ ! -e $rootfs/dev/tty$tty ]; then |
43 | + mknod $rootfs/dev/tty$tty c 4 $tty |
44 | + fi |
45 | + done |
46 | + |
47 | + # configure the inittab |
48 | + cat <<EOF > $rootfs/etc/inittab |
49 | +id:3:initdefault: |
50 | +si::sysinit:/etc/init.d/rcS |
51 | +l0:0:wait:/etc/init.d/rc 0 |
52 | +l1:1:wait:/etc/init.d/rc 1 |
53 | +l2:2:wait:/etc/init.d/rc 2 |
54 | +l3:3:wait:/etc/init.d/rc 3 |
55 | +l4:4:wait:/etc/init.d/rc 4 |
56 | +l5:5:wait:/etc/init.d/rc 5 |
57 | +l6:6:wait:/etc/init.d/rc 6 |
58 | +# Normally not reached, but fallthrough in case of emergency. |
59 | +z6:6:respawn:/sbin/sulogin |
60 | +1:2345:respawn:/sbin/getty 38400 console |
61 | +c1:12345:respawn:/sbin/getty 38400 tty1 linux |
62 | +c2:12345:respawn:/sbin/getty 38400 tty2 linux |
63 | +c3:12345:respawn:/sbin/getty 38400 tty3 linux |
64 | +c4:12345:respawn:/sbin/getty 38400 tty4 linux |
65 | +p6::ctrlaltdel:/sbin/init 6 |
66 | +p0::powerfail:/sbin/init 0 |
67 | +EOF |
68 | + |
69 | + # disable selinux in debian |
70 | + mkdir -p $rootfs/selinux |
71 | + echo 0 > $rootfs/selinux/enforce |
72 | + |
73 | + # configure the network using the dhcp |
74 | + cat <<EOF > $rootfs/etc/network/interfaces |
75 | +auto lo |
76 | +iface lo inet loopback |
77 | + |
78 | +auto eth0 |
79 | +iface eth0 inet dhcp |
80 | +EOF |
81 | + |
82 | + # set the hostname |
83 | + cat <<EOF > $rootfs/etc/hostname |
84 | +$hostname |
85 | +EOF |
86 | + |
87 | + # reconfigure some services |
88 | + if [ -z "$LANG" ]; then |
89 | + chroot $rootfs locale-gen en_US.UTF-8 UTF-8 |
90 | + chroot $rootfs update-locale LANG=en_US.UTF-8 |
91 | + else |
92 | + chroot $rootfs locale-gen $LANG $(echo $LANG | cut -d. -f2) |
93 | + chroot $rootfs update-locale LANG=$LANG |
94 | + fi |
95 | + |
96 | + # remove pointless services in a container |
97 | + chroot $rootfs /usr/sbin/update-rc.d -f checkroot.sh remove |
98 | + chroot $rootfs /usr/sbin/update-rc.d -f umountfs remove |
99 | + chroot $rootfs /usr/sbin/update-rc.d -f hwclock.sh remove |
100 | + chroot $rootfs /usr/sbin/update-rc.d -f hwclockfirst.sh remove |
101 | + |
102 | + echo "root:root" | chroot $rootfs chpasswd |
103 | + echo "Root password is 'root', please change !" |
104 | + |
105 | + return 0 |
106 | +} |
107 | + |
108 | +cleanup() |
109 | +{ |
110 | + rm -rf $cache/partial-$SUITE-$arch |
111 | + rm -rf $cache/rootfs-$SUITE-$arch |
112 | +} |
113 | + |
114 | +download_debian() |
115 | +{ |
116 | + packages=\ |
117 | +ifupdown,\ |
118 | +locales,\ |
119 | +libui-dialog-perl,\ |
120 | +dialog,\ |
121 | +dhcp3-client,\ |
122 | +netbase,\ |
123 | +net-tools,\ |
124 | +iproute,\ |
125 | +openssh-server |
126 | + |
127 | + cache=$1 |
128 | + arch=$2 |
129 | + |
130 | + trap cleanup EXIT SIGHUP SIGINT SIGTERM |
131 | + # check the mini debian was not already downloaded |
132 | + mkdir -p "$cache/partial-$SUITE-$arch" |
133 | + if [ $? -ne 0 ]; then |
134 | + echo "Failed to create '$cache/partial-$SUITE-$arch' directory" |
135 | + return 1 |
136 | + fi |
137 | + |
138 | + # download a mini debian into a cache |
139 | + echo "Downloading debian minimal ..." |
140 | + debootstrap --verbose --variant=minbase --arch=$arch \ |
141 | + --include=$packages \ |
142 | + "$SUITE" "$cache/partial-$SUITE-$arch" $MIRROR |
143 | + if [ $? -ne 0 ]; then |
144 | + echo "Failed to download the rootfs, aborting." |
145 | + return 1 |
146 | + fi |
147 | + |
148 | + mv "$1/partial-$SUITE-$arch" "$1/rootfs-$SUITE-$arch" |
149 | + echo "Download complete." |
150 | + trap EXIT |
151 | + trap SIGINT |
152 | + trap SIGTERM |
153 | + trap SIGHUP |
154 | + |
155 | + return 0 |
156 | +} |
157 | + |
158 | +copy_debian() |
159 | +{ |
160 | + cache=$1 |
161 | + arch=$2 |
162 | + rootfs=$3 |
163 | + |
164 | + # make a local copy of the minidebian |
165 | + echo -n "Copying rootfs to $rootfs..." |
166 | + mkdir -p $rootfs |
167 | + rsync -a "$cache/rootfs-$SUITE-$arch"/ $rootfs/ || return 1 |
168 | + return 0 |
169 | +} |
170 | + |
171 | +install_debian() |
172 | +{ |
173 | + cache="@LOCALSTATEDIR@/cache/lxc/debian" |
174 | + rootfs=$1 |
175 | + mkdir -p @LOCALSTATEDIR@/lock/subsys/ |
176 | + ( |
177 | + flock -x 200 |
178 | + if [ $? -ne 0 ]; then |
179 | + echo "Cache repository is busy." |
180 | + return 1 |
181 | + fi |
182 | + |
183 | + arch=$(dpkg --print-architecture) |
184 | + |
185 | + echo "Checking cache download in $cache/rootfs-$SUITE-$arch ... " |
186 | + if [ ! -e "$cache/rootfs-$SUITE-$arch" ]; then |
187 | + download_debian $cache $arch |
188 | + if [ $? -ne 0 ]; then |
189 | + echo "Failed to download 'debian base'" |
190 | + return 1 |
191 | + fi |
192 | + fi |
193 | + |
194 | + copy_debian $cache $arch $rootfs |
195 | + if [ $? -ne 0 ]; then |
196 | + echo "Failed to copy rootfs" |
197 | + return 1 |
198 | + fi |
199 | + |
200 | + return 0 |
201 | + |
202 | + ) 200>@LOCALSTATEDIR@/lock/subsys/lxc |
203 | + |
204 | + return $? |
205 | +} |
206 | + |
207 | +copy_configuration() |
208 | +{ |
209 | + path=$1 |
210 | + rootfs=$2 |
211 | + hostname=$3 |
212 | + |
213 | + grep -q "^lxc.rootfs" $path/config 2>/dev/null || echo "lxc.rootfs = $rootfs" >> $path/config |
214 | + cat <<EOF >> $path/config |
215 | +lxc.tty = 4 |
216 | +lxc.pts = 1024 |
217 | +lxc.utsname = $hostname |
218 | +# uncomment the next line to run the container unconfined: |
219 | +#lxc.aa_profile = unconfined |
220 | +lxc.cgroup.devices.deny = a |
221 | +# /dev/null and zero |
222 | +lxc.cgroup.devices.allow = c 1:3 rwm |
223 | +lxc.cgroup.devices.allow = c 1:5 rwm |
224 | +# consoles |
225 | +lxc.cgroup.devices.allow = c 5:1 rwm |
226 | +lxc.cgroup.devices.allow = c 5:0 rwm |
227 | +lxc.cgroup.devices.allow = c 4:0 rwm |
228 | +lxc.cgroup.devices.allow = c 4:1 rwm |
229 | +# /dev/{,u}random |
230 | +lxc.cgroup.devices.allow = c 1:9 rwm |
231 | +lxc.cgroup.devices.allow = c 1:8 rwm |
232 | +lxc.cgroup.devices.allow = c 136:* rwm |
233 | +lxc.cgroup.devices.allow = c 5:2 rwm |
234 | +# rtc |
235 | +lxc.cgroup.devices.allow = c 254:0 rwm |
236 | + |
237 | +# mounts point |
238 | +lxc.mount.entry=proc proc proc nodev,noexec,nosuid 0 0 |
239 | +lxc.mount.entry=sysfs sys sysfs defaults 0 0 |
240 | +EOF |
241 | + |
242 | + if [ $? -ne 0 ]; then |
243 | + echo "Failed to add configuration" |
244 | + return 1 |
245 | + fi |
246 | + |
247 | + return 0 |
248 | +} |
249 | + |
250 | +clean() |
251 | +{ |
252 | + cache="@LOCALSTATEDIR@/cache/lxc/debian" |
253 | + |
254 | + if [ ! -e $cache ]; then |
255 | + exit 0 |
256 | + fi |
257 | + |
258 | + # lock, so we won't purge while someone is creating a repository |
259 | + ( |
260 | + flock -n -x 200 |
261 | + if [ $? != 0 ]; then |
262 | + echo "Cache repository is busy." |
263 | + exit 1 |
264 | + fi |
265 | + |
266 | + echo -n "Purging the download cache..." |
267 | + rm --preserve-root --one-file-system -rf $cache && echo "Done." || exit 1 |
268 | + exit 0 |
269 | + |
270 | + ) 200>@LOCALSTATEDIR@/lock/subsys/lxc |
271 | +} |
272 | + |
273 | +usage() |
274 | +{ |
275 | + cat <<EOF |
276 | +$1 -h|--help -p|--path=<path> --clean |
277 | +EOF |
278 | + return 0 |
279 | +} |
280 | + |
281 | +options=$(getopt -o hp:n:c -l help,path:,name:,clean -- "$@") |
282 | +if [ $? -ne 0 ]; then |
283 | + usage $(basename $0) |
284 | + exit 1 |
285 | +fi |
286 | +eval set -- "$options" |
287 | + |
288 | +while true |
289 | +do |
290 | + case "$1" in |
291 | + -h|--help) usage $0 && exit 0;; |
292 | + -p|--path) path=$2; shift 2;; |
293 | + -n|--name) name=$2; shift 2;; |
294 | + -c|--clean) clean=$2; shift 2;; |
295 | + --) shift 1; break ;; |
296 | + *) break ;; |
297 | + esac |
298 | +done |
299 | + |
300 | +if [ ! -z "$clean" -a -z "$path" ]; then |
301 | + clean || exit 1 |
302 | + exit 0 |
303 | +fi |
304 | + |
305 | +type debootstrap |
306 | +if [ $? -ne 0 ]; then |
307 | + echo "'debootstrap' command is missing" |
308 | + exit 1 |
309 | +fi |
310 | + |
311 | +if [ -z "$path" ]; then |
312 | + echo "'path' parameter is required" |
313 | + exit 1 |
314 | +fi |
315 | + |
316 | +if [ "$(id -u)" != "0" ]; then |
317 | + echo "This script should be run as 'root'" |
318 | + exit 1 |
319 | +fi |
320 | + |
321 | +# detect rootfs |
322 | +config="$path/config" |
323 | +if grep -q '^lxc.rootfs' $config 2>/dev/null ; then |
324 | + rootfs=`grep 'lxc.rootfs =' $config | awk -F= '{ print $2 }'` |
325 | +else |
326 | + rootfs=$path/rootfs |
327 | +fi |
328 | + |
329 | + |
330 | +install_debian $rootfs |
331 | +if [ $? -ne 0 ]; then |
332 | + echo "failed to install debian" |
333 | + exit 1 |
334 | +fi |
335 | + |
336 | +configure_debian $rootfs $name |
337 | +if [ $? -ne 0 ]; then |
338 | + echo "failed to configure debian for a container" |
339 | + exit 1 |
340 | +fi |
341 | + |
342 | +copy_configuration $path $rootfs $name |
343 | +if [ $? -ne 0 ]; then |
344 | + echo "failed write configuration file" |
345 | + exit 1 |
346 | +fi |
347 | + |
348 | +if [ ! -z $clean ]; then |
349 | + clean || exit 1 |
350 | + exit 0 |
351 | +fi |
352 | |
353 | === added directory '.pc/0223-ubuntu-template-user-msg' |
354 | === renamed directory '.pc/0223-ubuntu-template-user-msg' => '.pc/0223-ubuntu-template-user-msg.moved' |
355 | === added file '.pc/0223-ubuntu-template-user-msg/.timestamp' |
356 | === added directory '.pc/0223-ubuntu-template-user-msg/templates' |
357 | === added file '.pc/0223-ubuntu-template-user-msg/templates/lxc-ubuntu.in' |
358 | --- .pc/0223-ubuntu-template-user-msg/templates/lxc-ubuntu.in 1970-01-01 00:00:00 +0000 |
359 | +++ .pc/0223-ubuntu-template-user-msg/templates/lxc-ubuntu.in 2012-09-19 18:19:20 +0000 |
360 | @@ -0,0 +1,714 @@ |
361 | +#!/bin/bash |
362 | + |
363 | +# |
364 | +# template script for generating ubuntu container for LXC |
365 | +# |
366 | +# This script consolidates and extends the existing lxc ubuntu scripts |
367 | +# |
368 | + |
369 | +# Copyright © 2011 Serge Hallyn <serge.hallyn@canonical.com> |
370 | +# Copyright © 2010 Wilhelm Meier |
371 | +# Author: Wilhelm Meier <wilhelm.meier@fh-kl.de> |
372 | +# |
373 | +# This program is free software; you can redistribute it and/or modify |
374 | +# it under the terms of the GNU General Public License version 2, as |
375 | +# published by the Free Software Foundation. |
376 | + |
377 | +# This program is distributed in the hope that it will be useful, |
378 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
379 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
380 | +# GNU General Public License for more details. |
381 | + |
382 | +# You should have received a copy of the GNU General Public License along |
383 | +# with this program; if not, write to the Free Software Foundation, Inc., |
384 | +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
385 | +# |
386 | + |
387 | +set -e |
388 | + |
389 | +if [ -r /etc/default/lxc ]; then |
390 | + . /etc/default/lxc |
391 | +fi |
392 | + |
393 | +configure_ubuntu() |
394 | +{ |
395 | + rootfs=$1 |
396 | + hostname=$2 |
397 | + release=$3 |
398 | + |
399 | + # configure the network using the dhcp |
400 | + cat <<EOF > $rootfs/etc/network/interfaces |
401 | +# This file describes the network interfaces available on your system |
402 | +# and how to activate them. For more information, see interfaces(5). |
403 | + |
404 | +# The loopback network interface |
405 | +auto lo |
406 | +iface lo inet loopback |
407 | + |
408 | +auto eth0 |
409 | +iface eth0 inet dhcp |
410 | +EOF |
411 | + |
412 | + # set the hostname |
413 | + cat <<EOF > $rootfs/etc/hostname |
414 | +$hostname |
415 | +EOF |
416 | + # set minimal hosts |
417 | + cat <<EOF > $rootfs/etc/hosts |
418 | +127.0.0.1 localhost |
419 | +127.0.1.1 $hostname |
420 | + |
421 | +# The following lines are desirable for IPv6 capable hosts |
422 | +::1 ip6-localhost ip6-loopback |
423 | +fe00::0 ip6-localnet |
424 | +ff00::0 ip6-mcastprefix |
425 | +ff02::1 ip6-allnodes |
426 | +ff02::2 ip6-allrouters |
427 | +EOF |
428 | + |
429 | + if [ ! -f $rootfs/etc/init/container-detect.conf ]; then |
430 | + # suppress log level output for udev |
431 | + sed -i "s/=\"err\"/=0/" $rootfs/etc/udev/udev.conf |
432 | + |
433 | + # remove jobs for consoles 5 and 6 since we only create 4 consoles in |
434 | + # this template |
435 | + rm -f $rootfs/etc/init/tty{5,6}.conf |
436 | + fi |
437 | + |
438 | + if [ -z "$bindhome" ]; then |
439 | + chroot $rootfs useradd --create-home -s /bin/bash ubuntu |
440 | + echo "ubuntu:ubuntu" | chroot $rootfs chpasswd |
441 | + fi |
442 | + |
443 | + return 0 |
444 | +} |
445 | + |
446 | +# finish setting up the user in the container by injecting ssh key and |
447 | +# adding sudo group membership. |
448 | +# passed-in user is either 'ubuntu' or the user to bind in from host. |
449 | +finalize_user() |
450 | +{ |
451 | + user=$1 |
452 | + |
453 | + sudo_version=$(chroot $rootfs dpkg-query -W -f='${Version}' sudo) |
454 | + |
455 | + if chroot $rootfs dpkg --compare-versions $sudo_version gt "1.8.3p1-1"; then |
456 | + groups="sudo" |
457 | + else |
458 | + groups="sudo admin" |
459 | + fi |
460 | + |
461 | + for group in $groups; do |
462 | + chroot $rootfs groupadd --system $group >/dev/null 2>&1 || true |
463 | + chroot $rootfs adduser ${user} $group >/dev/null 2>&1 || true |
464 | + done |
465 | + |
466 | + if [ -n "$auth_key" -a -f "$auth_key" ]; then |
467 | + u_path="/home/${user}/.ssh" |
468 | + root_u_path="$rootfs/$u_path" |
469 | + |
470 | + mkdir -p $root_u_path |
471 | + cp $auth_key "$root_u_path/authorized_keys" |
472 | + chroot $rootfs chown -R ${user}: "$u_path" |
473 | + |
474 | + echo "Inserted SSH public key from $auth_key into /home/${user}/.ssh/authorized_keys" |
475 | + fi |
476 | + return 0 |
477 | +} |
478 | + |
479 | +write_sourceslist() |
480 | +{ |
481 | + # $1 => path to the rootfs |
482 | + # $2 => architecture we want to add |
483 | + # $3 => whether to use the multi-arch syntax or not |
484 | + |
485 | + case $2 in |
486 | + amd64|i386) |
487 | + MIRROR=${MIRROR:-http://archive.ubuntu.com/ubuntu} |
488 | + SECURITY_MIRROR=${SECURITY_MIRROR:-http://security.ubuntu.com/ubuntu} |
489 | + ;; |
490 | + *) |
491 | + MIRROR=${MIRROR:-http://ports.ubuntu.com/ubuntu-ports} |
492 | + SECURITY_MIRROR=${SECURITY_MIRROR:-http://ports.ubuntu.com/ubuntu-ports} |
493 | + ;; |
494 | + esac |
495 | + if [ -n "$3" ]; then |
496 | + cat >> "$1/etc/apt/sources.list" << EOF |
497 | +deb [arch=$2] $MIRROR ${release} main restricted universe multiverse |
498 | +deb [arch=$2] $MIRROR ${release}-updates main restricted universe multiverse |
499 | +deb [arch=$2] $SECURITY_MIRROR ${release}-security main restricted universe multiverse |
500 | +EOF |
501 | + else |
502 | + cat >> "$1/etc/apt/sources.list" << EOF |
503 | +deb $MIRROR ${release} main restricted universe multiverse |
504 | +deb $MIRROR ${release}-updates main restricted universe multiverse |
505 | +deb $SECURITY_MIRROR ${release}-security main restricted universe multiverse |
506 | +EOF |
507 | + fi |
508 | +} |
509 | + |
510 | +cleanup() |
511 | +{ |
512 | + rm -rf $cache/partial-$arch |
513 | + rm -rf $cache/rootfs-$arch |
514 | +} |
515 | + |
516 | +suggest_flush() |
517 | +{ |
518 | + echo "Container upgrade failed. The container cache may be out of date," |
519 | + echo "in which case flushing the case (see -F in the hep output) may help." |
520 | +} |
521 | + |
522 | +download_ubuntu() |
523 | +{ |
524 | + cache=$1 |
525 | + arch=$2 |
526 | + release=$3 |
527 | + |
528 | + packages=vim,ssh |
529 | + echo "installing packages: $packages" |
530 | + |
531 | + trap cleanup EXIT SIGHUP SIGINT SIGTERM |
532 | + # check the mini ubuntu was not already downloaded |
533 | + mkdir -p "$cache/partial-$arch" |
534 | + if [ $? -ne 0 ]; then |
535 | + echo "Failed to create '$cache/partial-$arch' directory" |
536 | + return 1 |
537 | + fi |
538 | + |
539 | + # download a mini ubuntu into a cache |
540 | + echo "Downloading ubuntu $release minimal ..." |
541 | + if [ -n "$(which qemu-debootstrap)" ]; then |
542 | + qemu-debootstrap --verbose --components=main,universe --arch=$arch --include=$packages $release $cache/partial-$arch $MIRROR |
543 | + else |
544 | + debootstrap --verbose --components=main,universe --arch=$arch --include=$packages $release $cache/partial-$arch $MIRROR |
545 | + fi |
546 | + |
547 | + if [ $? -ne 0 ]; then |
548 | + echo "Failed to download the rootfs, aborting." |
549 | + return 1 |
550 | + fi |
551 | + |
552 | + # Serge isn't sure whether we should avoid doing this when |
553 | + # $release == `distro-info -d` |
554 | + echo "Installing updates" |
555 | + > $cache/partial-$arch/etc/apt/sources.list |
556 | + write_sourceslist $cache/partial-$arch/ $arch |
557 | + |
558 | + chroot "$1/partial-${arch}" apt-get update |
559 | + if [ $? -ne 0 ]; then |
560 | + echo "Failed to update the apt cache" |
561 | + return 1 |
562 | + fi |
563 | + cat > "$1/partial-${arch}"/usr/sbin/policy-rc.d << EOF |
564 | +#!/bin/sh |
565 | +exit 101 |
566 | +EOF |
567 | + chmod +x "$1/partial-${arch}"/usr/sbin/policy-rc.d |
568 | + |
569 | + lxc-unshare -s MOUNT -- chroot "$1/partial-${arch}" apt-get dist-upgrade -y || { suggest_flush; false; } |
570 | + rm -f "$1/partial-${arch}"/usr/sbin/policy-rc.d |
571 | + |
572 | + chroot "$1/partial-${arch}" apt-get clean |
573 | + |
574 | + mv "$1/partial-$arch" "$1/rootfs-$arch" |
575 | + trap EXIT |
576 | + trap SIGINT |
577 | + trap SIGTERM |
578 | + trap SIGHUP |
579 | + echo "Download complete" |
580 | + return 0 |
581 | +} |
582 | + |
583 | +copy_ubuntu() |
584 | +{ |
585 | + cache=$1 |
586 | + arch=$2 |
587 | + rootfs=$3 |
588 | + |
589 | + # make a local copy of the miniubuntu |
590 | + echo "Copying rootfs to $rootfs ..." |
591 | + mkdir -p $rootfs |
592 | + rsync -a $cache/rootfs-$arch/ $rootfs/ || return 1 |
593 | + return 0 |
594 | +} |
595 | + |
596 | +install_ubuntu() |
597 | +{ |
598 | + rootfs=$1 |
599 | + release=$2 |
600 | + flushcache=$3 |
601 | + cache="/var/cache/lxc/$release" |
602 | + mkdir -p /var/lock/subsys/ |
603 | + |
604 | + ( |
605 | + flock -x 200 |
606 | + if [ $? -ne 0 ]; then |
607 | + echo "Cache repository is busy." |
608 | + return 1 |
609 | + fi |
610 | + |
611 | + |
612 | + if [ $flushcache -eq 1 ]; then |
613 | + echo "Flushing cache..." |
614 | + rm -rf "$cache/partial-$arch" |
615 | + rm -rf "$cache/rootfs-$arch" |
616 | + fi |
617 | + |
618 | + echo "Checking cache download in $cache/rootfs-$arch ... " |
619 | + if [ ! -e "$cache/rootfs-$arch" ]; then |
620 | + download_ubuntu $cache $arch $release |
621 | + if [ $? -ne 0 ]; then |
622 | + echo "Failed to download 'ubuntu $release base'" |
623 | + return 1 |
624 | + fi |
625 | + fi |
626 | + |
627 | + echo "Copy $cache/rootfs-$arch to $rootfs ... " |
628 | + copy_ubuntu $cache $arch $rootfs |
629 | + if [ $? -ne 0 ]; then |
630 | + echo "Failed to copy rootfs" |
631 | + return 1 |
632 | + fi |
633 | + |
634 | + return 0 |
635 | + |
636 | + ) 200>/var/lock/subsys/lxc |
637 | + |
638 | + return $? |
639 | +} |
640 | + |
641 | +copy_configuration() |
642 | +{ |
643 | + path=$1 |
644 | + rootfs=$2 |
645 | + name=$3 |
646 | + arch=$4 |
647 | + release=$5 |
648 | + |
649 | + if [ $arch = "i386" ]; then |
650 | + arch="i686" |
651 | + fi |
652 | + |
653 | + ttydir="" |
654 | + if [ -f $rootfs/etc/init/container-detect.conf ]; then |
655 | + ttydir=" lxc" |
656 | + fi |
657 | + |
658 | + # if there is exactly one veth network entry, make sure it has an |
659 | + # associated hwaddr. |
660 | + nics=`grep -e '^lxc\.network\.type[ \t]*=[ \t]*veth' $path/config | wc -l` |
661 | + if [ $nics -eq 1 ]; then |
662 | + grep -q "^lxc.network.hwaddr" $path/config || cat <<EOF >> $path/config |
663 | +lxc.network.hwaddr = 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//') |
664 | +EOF |
665 | + fi |
666 | + |
667 | + grep -q "^lxc.rootfs" $path/config 2>/dev/null || echo "lxc.rootfs = $rootfs" >> $path/config |
668 | + cat <<EOF >> $path/config |
669 | +lxc.utsname = $name |
670 | + |
671 | +lxc.devttydir =$ttydir |
672 | +lxc.tty = 4 |
673 | +lxc.pts = 1024 |
674 | +lxc.mount = $path/fstab |
675 | +lxc.arch = $arch |
676 | +lxc.cap.drop = sys_module mac_admin mac_override |
677 | +lxc.pivotdir = lxc_putold |
678 | + |
679 | +# uncomment the next line to run the container unconfined: |
680 | +#lxc.aa_profile = unconfined |
681 | + |
682 | +lxc.cgroup.devices.deny = a |
683 | +# Allow any mknod (but not using the node) |
684 | +lxc.cgroup.devices.allow = c *:* m |
685 | +lxc.cgroup.devices.allow = b *:* m |
686 | +# /dev/null and zero |
687 | +lxc.cgroup.devices.allow = c 1:3 rwm |
688 | +lxc.cgroup.devices.allow = c 1:5 rwm |
689 | +# consoles |
690 | +lxc.cgroup.devices.allow = c 5:1 rwm |
691 | +lxc.cgroup.devices.allow = c 5:0 rwm |
692 | +#lxc.cgroup.devices.allow = c 4:0 rwm |
693 | +#lxc.cgroup.devices.allow = c 4:1 rwm |
694 | +# /dev/{,u}random |
695 | +lxc.cgroup.devices.allow = c 1:9 rwm |
696 | +lxc.cgroup.devices.allow = c 1:8 rwm |
697 | +lxc.cgroup.devices.allow = c 136:* rwm |
698 | +lxc.cgroup.devices.allow = c 5:2 rwm |
699 | +# rtc |
700 | +lxc.cgroup.devices.allow = c 254:0 rwm |
701 | +#fuse |
702 | +lxc.cgroup.devices.allow = c 10:229 rwm |
703 | +#tun |
704 | +lxc.cgroup.devices.allow = c 10:200 rwm |
705 | +#full |
706 | +lxc.cgroup.devices.allow = c 1:7 rwm |
707 | +#hpet |
708 | +lxc.cgroup.devices.allow = c 10:228 rwm |
709 | +#kvm |
710 | +lxc.cgroup.devices.allow = c 10:232 rwm |
711 | +EOF |
712 | + |
713 | + cat <<EOF > $path/fstab |
714 | +proc proc proc nodev,noexec,nosuid 0 0 |
715 | +sysfs sys sysfs defaults 0 0 |
716 | +EOF |
717 | + |
718 | + if [ $? -ne 0 ]; then |
719 | + echo "Failed to add configuration" |
720 | + return 1 |
721 | + fi |
722 | + |
723 | + return 0 |
724 | +} |
725 | + |
726 | +trim() |
727 | +{ |
728 | + rootfs=$1 |
729 | + release=$2 |
730 | + |
731 | + # provide the lxc service |
732 | + cat <<EOF > $rootfs/etc/init/lxc.conf |
733 | +# fake some events needed for correct startup other services |
734 | + |
735 | +description "Container Upstart" |
736 | + |
737 | +start on startup |
738 | + |
739 | +script |
740 | + rm -rf /var/run/*.pid |
741 | + rm -rf /var/run/network/* |
742 | + /sbin/initctl emit stopped JOB=udevtrigger --no-wait |
743 | + /sbin/initctl emit started JOB=udev --no-wait |
744 | +end script |
745 | +EOF |
746 | + |
747 | + # fix buggus runlevel with sshd |
748 | + cat <<EOF > $rootfs/etc/init/ssh.conf |
749 | +# ssh - OpenBSD Secure Shell server |
750 | +# |
751 | +# The OpenSSH server provides secure shell access to the system. |
752 | + |
753 | +description "OpenSSH server" |
754 | + |
755 | +start on filesystem |
756 | +stop on runlevel [!2345] |
757 | + |
758 | +expect fork |
759 | +respawn |
760 | +respawn limit 10 5 |
761 | +umask 022 |
762 | +# replaces SSHD_OOM_ADJUST in /etc/default/ssh |
763 | +oom never |
764 | + |
765 | +pre-start script |
766 | + test -x /usr/sbin/sshd || { stop; exit 0; } |
767 | + test -e /etc/ssh/sshd_not_to_be_run && { stop; exit 0; } |
768 | + test -c /dev/null || { stop; exit 0; } |
769 | + |
770 | + mkdir -p -m0755 /var/run/sshd |
771 | +end script |
772 | + |
773 | +# if you used to set SSHD_OPTS in /etc/default/ssh, you can change the |
774 | +# 'exec' line here instead |
775 | +exec /usr/sbin/sshd |
776 | +EOF |
777 | + |
778 | + cat <<EOF > $rootfs/etc/init/console.conf |
779 | +# console - getty |
780 | +# |
781 | +# This service maintains a console on tty1 from the point the system is |
782 | +# started until it is shut down again. |
783 | + |
784 | +start on stopped rc RUNLEVEL=[2345] |
785 | +stop on runlevel [!2345] |
786 | + |
787 | +respawn |
788 | +exec /sbin/getty -8 38400 /dev/console |
789 | +EOF |
790 | + |
791 | + cat <<EOF > $rootfs/lib/init/fstab |
792 | +# /lib/init/fstab: cleared out for bare-bones lxc |
793 | +EOF |
794 | + |
795 | + # reconfigure some services |
796 | + if [ -z "$LANG" ]; then |
797 | + chroot $rootfs locale-gen en_US.UTF-8 |
798 | + chroot $rootfs update-locale LANG=en_US.UTF-8 |
799 | + else |
800 | + chroot $rootfs locale-gen $LANG |
801 | + chroot $rootfs update-locale LANG=$LANG |
802 | + fi |
803 | + |
804 | + # remove pointless services in a container |
805 | + chroot $rootfs /usr/sbin/update-rc.d -f ondemand remove |
806 | + |
807 | + chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls u*.conf); do mv $f $f.orig; done' |
808 | + chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls tty[2-9].conf); do mv $f $f.orig; done' |
809 | + chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls plymouth*.conf); do mv $f $f.orig; done' |
810 | + chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls hwclock*.conf); do mv $f $f.orig; done' |
811 | + chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls module*.conf); do mv $f $f.orig; done' |
812 | + |
813 | + # if this isn't lucid, then we need to twiddle the network upstart bits :( |
814 | + if [ $release != "lucid" ]; then |
815 | + sed -i 's/^.*emission handled.*$/echo Emitting lo/' $rootfs/etc/network/if-up.d/upstart |
816 | + fi |
817 | +} |
818 | + |
819 | +post_process() |
820 | +{ |
821 | + rootfs=$1 |
822 | + release=$2 |
823 | + trim_container=$3 |
824 | + |
825 | + if [ $trim_container -eq 1 ]; then |
826 | + trim $rootfs $release |
827 | + elif [ ! -f $rootfs/etc/init/container-detect.conf ]; then |
828 | + # Make sure we have a working resolv.conf |
829 | + cresolvonf="${rootfs}/etc/resolv.conf" |
830 | + mv $cresolvonf ${cresolvonf}.lxcbak |
831 | + cat /etc/resolv.conf > ${cresolvonf} |
832 | + |
833 | + # for lucid, if not trimming, then add the ubuntu-virt |
834 | + # ppa and install lxcguest |
835 | + if [ $release = "lucid" ]; then |
836 | + chroot $rootfs apt-get update |
837 | + chroot $rootfs apt-get install --force-yes -y python-software-properties |
838 | + chroot $rootfs add-apt-repository ppa:ubuntu-virt/ppa |
839 | + fi |
840 | + |
841 | + chroot $rootfs apt-get update |
842 | + chroot $rootfs apt-get install --force-yes -y lxcguest |
843 | + |
844 | + # Restore old resolv.conf |
845 | + rm -f ${cresolvonf} |
846 | + mv ${cresolvonf}.lxcbak ${cresolvonf} |
847 | + fi |
848 | + |
849 | + # If the container isn't running a native architecture, setup multiarch |
850 | + if [ -x "$(ls -1 ${rootfs}/usr/bin/qemu-*-static 2>/dev/null)" ]; then |
851 | + dpkg_version=$(chroot $rootfs dpkg-query -W -f='${Version}' dpkg) |
852 | + if chroot $rootfs dpkg --compare-versions $dpkg_version ge "1.16.2"; then |
853 | + chroot $rootfs dpkg --add-architecture ${hostarch} |
854 | + else |
855 | + mkdir -p ${rootfs}/etc/dpkg/dpkg.cfg.d |
856 | + echo "foreign-architecture ${hostarch}" > ${rootfs}/etc/dpkg/dpkg.cfg.d/lxc-multiarch |
857 | + fi |
858 | + |
859 | + # Save existing value of MIRROR and SECURITY_MIRROR |
860 | + DEFAULT_MIRROR=$MIRROR |
861 | + DEFAULT_SECURITY_MIRROR=$SECURITY_MIRROR |
862 | + |
863 | + # Write a new sources.list containing both native and multiarch entries |
864 | + > ${rootfs}/etc/apt/sources.list |
865 | + write_sourceslist $rootfs $arch "native" |
866 | + |
867 | + MIRROR=$DEFAULT_MIRROR |
868 | + SECURITY_MIRROR=$DEFAULT_SECURITY_MIRROR |
869 | + write_sourceslist $rootfs $hostarch "multiarch" |
870 | + |
871 | + # Finally update the lists and install upstart using the host architecture |
872 | + chroot $rootfs apt-get update |
873 | + chroot $rootfs apt-get install --force-yes -y --no-install-recommends upstart:${hostarch} mountall:${hostarch} iproute:${hostarch} isc-dhcp-client:${hostarch} |
874 | + fi |
875 | + |
876 | + # rmdir /dev/shm for containers that have /run/shm |
877 | + # I'm afraid of doing rm -rf $rootfs/dev/shm, in case it did |
878 | + # get bind mounted to the host's /run/shm. So try to rmdir |
879 | + # it, and in case that fails move it out of the way. |
880 | + if [ ! -L $rootfs/dev/shm ] && [ -d $rootfs/run/shm ] && [ -e $rootfs/dev/shm ]; then |
881 | + mv $rootfs/dev/shm $rootfs/dev/shm.bak |
882 | + ln -s /run/shm $rootfs/dev/shm |
883 | + fi |
884 | +} |
885 | + |
886 | +do_bindhome() |
887 | +{ |
888 | + rootfs=$1 |
889 | + user=$2 |
890 | + |
891 | + # copy /etc/passwd, /etc/shadow, and /etc/group entries into container |
892 | + pwd=`getent passwd $user` || { echo "Failed to copy password entry for $user"; false; } |
893 | + echo $pwd >> $rootfs/etc/passwd |
894 | + |
895 | + # make sure user's shell exists in the container |
896 | + shell=`echo $pwd | cut -d: -f 7` |
897 | + if [ ! -x $rootfs/$shell ]; then |
898 | + echo "shell $shell for user $user was not found in the container." |
899 | + pkg=`dpkg -S $(readlink -m $shell) | cut -d ':' -f1` |
900 | + echo "Installing $pkg" |
901 | + chroot $rootfs apt-get --force-yes -y install $pkg |
902 | + fi |
903 | + |
904 | + shad=`getent shadow $user` |
905 | + echo "$shad" >> $rootfs/etc/shadow |
906 | + |
907 | + # bind-mount the user's path into the container's /home |
908 | + h=`getent passwd $user | cut -d: -f 6` |
909 | + mkdir -p $rootfs/$h |
910 | + |
911 | + # use relative path in container |
912 | + h2=${h#/} |
913 | + while [ ${h2:0:1} = "/" ]; do |
914 | + h2=${h2#/} |
915 | + done |
916 | + echo "$h $h2 none bind 0 0" >> $path/fstab |
917 | + |
918 | + # Make sure the group exists in container |
919 | + grp=`echo $pwd | cut -d: -f 4` # group number for $user |
920 | + grpe=`getent group $grp` || return 0 # if host doesn't define grp, ignore in container |
921 | + chroot $rootfs getent group "$grpe" || echo "$grpe" >> $rootfs/etc/group |
922 | +} |
923 | + |
924 | +usage() |
925 | +{ |
926 | + cat <<EOF |
927 | +$1 -h|--help [-a|--arch] [-b|--bindhome <user>] [--trim] [-d|--debug] |
928 | + [-F | --flush-cache] [-r|--release <release>] [ -S | --auth-key <keyfile>] |
929 | +release: the ubuntu release (e.g. precise): defaults to host release on ubuntu, otherwise uses latest LTS |
930 | +trim: make a minimal (faster, but not upgrade-safe) container |
931 | +bindhome: bind <user>'s home into the container |
932 | + The ubuntu user will not be created, and <user> will have |
933 | + sudo access. |
934 | +arch: the container architecture (e.g. amd64): defaults to host arch |
935 | +auth-key: SSH Public key file to inject into container |
936 | +EOF |
937 | + return 0 |
938 | +} |
939 | + |
940 | +options=$(getopt -o a:b:hp:r:xn:FS:d -l arch:,bindhome:,help,path:,release:,trim,name:,flush-cache,auth-key:,debug -- "$@") |
941 | +if [ $? -ne 0 ]; then |
942 | + usage $(basename $0) |
943 | + exit 1 |
944 | +fi |
945 | +eval set -- "$options" |
946 | + |
947 | +release=precise # Default to the last Ubuntu LTS release for non-Ubuntu systems |
948 | +if [ -f /etc/lsb-release ]; then |
949 | + . /etc/lsb-release |
950 | + if [ "$DISTRIB_ID" = "Ubuntu" ]; then |
951 | + release=$DISTRIB_CODENAME |
952 | + fi |
953 | +fi |
954 | + |
955 | +bindhome= |
956 | +arch=$(arch) |
957 | + |
958 | +# Code taken from debootstrap |
959 | +if [ -x /usr/bin/dpkg ] && /usr/bin/dpkg --print-architecture >/dev/null 2>&1; then |
960 | + arch=`/usr/bin/dpkg --print-architecture` |
961 | +elif type udpkg >/dev/null 2>&1 && udpkg --print-architecture >/dev/null 2>&1; then |
962 | + arch=`/usr/bin/udpkg --print-architecture` |
963 | +else |
964 | + arch=$(arch) |
965 | + if [ "$arch" = "i686" ]; then |
966 | + arch="i386" |
967 | + elif [ "$arch" = "x86_64" ]; then |
968 | + arch="amd64" |
969 | + elif [ "$arch" = "armv7l" ]; then |
970 | + arch="armel" |
971 | + fi |
972 | +fi |
973 | + |
974 | +debug=0 |
975 | +trim_container=0 |
976 | +hostarch=$arch |
977 | +flushcache=0 |
978 | +while true |
979 | +do |
980 | + case "$1" in |
981 | + -h|--help) usage $0 && exit 0;; |
982 | + -p|--path) path=$2; shift 2;; |
983 | + -n|--name) name=$2; shift 2;; |
984 | + -F|--flush-cache) flushcache=1; shift 1;; |
985 | + -r|--release) release=$2; shift 2;; |
986 | + -b|--bindhome) bindhome=$2; shift 2;; |
987 | + -a|--arch) arch=$2; shift 2;; |
988 | + -x|--trim) trim_container=1; shift 1;; |
989 | + -S|--auth-key) auth_key=$2; shift 2;; |
990 | + -d|--debug) debug=1; shift 1;; |
991 | + --) shift 1; break ;; |
992 | + *) break ;; |
993 | + esac |
994 | +done |
995 | + |
996 | +if [ $debug -eq 1 ]; then |
997 | + set -x |
998 | +fi |
999 | + |
1000 | +if [ -n "$bindhome" ]; then |
1001 | + pwd=`getent passwd $bindhome` |
1002 | + if [ $? -ne 0 ]; then |
1003 | + echo "Error: no password entry found for $bindhome" |
1004 | + exit 1 |
1005 | + fi |
1006 | +fi |
1007 | + |
1008 | + |
1009 | +if [ "$arch" == "i686" ]; then |
1010 | + arch=i386 |
1011 | +fi |
1012 | + |
1013 | +if [ $hostarch = "i386" -a $arch = "amd64" ]; then |
1014 | + echo "can't create amd64 container on i386" |
1015 | + exit 1 |
1016 | +fi |
1017 | + |
1018 | +type debootstrap |
1019 | +if [ $? -ne 0 ]; then |
1020 | + echo "'debootstrap' command is missing" |
1021 | + exit 1 |
1022 | +fi |
1023 | + |
1024 | +if [ -z "$path" ]; then |
1025 | + echo "'path' parameter is required" |
1026 | + exit 1 |
1027 | +fi |
1028 | + |
1029 | +if [ "$(id -u)" != "0" ]; then |
1030 | + echo "This script should be run as 'root'" |
1031 | + exit 1 |
1032 | +fi |
1033 | + |
1034 | +# detect rootfs |
1035 | +config="$path/config" |
1036 | +if grep -q '^lxc.rootfs' $config 2>/dev/null ; then |
1037 | + rootfs=`grep 'lxc.rootfs =' $config | awk -F= '{ print $2 }'` |
1038 | +else |
1039 | + rootfs=$path/rootfs |
1040 | +fi |
1041 | + |
1042 | +install_ubuntu $rootfs $release $flushcache |
1043 | +if [ $? -ne 0 ]; then |
1044 | + echo "failed to install ubuntu $release" |
1045 | + exit 1 |
1046 | +fi |
1047 | + |
1048 | +configure_ubuntu $rootfs $name $release |
1049 | +if [ $? -ne 0 ]; then |
1050 | + echo "failed to configure ubuntu $release for a container" |
1051 | + exit 1 |
1052 | +fi |
1053 | + |
1054 | +copy_configuration $path $rootfs $name $arch $release |
1055 | +if [ $? -ne 0 ]; then |
1056 | + echo "failed write configuration file" |
1057 | + exit 1 |
1058 | +fi |
1059 | + |
1060 | +post_process $rootfs $release $trim_container |
1061 | + |
1062 | +if [ -n "$bindhome" ]; then |
1063 | + do_bindhome $rootfs $bindhome |
1064 | + finalize_user $bindhome |
1065 | +else |
1066 | + finalize_user ubuntu |
1067 | +fi |
1068 | + |
1069 | +echo "" |
1070 | +echo "##" |
1071 | +echo "# The default user is 'ubuntu' with password 'ubuntu'!" |
1072 | +echo "# Use the 'sudo' command to run tasks as root in the container." |
1073 | +echo "##" |
1074 | +echo "" |
1075 | |
1076 | === added file 'debian/patches/0222-debian-dhcp3-package' |
1077 | --- debian/patches/0222-debian-dhcp3-package 1970-01-01 00:00:00 +0000 |
1078 | +++ debian/patches/0222-debian-dhcp3-package 2012-09-19 18:19:20 +0000 |
1079 | @@ -0,0 +1,19 @@ |
1080 | +Description: lxc-debian: specify isc-dhcp-server in package list |
1081 | + dhcp3-client does not exist in testing. |
1082 | +Author: Serge Hallyn <serge.hallyn@ubuntu.com> |
1083 | +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1052972 |
1084 | +Forwarded: yes |
1085 | + |
1086 | +Index: lxc/templates/lxc-debian.in |
1087 | +=================================================================== |
1088 | +--- lxc.orig/templates/lxc-debian.in 2012-09-19 11:22:19.268641000 -0500 |
1089 | ++++ lxc/templates/lxc-debian.in 2012-09-19 11:22:54.312986655 -0500 |
1090 | +@@ -110,7 +110,7 @@ |
1091 | + locales,\ |
1092 | + libui-dialog-perl,\ |
1093 | + dialog,\ |
1094 | +-dhcp3-client,\ |
1095 | ++isc-dhcp-server,\ |
1096 | + netbase,\ |
1097 | + net-tools,\ |
1098 | + iproute,\ |
1099 | |
1100 | === renamed file 'debian/patches/0222-debian-dhcp3-package' => 'debian/patches/0222-debian-dhcp3-package.moved' |
1101 | === added file 'debian/patches/0223-ubuntu-template-user-msg' |
1102 | --- debian/patches/0223-ubuntu-template-user-msg 1970-01-01 00:00:00 +0000 |
1103 | +++ debian/patches/0223-ubuntu-template-user-msg 2012-09-19 18:19:20 +0000 |
1104 | @@ -0,0 +1,25 @@ |
1105 | +Description: lxc-ubuntu: fix printing of default user |
1106 | + If a user is bound into the container, don't claim the default user is |
1107 | + ubuntu. |
1108 | +Author: Serge Hallyn <serge.hallyn@ubuntu.com> |
1109 | +Forwarded: yes |
1110 | +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1052315 |
1111 | + |
1112 | +Index: lxc/templates/lxc-ubuntu.in |
1113 | +=================================================================== |
1114 | +--- lxc.orig/templates/lxc-ubuntu.in 2012-09-19 11:54:39.942250000 -0500 |
1115 | ++++ lxc/templates/lxc-ubuntu.in 2012-09-19 11:56:48.377032378 -0500 |
1116 | +@@ -708,7 +708,11 @@ |
1117 | + |
1118 | + echo "" |
1119 | + echo "##" |
1120 | +-echo "# The default user is 'ubuntu' with password 'ubuntu'!" |
1121 | +-echo "# Use the 'sudo' command to run tasks as root in the container." |
1122 | ++if [ -n "$bindhome" ]; then |
1123 | ++ echo "# Log in as user $bindhome" |
1124 | ++else |
1125 | ++ echo "# The default user is 'ubuntu' with password 'ubuntu'!" |
1126 | ++ echo "# Use the 'sudo' command to run tasks as root in the container." |
1127 | ++fi |
1128 | + echo "##" |
1129 | + echo "" |
1130 | |
1131 | === renamed file 'debian/patches/0223-ubuntu-template-user-msg' => 'debian/patches/0223-ubuntu-template-user-msg.moved' |