diff -u upstart-1.4/debian/changelog upstart-1.4/debian/changelog --- upstart-1.4/debian/changelog +++ upstart-1.4/debian/changelog @@ -1,3 +1,27 @@ +upstart (1.4-0ubuntu6) precise; urgency=low + + [ Serge Hallyn ] + * debian/conf/container-detect.conf: an upstart job to track whether upstart + detected itself running in a container. + * debian/running-in-container: a script using container.conf to + answer whether upstart is running in a container. + * debian/conf/console.conf: run getty on /dev/console when running + in a lxc container. + * debian/control: conflict with lxcguest. + + [ Stéphane Graber ] + * debian/conf/container-detect.conf: extend to also detect OpenVZ and vserver + as well as write the type in /run/container_type and emit either: + - container CONTAINER=type + (where type is lxc, lxc-libvirt, openvz or vserver) + - not-container + * debian/running-in-container: extend to also print the type of container. + * Rebase debian/conf/console.conf on debian/conf/tty1.conf. + * Update tty[1234].conf to start on regular machines and LXC containers. + * Update tty[56].conf to only start on regular machines. + + -- Stéphane Graber Wed, 08 Feb 2012 16:44:59 -0500 + upstart (1.4-0ubuntu5) precise; urgency=low * Merge of important upstream log fixes to handle scenario attempts diff -u upstart-1.4/debian/control upstart-1.4/debian/control --- upstart-1.4/debian/control +++ upstart-1.4/debian/control @@ -12,7 +12,7 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, sysvinit-utils, sysv-rc, initscripts, mountall, ifupdown (>= 0.6.10ubuntu5) Suggests: python, graphviz, bash-completion Replaces: upstart-job, sysvinit, upstart-compat-sysv, startup-tasks, system-services -Conflicts: upstart-job, sysvinit, upstart-compat-sysv, startup-tasks, system-services +Conflicts: upstart-job, sysvinit, upstart-compat-sysv, startup-tasks, system-services, lxcguest Provides: upstart-job, upstart-compat-sysv, startup-tasks, system-services Breaks: libc6 (<< 2.12.1-0ubuntu12), friendly-recovery (<< 0.2.13) Multi-Arch: foreign diff -u upstart-1.4/debian/upstart.install upstart-1.4/debian/upstart.install --- upstart-1.4/debian/upstart.install +++ upstart-1.4/debian/upstart.install @@ -4,0 +5 @@ +debian/running-in-container bin/ diff -u upstart-1.4/debian/conf/tty5.conf upstart-1.4/debian/conf/tty5.conf --- upstart-1.4/debian/conf/tty5.conf +++ upstart-1.4/debian/conf/tty5.conf @@ -3,7 +3,8 @@ # This service maintains a getty on tty5 from the point the system is # started until it is shut down again. -start on runlevel [23] +start on runlevel [23] and not-container + stop on runlevel [!23] respawn diff -u upstart-1.4/debian/conf/tty6.conf upstart-1.4/debian/conf/tty6.conf --- upstart-1.4/debian/conf/tty6.conf +++ upstart-1.4/debian/conf/tty6.conf @@ -3,7 +3,8 @@ # This service maintains a getty on tty6 from the point the system is # started until it is shut down again. -start on runlevel [23] +start on runlevel [23] and not-container + stop on runlevel [!23] respawn diff -u upstart-1.4/debian/conf/tty2.conf upstart-1.4/debian/conf/tty2.conf --- upstart-1.4/debian/conf/tty2.conf +++ upstart-1.4/debian/conf/tty2.conf @@ -3,7 +3,11 @@ # This service maintains a getty on tty2 from the point the system is # started until it is shut down again. -start on runlevel [23] +start on runlevel [23] and ( + not-container or + container CONTAINER=lxc or + container CONTAINER=lxc-libvirt) + stop on runlevel [!23] respawn diff -u upstart-1.4/debian/conf/tty1.conf upstart-1.4/debian/conf/tty1.conf --- upstart-1.4/debian/conf/tty1.conf +++ upstart-1.4/debian/conf/tty1.conf @@ -3,7 +3,11 @@ # This service maintains a getty on tty1 from the point the system is # started until it is shut down again. -start on stopped rc RUNLEVEL=[2345] +start on stopped rc RUNLEVEL=[2345] and ( + not-container or + container CONTAINER=lxc or + container CONTAINER=lxc-libvirt) + stop on runlevel [!2345] respawn diff -u upstart-1.4/debian/conf/tty3.conf upstart-1.4/debian/conf/tty3.conf --- upstart-1.4/debian/conf/tty3.conf +++ upstart-1.4/debian/conf/tty3.conf @@ -3,7 +3,11 @@ # This service maintains a getty on tty3 from the point the system is # started until it is shut down again. -start on runlevel [23] +start on runlevel [23] and ( + not-container or + container CONTAINER=lxc or + container CONTAINER=lxc-libvirt) + stop on runlevel [!23] respawn diff -u upstart-1.4/debian/conf/tty4.conf upstart-1.4/debian/conf/tty4.conf --- upstart-1.4/debian/conf/tty4.conf +++ upstart-1.4/debian/conf/tty4.conf @@ -3,7 +3,11 @@ # This service maintains a getty on tty4 from the point the system is # started until it is shut down again. -start on runlevel [23] +start on runlevel [23] and ( + not-container or + container CONTAINER=lxc or + container CONTAINER=lxc-libvirt) + stop on runlevel [!23] respawn only in patch2: unchanged: --- upstart-1.4.orig/debian/running-in-container +++ upstart-1.4/debian/running-in-container @@ -0,0 +1,10 @@ +#!/bin/sh +# Return 0 if in a container, 1 if not +# if in a container, also print the container type +status container-detect 2>/dev/null | grep -q start + +if [ $? -eq 0 ]; then + [ -f /run/container_type ] && cat /run/container_type + exit 0 +fi +exit 1 only in patch2: unchanged: --- upstart-1.4.orig/debian/conf/console.conf +++ upstart-1.4/debian/conf/console.conf @@ -0,0 +1,11 @@ +# console - getty +# +# This service maintains a getty on console from the point the system is +# started until it is shut down again. + +start on stopped rc RUNLEVEL=[2345] and container CONTAINER=lxc + +stop on runlevel [!2345] + +respawn +exec /sbin/getty -8 38400 console only in patch2: unchanged: --- upstart-1.4.orig/debian/conf/container-detect.conf +++ upstart-1.4/debian/conf/container-detect.conf @@ -0,0 +1,42 @@ +description "Track if upstart is running in a container" + +start on mounted MOUNTPOINT=/run + +env container +env LIBVIRT_LXC_UUID + +emits container +emits not-container + +pre-start script + # The "standard" way of telling if we are in a container + # is to check for "container" in init's environment. + # The code below is for cases where it's not set. + + # Detect old-style libvirt + if [ -z "$container" ]; then + [ -n "$LIBVIRT_LXC_UUID" ] && container=lxc-libvirt + fi + + # Detect OpenVZ containers + if [ -z "$container" ]; then + [ -d /proc/vz ] && [ ! -d /proc/bc ] && container=openvz + fi + + # Detect Vserver containers + if [ -z "$container" ]; then + VXID="$(cat /proc/self/status | grep ^VxID | cut -f2)" || true + [ "${VXID:-0}" -gt 1 ] && container=vserver + fi + + if [ -n "$container" ]; then + echo "$container" > /run/container_type || true + initctl emit --no-wait container CONTAINER=$container + exit 0 + fi + + # If not a container, stop there + rm -f /run/container_type + initctl emit --no-wait not-container + stop +end script