diff -u xen-tools-3.9/debian/changelog xen-tools-3.9/debian/changelog --- xen-tools-3.9/debian/changelog +++ xen-tools-3.9/debian/changelog @@ -1,3 +1,12 @@ +xen-tools (3.9-3ubuntu1) intrepid; urgency=low + + * Merge from debian unstable, remaining changes: + - debian/control: Bumped Standards version to 3.8.0 + - debian/control: Updated uploaders field according to debian +maintainer spec + * Dropped ubuntu changes + + -- Bhavani Shankar Tue, 05 Aug 2008 11:29:06 +0530 + xen-tools (3.9-3) unstable; urgency=medium - Ensure that Fedora guests get /dev/pts mounted. @@ -37,6 +46,50 @@ -- Steve Kemp Fri, 1 Feb 2007 19:22:01 +0000 +xen-tools (3.8-4ubuntu4) hardy; urgency=low + + * Added hardy support. + * Default to xvda. + * Added ubuntu fixes. + + -- Chuck Short Sat, 05 Apr 2008 20:53:47 -0400 + +xen-tools (3.8-4ubuntu3) hardy; urgency=low + + * Added hooks/gutsy/100-ubuntu-fixups. + - Added various fixes to get a ubuntu guest working properly. + - Default to xvda for hardy and gutsy guests. + - Added hardy support. + + -- Chuck Short Thu, 03 Apr 2008 20:25:39 -0400 + +xen-tools (3.8-4ubuntu2) hardy; urgency=low + + * Actually create the xvda devices when selecting xvda in the xen-tools.conf + + -- Chuck Short Sun, 16 Mar 2008 15:19:31 -0400 + +xen-tools (3.8-4ubuntu1) hardy; urgency=low + + * Merge from debian unstable, remaining changes: + - Dropped Ubuntu changes. + + -- Chuck Short Wed, 21 Nov 2007 19:24:20 +0000 + +xen-tools (3.8-4) unstable; urgency=high + + * Ensure role scripts actually work. + * Added --debug flag to dump command line options. + + -- Steve Kemp Tues, 16 Oct 2007 21:39:31 +0000 + +xen-tools (3.8-2) unstable; urgency=medium + + * Ensure xvc0 + hvc0 are added to /etc/securetty of new guests. + (Closes: #442926) + + -- Steve Kemp Tue, 9 Oct 2007 19:46:44 +0000 + xen-tools (3.8-1) unstable; urgency=low [ Steve Kemp ] @@ -85,6 +138,22 @@ -- Steve Kemp Tue, 10 Jul 2007 20:35:34 +0000 +xen-tools (3.5-1ubuntu2) gutsy; urgency=low + + * Update debian/control. + - Removed dependency on non-pae xen-hypervisor + * Added support for xvc0 and xvda. Backported from xen-tools cvs (Closes: LP# 139046) + * Added support for feisty and gutsy. + + -- Chuck Short Sat, 15 Sep 2007 09:55:12 -0400 + +xen-tools (3.5-1ubuntu1) gutsy; urgency=low + + * Merge from debian unstable, remaining changes: + - Depends on xen-3.1-386 and xen-3.1-386-pae + + -- Chuck Short Thu, 21 Jun 2007 10:15:06 +0100 + xen-tools (3.5-1) unstable; urgency=low * Only add Debian sources for security.debian.org if enabled upon the host. @@ -97,6 +166,14 @@ -- Steve Kemp Sun, 16 Jun 2007 14:43:00 +0000 +xen-tools (3.4-1ubuntu1) gutsy; urgency=low + + * Merge from Debian unstable. Remaining Ubuntu changes: + - deleted debian reccomends in favour of ubuntu ones + (caused by a conflict) + + -- Andrea Veri Sun, 3 Jun 2007 11:31:05 +0200 + xen-tools (3.4-1) unstable; urgency=low [ Steve Kemp ] @@ -120,6 +197,14 @@ -- Radu Spineanu Fri, 12 May 2007 19:09:09 +0200 +xen-tools (3.2-1ubuntu1) gutsy; urgency=low + + * Merge from Debian unstable. Remaining Ubuntu changes: + - deleted debian reccomends in favour of ubuntu ones + * Modify Maintainer value to match Debian-Maintainer-Field Spec + + -- Andrea Veri Sun, 6 May 2007 22:51:26 +0200 + xen-tools (3.2-1) unstable; urgency=low [ Steve Kemp ] @@ -143,6 +228,13 @@ -- Radu Spineanu Sun, 25 Mar 2007 21:35:06 +0300 +xen-tools (3.1-1ubuntu1) feisty; urgency=low + + * Merge from debian unstable, remaining changes: + - No Ubuntu changes + + -- Chuck Short Wed, 27 Dec 2006 21:15:11 +0000 + xen-tools (3.1-1) unstable; urgency=low [ Steve Kemp ] @@ -183,6 +275,14 @@ -- Radu Spineanu Mon, 4 Dec 2006 16:55:31 +0200 +xen-tools (2.8-2ubuntu1) feisty; urgency=low + + * Merge from debian unstable. + - Updated debian/control. + - Removed ubuntu changes since they are now merged upstream. + + -- Chuck Short Mon, 20 Nov 2006 03:02:00 +0000 + xen-tools (2.8-2) unstable; urgency=low * Support Upstart in hook 30-fix-inittab (Closes: #399153) @@ -343,6 +443,28 @@ -- Steve Kemp Sat, 22 Jul 2006 16:59:39 +0000 +xen-tools (2.1-4ubuntu2) edgy; urgency=low + + * Updated Recommends to xen-hypervisor-3.0-i386-pae or + xen-hypervisor-3.0-i386. (Closes: #49903). + * Avoid changing console types to "console" so that job control + remains available (stolen from xen-tools cvs). + + -- Chuck Short Tue, 5 Sep 2006 20:52:22 -0400 + +xen-tools (2.1-4ubuntu1) edgy; urgency=low + + * Added the ability to create an edgy host. + + -- Chuck Short Thu, 17 Aug 2006 19:38:40 -0400 + +xen-tools (2.1-3) unstable; urgency=high + + * Avoid running the test suite, since the permissions of new files to + the package can't be fixed in the .diff.gz. + + -- Steve Kemp Thur, 29 Jun 2006 11:05:58 +0000 + xen-tools (2.1-2) unstable; urgency=high * CVS snapshot to fix RC bugs and allow package into testing. diff -u xen-tools-3.9/debian/control xen-tools-3.9/debian/control --- xen-tools-3.9/debian/control +++ xen-tools-3.9/debian/control @@ -1,10 +1,11 @@ Source: xen-tools Section: utils Priority: extra -Maintainer: Roland Stigge +Maintainer: Ubuntu MOTU Developers +XSBC-Original-Maintainer: Roland Stigge Uploaders: Radu Spineanu , Steve Kemp Build-Depends: debhelper (>= 4.0.0), libtest-pod-perl, libtext-template-perl -Standards-Version: 3.7.3 +Standards-Version: 3.8.0 Homepage: http://xen-tools.org/software/xen-tools Package: xen-tools only in patch2: unchanged: --- xen-tools-3.9.orig/etc/xm.tmpl +++ xen-tools-3.9/etc/xm.tmpl @@ -1,4 +1,4 @@ -# + # Configuration file for the Xen instance {$hostname}, created # by xen-tools {$xen_tools_version} on { scalar localtime }. # @@ -81,6 +81,7 @@ on_reboot = 'restart' on_crash = 'restart' +extra = '2 console=xvc0' { if ( $admins ) { only in patch2: unchanged: --- xen-tools-3.9.orig/etc/xen-tools.conf +++ xen-tools-3.9/etc/xen-tools.conf @@ -257,8 +257,8 @@ # serial_device = tty1 #default # serial_device = xvc0 # -# disk_device = sda #default -# disk_device = xvda +disk_device = xvda #default +# disk_device = sda # only in patch2: unchanged: --- xen-tools-3.9.orig/Makefile +++ xen-tools-3.9/Makefile @@ -158,6 +158,7 @@ cp -R hooks/edgy/*-* ${prefix}/usr/lib/xen-tools/edgy.d/ -cd ${prefix}/usr/lib/xen-tools/ && ln -s edgy.d feisty.d -cd ${prefix}/usr/lib/xen-tools/ && ln -s edgy.d gutsy.d + -cd ${prefix}/usr/lib/xen-tools/ && ln -s edgy.d hardy.d mkdir -p ${prefix}/usr/lib/xen-tools/dapper.d/ cp -R hooks/dapper/*-* ${prefix}/usr/lib/xen-tools/dapper.d/ mkdir -p ${prefix}/usr/lib/xen-tools/edgy.d/ only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/fedora-core-6/55-create-dev +++ xen-tools-3.9/hooks/fedora-core-6/55-create-dev @@ -45,7 +45,11 @@ chroot ${prefix} /bin/sh -c 'cd /dev && ./MAKEDEV console' chroot ${prefix} /bin/sh -c 'cd /dev && ./MAKEDEV null' chroot ${prefix} /bin/sh -c 'cd /dev && ./MAKEDEV zero' - +mknod /dev/xvda b 202 0 +for i in 1 2 3; do +chroot ${prefix} /bin/sh -c 'mknod /dev/xvda$i b 202 $i' +done +mknod /dev/xvc0 c 204 19 # # Log our finish only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/gentoo/30-disable-gettys +++ xen-tools-3.9/hooks/gentoo/30-disable-gettys @@ -33,6 +33,23 @@ # sed -i -e 's/^\([2-6].*:respawn*\)/#\1/' -e 's/^T/#\t/' ${prefix}/etc/inittab +# +# Are we using an alternative serial device? +# +if [ ! -z "${serial_device}" ]; then + + serial_device=`basename $serial_device` + + # Let the user know. + logMessage "Replacing default serial device (tty1) with ${serial_device}" + + # replace existing device. + sed -i -e s/tty1/${serial_device}/ ${prefix}/etc/inittab + + # make sure that it is allowed to login. + echo $serial_device >> ${prefix}/etc/securetty +fi + # # Are we using an alternative serial device? only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/edgy/90-make-fstab +++ xen-tools-3.9/hooks/edgy/90-make-fstab @@ -39,7 +39,7 @@ # # 3. Otherwise use a named $disk_device # -device=sda +device=xvda if [ "${ide}" ]; then device=hda else @@ -50,7 +50,6 @@ logMessage "Root device is /dev/$device" - # # Now we have the options we can create the fstab. # only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/edgy/31-ubuntu-setup +++ xen-tools-3.9/hooks/edgy/31-ubuntu-setup @@ -0,0 +1,39 @@ +#/bin/sh +# +# This script setups the ubuntu guests up properly. +# + + +prefix=$1 + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + +chroot ${prefix} /usr/sbin/update-rc.d -f hwclock.sh remove +chroot ${prefix} /usr/sbin/update-rc.d -f hwclockfirst.sh remove +chroot ${prefix} rm -f /etc/udev/rules.d/85-hwclock.rules +chroot ${prefix} ln -sf /bin/true /sbin/hwclock +chroot ${prefix} mknod /dev/xvda b 202 0 +chroot ${prefix} mknod /dev/xvdb b 202 16 +chroot ${prefix} mknod /dev/xvdc b 202 32 +chroot ${prefix} mknod /dev/xvdd b 202 48 + +for i in 1 2 3 4 5 6 7 8 9; do + chroot ${prefix} mknod /dev/xvda$i b 202 $i + chroot ${prefix} mknod /dev/xvdb$i b 202 $i + chroot ${prefix} mknod /dev/xvdc$i b 202 $i + chroot ${prefix} mknod /dev/xvdd$i b 202 $i +done +chroot ${prefix} mknod /dev/xvc0 c 204 191 + +# +# Change first console setting to xvc0 upstart +# +echo "xvc0" >> ${prefix}/etc/securetty +sed -i "s/tty1/xvc0/" ${prefix}/etc/event.d/tty1 only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/edgy/100-ubuntu-setup +++ xen-tools-3.9/hooks/edgy/100-ubuntu-setup @@ -0,0 +1,27 @@ +#/bin/sh +# +# This script setups the ubuntu guests up properly. +# + + +prefix=$i + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + +chroot ${prefix} /usr/sbin/update-rc.d -f hwclock.sh remove +chroot ${prefix} /usr/sbin/update-rc.d -f hwclockfirst.sh remove +chroot ${prefix} rm -f /etc/udev/rules.d/85-hwclock.rules +chroot ${prefix} ln -sf /bin/true /sbin/hwclock + +# +# Change first console setting to xvc0 upstart +# +echo "xvc0" >> ${prefix}/etc/securetty +sed -i "s/tty1/xvc0/" ${prefix}/etc/event.d/tty1 only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/gutsy/99-enable-daemons +++ xen-tools-3.9/hooks/gutsy/99-enable-daemons @@ -0,0 +1,45 @@ +#!/bin/sh +# +# This script removes the file which prevents daemons from running. +# +# Steve +# -- +# http://www.steve.org.uk/ + + + +prefix=$1 + + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + +# +# Remove the script if present. +# +if [ -x "${prefix}/usr/sbin/policy-rc.d" ]; then + + rm -f "${prefix}/usr/sbin/policy-rc.d" + + logMessage "Removed: ${prefix}/usr/sbin/policy-rc.d" + +fi + + +# +# Log our finish +# +logMessage Script $0 finished only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/gutsy/15-disable-hwclock +++ xen-tools-3.9/hooks/gutsy/15-disable-hwclock @@ -0,0 +1,38 @@ +#!/bin/sh +# +# This script disables the hardware clock. +# +# Steve +# -- +# http://www.steve.org.uk/ + + +prefix=$1 + + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + +# +# Disable the startup scripts from all runlevels. +# +chroot ${prefix} /usr/sbin/update-rc.d -f hwclock.sh remove + +# +# Log our finish +# +logMessage Script $0 finished. + only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/gutsy/80-install-modules +++ xen-tools-3.9/hooks/gutsy/80-install-modules @@ -0,0 +1,75 @@ +#!/bin/sh +# +# Install modules from the host system into the new image, and +# ensure that 'module-init-tools' is setup. +# +# This is most likely required if you're using a custom kernel +# for your Xen system. But even if it isn't required it can't +# really do anything bad; just waste a bit of space. +# +# Steve +# -- +# http://www.steve.org.uk/ + + +prefix=$1 + + + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + +# +# The name of the package containing the correct modules. +# +linux_modules_package="linux-modules-$(uname -r)" + +# +# Attempt to install that package. This will either work on an Etch +# system, or fail on a Sarge/custom kernel. +# +if chroot ${prefix} /usr/bin/apt-cache show ${linux_modules_package} >/dev/null 2>/dev/null; then + + logMessage "Package '${linux_modules_package}' is available - installing" + + # + # If it worked then we can install the package. + # + installDebianPackage ${prefix} ${linux_modules_package} +else + + # + # Fall back to copying over modules from the host to the new + # system. + # + logMessage "Package '${linux_modules_package}' is not available" + logMessage "Copying modules from /lib/modules/$(uname -r)" + + mkdir -p ${prefix}/lib/modules + cp -au /lib/modules/$(uname -r) ${prefix}/lib/modules +fi + + +# +# Install the module-init-tools package. +# +installDebianPackage ${prefix} module-init-tools + + +# +# Log our finish +# +logMessage Script $0 finished only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/gutsy/90-make-fstab +++ xen-tools-3.9/hooks/gutsy/90-make-fstab @@ -0,0 +1,102 @@ +#!/bin/sh +# +# This script is responsible for setting up /etc/fstab upon the +# new instance. +# +# This should be a simple job, but it is complicated by some of the +# differences between filesystems - some root filesystems will require +# the installation of new packages, and we have to handle that here. +# +# Steve +# -- +# http://www.steve.org.uk/ + + +prefix=$1 + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + +# +# Options to mount the root filesystem with, we need to have +# different options for xfs. +# +# The default option works for ext2 & ext3. +# +options="errors=remount-ro" + +case "${fs}" in + xfs) + options="defaults" + ;; + reiserfs) + options="defaults" + ;; +esac + + +# +# Make sure we use ide style device names if required +# +device=xvda +if [ "${ide}" ]; then + device=hda +else + if [ ! -z "${disk_device}" ]; then + device=`basename $disk_device` + fi +fi + +logMessage "Root device is /dev/$device" + +# +# Now we have the options we can create the fstab. +# +cat < ${prefix}/etc/fstab +/dev/${device}1 / ${fs} ${options} 0 1 +proc /proc proc rw,nodev,nosuid,noexec 0 0 +E_O_FSTAB + +# +# Add in the swap unless it is disabled +# +if [ "${noswap}" ]; then + : +else +cat <> ${prefix}/etc/fstab +/dev/${device}2 none swap sw 0 0 +E_O_FSTAB +fi + + +# +# Finally we can install any required packages for the given root +# filesystem +# +case "${fs}" in + xfs) + installDebianPackage ${prefix} xfsprogs + ;; + reiserfs) + installDebianPackage ${prefix} reiserfsprogs + ;; +esac + + +# +# Log our finish +# +logMessage Script $0 finished only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/gutsy/30-disable-gettys +++ xen-tools-3.9/hooks/gutsy/30-disable-gettys @@ -0,0 +1,35 @@ +#!/bin/sh +# +# This script comments out all virtual terminals which aren't on the +# first console - that must remain so that 'xm console ...' works +# correctly. +# + + +prefix=$1 + + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + +# +# Remove the links for upstart +# +rm ${prefix}/etc/event.d/tty[!1] + +# +# Log our finish +# +logMessage Script $0 finished only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/gutsy/70-install-ssh +++ xen-tools-3.9/hooks/gutsy/70-install-ssh @@ -0,0 +1,42 @@ +#!/bin/sh +# +# This script installs OpenSSH upon the new system. +# +# It must make sure that the server is not running before it exits +# otherwise the temporary mounted directory will not be unmountable. +# +# Steve +# -- +# http://www.steve.org.uk/ + + +prefix=$1 + + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + +# +# Install ssh +# +installDebianPackage ${prefix} ssh + + + +# +# Log our finish +# +logMessage Script $0 finished only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/gutsy/25-generate-locale +++ xen-tools-3.9/hooks/gutsy/25-generate-locale @@ -0,0 +1,40 @@ +#!/bin/sh +# +# This script generates a default en_US.UTF-8 locale. +# +# Ward +# -- + + + +prefix=$1 + + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + +# +# Install the English language pack. +# +# NOTE: Failure to support your favourite language is *not* a bug. +# +installDebianPackage language-pack-en + + +# +# Log our finish +# +logMessage Script $0 finished only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/gutsy/20-setup-apt +++ xen-tools-3.9/hooks/gutsy/20-setup-apt @@ -0,0 +1,104 @@ +#!/bin/sh +# +# This script sets up the /etc/apt/sources.list for APT. +# +# Steve +# -- +# $Id: 20-setup-apt,v 1.2 2006-11-29 20:58:44 steve Exp $ + + + + +prefix=$1 + + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + +# +# You will probably need DNS to run "apt-get update" +# +cp /etc/resolv.conf ${prefix}/etc + + +# +# Attempt to auto-magically detect the use of a Proxy for apt-get, and +# replicate that setup in our new guest. +# +# +# Process any of the present apt-conf setup lines. +# +for i in /etc/apt/apt.conf /etc/apt/apt.conf.d/* ; do + + # + # If the file exists. (Need this in case the literal glob fails.) + # + if [ -e $i ] ; then + + # + # Save the matching line(s) to the proxy guess file. + # + logMessage The use of a proxy detected. + grep -i HTTP::Proxy $i >> ${prefix}/etc/apt/apt.conf.d/proxy-guess + fi +done + + + +cat < ${prefix}/etc/apt/sources.list +# +# /etc/apt/sources.list +# + + +# +# ${dist} +# +deb ${mirror} ${dist} main restricted universe multiverse +deb-src ${mirror} ${dist} main restricted universe +deb ${mirror} ${dist}-updates main restricted universe multiverse +deb-src ${mirror} ${dist}-updates main restricted universe +deb http://security.ubuntu.com/ubuntu ${dist}-security main restricted universe +deb-src http://security.ubuntu.com/ubuntu ${dist}-security main restricted universe + +E_O_APT + + + +# +# Now that the sources have been setup make sure the system is up to date. +# +chroot ${prefix} /usr/bin/apt-get update + + +# +# Now fixup TLS on non-64bit systems. +# +if [ "`uname -m`" = "x86_64" ]; then + + logMessage "Ignoring TLS since we're a 64 bit host." + +else + + logMessage "Installing libc6-xen" + installDebianPackage ${prefix} libc6-xen +fi + + +# +# Log our finish +# +logMessage Script $0 finished only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/gutsy/99-clean-image +++ xen-tools-3.9/hooks/gutsy/99-clean-image @@ -0,0 +1,38 @@ +#!/bin/sh +# +# This script cleans the newly created image's apt-get archive. +# +# Steve +# -- +# http://www.steve.org.uk/ + + +prefix=$1 + + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + +# +# Clean the APT package cache for Debian GNU/Linux. +# +chroot ${prefix} /usr/bin/apt-get clean + + +# +# Log our finish +# +logMessage Script $0 finished only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/gutsy/35-setup-users +++ xen-tools-3.9/hooks/gutsy/35-setup-users @@ -0,0 +1,181 @@ +#!/usr/bin/perl -w +# +# This script attempts to copy all user accounts from the host to +# the guest. It does this by copying all user accounts which are not +# already present. +# +# NOTE: Unless '--accounts' was specified upon the 'xen-create-image' +# command line we don't do this. +# +# Steve +# -- +# http://www.steve.org.uk/ + + +use strict; +use Env; + + +my $prefix = shift; + +die "Prefix must be given" unless defined( $prefix ); +die "Prefix must be a directory" unless ( -d $prefix ); + + +# +# Exit unless the 'accounts' variable is set. +# +exit unless ( $ENV{'accounts'} ); + +# +# Make sure we have $prefix/etc +# +die "Prefix is missing /etc : $prefix" unless ( -d $prefix . "/etc" ); + + +# +# Read all accounts from the installed /etc/passwd on the guest. +# +my %present; +if ( -e $prefix . "/etc/passwd" ) +{ + %present = readAccounts( $prefix . "/etc/passwd" ); +} + + +# +# Now read the accounts on the host. +# +my %host = readAccounts( "/etc/passwd" ); + + +# +# For each account not present on new installation then add it +# +foreach my $account ( sort keys( %host ) ) +{ + if ( ! $present{ $account } ) + { + print "Adding: $account\n"; + addAccount( $account ); + + # + # Find any groups the user is member of on the host + # and add them on the guest system + # + addGroups( $account ); + } +} + + + +# +# Read the accounts which are already present on the guest image. +# +sub readAccounts +{ + my ( $file ) = ( @_ ); + + + my %found; + + open( EXISTING, "<", $file ); + foreach my $line ( ) + { + # + # Record the userid + username + # + if ( $line =~ /^([^:]+):([^:]+):([^:]+)/ ) + { + my $user = $1; + my $pass = $2; + my $uid = $3; + + $found{$user} = 1; + } + } + close( EXISTING ); + + return( %found ); +} + + + + +# +# Add the passwd + shadow accounts for the given user. +# +sub addAccount +{ + my ( $user ) = ( @_ ); + + # + # passwd file. + # + open( PASSWD, "<", "/etc/passwd" ); + foreach my $line ( ) + { + chomp( $line ); + if ( $line =~ /^\Q$user\E:/ ) + { + # + # Add the line + # + open( OUTY, ">>", $prefix . "/etc/passwd" ); + print OUTY $line . "\n"; + close( OUTY ); + } + } + close( PASSWD ); + + + # + # shadow file. + # + open( SHADOW, "<", "/etc/shadow" ) or die "Failed to open : $!"; + foreach my $line ( ) + { + chomp( $line ); + if ( $line =~ /^\Q$user\E:/ ) + { + # + # Add the line + # + open( OUTY, ">>", $prefix . "/etc/shadow" ); + print OUTY $line . "\n"; + close( OUTY ); + } + } + close( SHADOW ); +} + + + +# +# Find the groups a user is member of on the host, and add them to +# those groups on the new guest. +# +sub addGroups +{ + my( $username ) = ( @_ ); + + # + # Get the groups. + # + my $groups = `groups $username`; + # split off the usernmame. + if ( $groups =~ /^([^:]+):(.*)/ ) + { + $groups = $2; + print "User: $username is member of the groups: $groups\n"; + } + + foreach my $g ( split( / /, $groups ) ) + { + # Make sure the group exists. + system( "chroot $prefix /usr/sbin/addgroup $g" ); + + # add the user to it. + system( "chroot $prefix /usr/sbin/adduser $username $g" ); + } +} only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/gutsy/01-disable-daemons +++ xen-tools-3.9/hooks/gutsy/01-disable-daemons @@ -0,0 +1,54 @@ +#!/bin/sh +# +# This script ensures that daemons will not be started inside our +# chroot() installation. +# +# Steve +# -- +# http://www.steve.org.uk/ + + +prefix=$1 + + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + +# +# Make sure we have a directory. +# +if [ ! -d "${prefix}/usr/sbin" ]; then + + mkdir -p "${prefix}/usr/sbin" + + logMessage "created missing directory: ${prefix}/usr/sbin" +fi + + +# +# Add the script. +# +echo '#!/bin/sh' > ${prefix}/usr/sbin/policy-rc.d +echo 'exit 101' >> ${prefix}/usr/sbin/policy-rc.d +chmod 755 ${prefix}/usr/sbin/policy-rc.d + + + +# +# Log our finish +# +logMessage Script $0 finished. + only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/gutsy/65-copy-user-files +++ xen-tools-3.9/hooks/gutsy/65-copy-user-files @@ -0,0 +1,49 @@ +#!/bin/sh +# +# Copy files from a 'skel' directory, if present, into the +# new images +# + + +prefix=$1 + + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + +# +# Copy everything from the skel directory into the new instance +# if that directory exists. +# +if [ -d /etc/xen-tools/skel ]; then + + logMessage Copying files from /etc/xen-tools/skel + + (cd /etc/xen-tools/skel; tar -cf - . ) | (cd ${prefix}/; tar -xpf -) + + logMessage Finished + +else + + logMessage skel directory, /etc/xen-tools/skell, not present ignoring. + +fi + + +# +# Log our finish +# +logMessage Script $0 finished only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/gutsy/05-shadowconfig-on +++ xen-tools-3.9/hooks/gutsy/05-shadowconfig-on @@ -0,0 +1,45 @@ +#!/bin/sh +# +# This script enforces the use of a shadow password file. +# +# Steve +# -- +# http://www.steve.org.uk/ + + +prefix=$1 + + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + +# +# Enable the shadow passwords if the command is found. +# +if [ -x ${prefix}/sbin/shadowconfig ]; then + + chroot ${prefix} /sbin/shadowconfig on +else + + logMessage "/sbin/shadowconfig not found. skipping." +fi + + +# +# Log our finish +# +logMessage Script $0 finished. + only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/gutsy/40-setup-networking +++ xen-tools-3.9/hooks/gutsy/40-setup-networking @@ -0,0 +1,145 @@ +#!/bin/sh +# +# This script sets up the /etc/network/interface file for the new +# image. +# +# Steve +# -- +# http://www.steve.org.uk/ + + +prefix=$1 + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + +# +# Make sure we have an /etc/network directory. +# +mkdir -p ${prefix}/etc/network + + +# +# A function to setup DHCP for our new image. +# +setupDynamicNetworking () +{ + # + # The host is using DHCP. + # + cat < ${prefix}/etc/network/interfaces +# This file describes the network interfaces available on your system +# and how to activate them. For more information, see interfaces(5). + +# The loopback network interface +auto lo +iface lo inet loopback + +# The primary network interface +auto eth0 +iface eth0 inet dhcp +# post-up ethtool -K eth0 tx off + +# +# The commented out line above will disable TCP checksumming which +# might resolve problems for some users. It is disabled by default +# +E_O_DHCP +} + + + +# +# A function to setup static IP addresses for our new image. +# +setupStaticNetworking () +{ + # + # broadcast address? + # + bcast=''; + if [ ! -z "${broadcast}" ]; then + bcast = ' broadcast ${broadcast}' + fi + + # + # We have a static IP address + # + cat <${prefix}/etc/network/interfaces +# This file describes the network interfaces available on your system +# and how to activate them. For more information, see interfaces(5). + +# The loopback network interface +auto lo +iface lo inet loopback + +# The primary network interface +auto eth0 +iface eth0 inet static + address ${ip1} + gateway ${gateway} + netmask ${netmask} + ${bcast} + # post-up ethtool -K eth0 tx off + +# +# The commented out line above will disable TCP checksumming which +# might resolve problems for some users. It is disabled by default +# +E_O_STATIC + + interface=1 + count=2 + + while [ "${count}" -le "${ip_count}" ]; do + + value=\$ip${count} + value=`eval echo $value` + + logMessage Adding etho:${interface} + + cat <>${prefix}/etc/network/interfaces +auto eth0:${interface} +iface eth0:${interface} inet static + address ${value} + netmask ${netmask} + # post-up ethtool -K eth0 tx off +E_O_STATIC + count=`expr $count + 1` + interface=`expr $interface + 1` + done +} + + + + +# +# Call the relevant function +# +if [ -z "${dhcp}" ]; then + logMessage "Setting up static networking" + setupStaticNetworking + +else + logMessage "Setting up DHCP networking" + setupDynamicNetworking +fi + + +# +# Log our finish +# +logMessage Script $0 finished only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/gutsy/60-copy-host-files +++ xen-tools-3.9/hooks/gutsy/60-copy-host-files @@ -0,0 +1,58 @@ +#!/bin/sh +# +# Copy files from a 'skel' directory, if present, into the +# new images +# + + +prefix=$1 + + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + +# +# Copy "required" files from our host. +# +cp /etc/timezone ${prefix}/etc + +# +# If the host has sudo then copy the configuration file, and install +# the package +# +if [ -e /etc/sudoers ]; then + + logMessage Installing SUDO too. + + # + # Copy file and fixup permissions. + # + cp /etc/sudoers ${prefix}/etc + chown root:root ${prefix}/etc/sudoers + chmod 440 ${prefix}/etc/sudoers + + # + # Install sudo + # + installDebianPackage ${prefix} sudo + +fi + + +# +# Log our finish +# +logMessage Script $0 finished only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/gutsy/50-setup-hostname +++ xen-tools-3.9/hooks/gutsy/50-setup-hostname @@ -0,0 +1,117 @@ +#!/bin/sh +# +# This script places the new systems hostname into a couple of files within +# the new image. +# +# Steve +# -- +# http://www.steve.org.uk/ + + + +prefix=$1 + + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + +# +# Setup the mailname + hostname files. +# +echo ${hostname} > ${prefix}/etc/hostname +echo ${hostname} > ${prefix}/etc/mailname + + +# +# Fixup the /etc/hosts file upon the new image for +# machines with static IPs +# +if [ -z "${dhcp}" ]; then + + # Non-IPv6 stuff. + grep -v '\(::\|IPv6\)' /etc/hosts > ${prefix}/etc/hosts + + # New entry. + echo "${ip1} ${hostname}" >> ${prefix}/etc/hosts + echo " " >> ${prefix}/etc/hosts + + # IPv6 stuff. + grep '\(::\|IPv6\)' /etc/hosts >> ${prefix}/etc/hosts + +else + + # + # Stub /etc/hosts for DHCP clients. + # + cat >> ${prefix}/etc/hosts < /dev/null ) ; then + + logMessage Host already has IP address for the host ${hostname}. + + else + # + # Short host name. + # + name=`echo ${hostname} | awk -F. '{print $1}'` + + logMessage Adding ${hostname} and ${name} to /etc/hosts on the host + + echo "${ip1} ${name} ${hostname}" >> /etc/hosts + + # + # If we've updated the /etc/hosts file on the host machine + # and there is an installation of dnsmasq installed then + # reload it. + # + # This will let the local LAN clients lookup the new address. + # + if [ -x /usr/sbin/dnsmasq ] ; then + if [ -e /var/run/dnsmasq.pid ]; then + + logMessage Allowing DNSMasq to restart. + + kill -HUP `cat /var/run/dnsmasq.pid` + fi + fi + fi +fi + + +# +# Log our finish +# +logMessage Script $0 finished only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/debian/30-disable-gettys +++ xen-tools-3.9/hooks/debian/30-disable-gettys @@ -52,7 +52,6 @@ fi -# # Log our finish # logMessage Script $0 finished only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/debian/55-create-dev +++ xen-tools-3.9/hooks/debian/55-create-dev @@ -52,7 +52,11 @@ cd ${prefix}/dev ./MAKEDEV generic ./MAKEDEV std - +mknod /dev/xvda b 202 0 +for i in 1 2 3; do +chroot ${prefix} /bin/sh -c 'mknod /dev/xvda$i b 202 $i' +done +mknod /dev/xvc0 c 204 19 # # Log our finish only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/centos-4/55-create-dev +++ xen-tools-3.9/hooks/centos-4/55-create-dev @@ -45,7 +45,11 @@ chroot ${prefix} /bin/sh -c 'cd /dev && ./MAKEDEV console' chroot ${prefix} /bin/sh -c 'cd /dev && ./MAKEDEV null' chroot ${prefix} /bin/sh -c 'cd /dev && ./MAKEDEV zero' - +mknod /dev/xvda b 202 0 +for i in 1 2 3; do +chroot ${prefix} /bin/sh -c 'mknod /dev/xvda$i b 202 $i' +done +mknod /dev/xvc0 c 204 19 # # Log our finish only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/dapper/30-disable-gettys +++ xen-tools-3.9/hooks/dapper/30-disable-gettys @@ -30,6 +30,23 @@ # sed -i -e 's/^\([2-6].*:respawn*\)/#\1/' -e 's/^T/#\t/' ${prefix}/etc/inittab +# +# Are we using an alternative serial device? +# +if [ ! -z "${serial_device}" ]; then + + serial_device=`basename ${serial_device}` + + # Let the user know. + logMessage "Replacing default serial device (tty1) with ${serial_device}" + + # replace existing device. + sed -i -e s/tty1/${serial_device}/ ${prefix}/etc/inittab + + # make sure that it is allowed to login. + echo $serial_device >> ${prefix}/etc/securetty +fi + # # Are we using an alternative serial device? only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/dapper/55-create-dev +++ xen-tools-3.9/hooks/dapper/55-create-dev @@ -43,7 +43,11 @@ cd ${prefix}/dev ./MAKEDEV generic ./MAKEDEV std - +mknod /dev/xvda b 202 0 +for i in 1 2 3; do +chroot ${prefix} /bin/sh -c 'mknod /dev/xvda$i b 202 $i' +done +mknod /dev/xvc0 c 204 19 # # Log our finish only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/feisty/99-enable-daemons +++ xen-tools-3.9/hooks/feisty/99-enable-daemons @@ -0,0 +1,45 @@ +#!/bin/sh +# +# This script removes the file which prevents daemons from running. +# +# Steve +# -- +# http://www.steve.org.uk/ + + + +prefix=$1 + + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + +# +# Remove the script if present. +# +if [ -x "${prefix}/usr/sbin/policy-rc.d" ]; then + + rm -f "${prefix}/usr/sbin/policy-rc.d" + + logMessage "Removed: ${prefix}/usr/sbin/policy-rc.d" + +fi + + +# +# Log our finish +# +logMessage Script $0 finished only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/feisty/15-disable-hwclock +++ xen-tools-3.9/hooks/feisty/15-disable-hwclock @@ -0,0 +1,38 @@ +#!/bin/sh +# +# This script disables the hardware clock. +# +# Steve +# -- +# http://www.steve.org.uk/ + + +prefix=$1 + + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + +# +# Disable the startup scripts from all runlevels. +# +chroot ${prefix} /usr/sbin/update-rc.d -f hwclock.sh remove + +# +# Log our finish +# +logMessage Script $0 finished. + only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/feisty/80-install-modules +++ xen-tools-3.9/hooks/feisty/80-install-modules @@ -0,0 +1,75 @@ +#!/bin/sh +# +# Install modules from the host system into the new image, and +# ensure that 'module-init-tools' is setup. +# +# This is most likely required if you're using a custom kernel +# for your Xen system. But even if it isn't required it can't +# really do anything bad; just waste a bit of space. +# +# Steve +# -- +# http://www.steve.org.uk/ + + +prefix=$1 + + + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + +# +# The name of the package containing the correct modules. +# +linux_modules_package="linux-modules-$(uname -r)" + +# +# Attempt to install that package. This will either work on an Etch +# system, or fail on a Sarge/custom kernel. +# +if chroot ${prefix} /usr/bin/apt-cache show ${linux_modules_package} >/dev/null 2>/dev/null; then + + logMessage "Package '${linux_modules_package}' is available - installing" + + # + # If it worked then we can install the package. + # + installDebianPackage ${prefix} ${linux_modules_package} +else + + # + # Fall back to copying over modules from the host to the new + # system. + # + logMessage "Package '${linux_modules_package}' is not available" + logMessage "Copying modules from /lib/modules/$(uname -r)" + + mkdir -p ${prefix}/lib/modules + cp -au /lib/modules/$(uname -r) ${prefix}/lib/modules +fi + + +# +# Install the module-init-tools package. +# +installDebianPackage ${prefix} module-init-tools + + +# +# Log our finish +# +logMessage Script $0 finished only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/feisty/90-make-fstab +++ xen-tools-3.9/hooks/feisty/90-make-fstab @@ -0,0 +1,102 @@ +#!/bin/sh +# +# This script is responsible for setting up /etc/fstab upon the +# new instance. +# +# This should be a simple job, but it is complicated by some of the +# differences between filesystems - some root filesystems will require +# the installation of new packages, and we have to handle that here. +# +# Steve +# -- +# http://www.steve.org.uk/ + + +prefix=$1 + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + +# +# Options to mount the root filesystem with, we need to have +# different options for xfs. +# +# The default option works for ext2 & ext3. +# +options="errors=remount-ro" + +case "${fs}" in + xfs) + options="defaults" + ;; + reiserfs) + options="defaults" + ;; +esac + + +# +# Make sure we use ide style device names if required +# +device=sda +if [ "${ide}" ]; then + device=hda +else + if [ ! -z "${disk_device}" ]; then + device=`basename $disk_device` + fi +fi + +logMessage "Root device is /dev/$device" + +# +# Now we have the options we can create the fstab. +# +cat < ${prefix}/etc/fstab +/dev/${device}1 / ${fs} ${options} 0 1 +proc /proc proc rw,nodev,nosuid,noexec 0 0 +E_O_FSTAB + +# +# Add in the swap unless it is disabled +# +if [ "${noswap}" ]; then + : +else +cat <> ${prefix}/etc/fstab +/dev/${device}2 none swap sw 0 0 +E_O_FSTAB +fi + + +# +# Finally we can install any required packages for the given root +# filesystem +# +case "${fs}" in + xfs) + installDebianPackage ${prefix} xfsprogs + ;; + reiserfs) + installDebianPackage ${prefix} reiserfsprogs + ;; +esac + + +# +# Log our finish +# +logMessage Script $0 finished only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/feisty/30-disable-gettys +++ xen-tools-3.9/hooks/feisty/30-disable-gettys @@ -0,0 +1,35 @@ +#!/bin/sh +# +# This script comments out all virtual terminals which aren't on the +# first console - that must remain so that 'xm console ...' works +# correctly. +# + + +prefix=$1 + + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + +# +# Remove the links for upstart +# +rm ${prefix}/etc/event.d/tty[!1] + +# +# Log our finish +# +logMessage Script $0 finished only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/feisty/70-install-ssh +++ xen-tools-3.9/hooks/feisty/70-install-ssh @@ -0,0 +1,42 @@ +#!/bin/sh +# +# This script installs OpenSSH upon the new system. +# +# It must make sure that the server is not running before it exits +# otherwise the temporary mounted directory will not be unmountable. +# +# Steve +# -- +# http://www.steve.org.uk/ + + +prefix=$1 + + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + +# +# Install ssh +# +installDebianPackage ${prefix} ssh + + + +# +# Log our finish +# +logMessage Script $0 finished only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/feisty/25-generate-locale +++ xen-tools-3.9/hooks/feisty/25-generate-locale @@ -0,0 +1,40 @@ +#!/bin/sh +# +# This script generates a default en_US.UTF-8 locale. +# +# Ward +# -- + + + +prefix=$1 + + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + +# +# Install the English language pack. +# +# NOTE: Failure to support your favourite language is *not* a bug. +# +installDebianPackage language-pack-en + + +# +# Log our finish +# +logMessage Script $0 finished only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/feisty/20-setup-apt +++ xen-tools-3.9/hooks/feisty/20-setup-apt @@ -0,0 +1,104 @@ +#!/bin/sh +# +# This script sets up the /etc/apt/sources.list for APT. +# +# Steve +# -- +# $Id: 20-setup-apt,v 1.2 2006-11-29 20:58:44 steve Exp $ + + + + +prefix=$1 + + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + +# +# You will probably need DNS to run "apt-get update" +# +cp /etc/resolv.conf ${prefix}/etc + + +# +# Attempt to auto-magically detect the use of a Proxy for apt-get, and +# replicate that setup in our new guest. +# +# +# Process any of the present apt-conf setup lines. +# +for i in /etc/apt/apt.conf /etc/apt/apt.conf.d/* ; do + + # + # If the file exists. (Need this in case the literal glob fails.) + # + if [ -e $i ] ; then + + # + # Save the matching line(s) to the proxy guess file. + # + logMessage The use of a proxy detected. + grep -i HTTP::Proxy $i >> ${prefix}/etc/apt/apt.conf.d/proxy-guess + fi +done + + + +cat < ${prefix}/etc/apt/sources.list +# +# /etc/apt/sources.list +# + + +# +# ${dist} +# +deb ${mirror} ${dist} main restricted universe multiverse +deb-src ${mirror} ${dist} main restricted universe +deb ${mirror} ${dist}-updates main restricted universe multiverse +deb-src ${mirror} ${dist}-updates main restricted universe +deb http://security.ubuntu.com/ubuntu ${dist}-security main restricted universe +deb-src http://security.ubuntu.com/ubuntu ${dist}-security main restricted universe + +E_O_APT + + + +# +# Now that the sources have been setup make sure the system is up to date. +# +chroot ${prefix} /usr/bin/apt-get update + + +# +# Now fixup TLS on non-64bit systems. +# +if [ "`uname -m`" = "x86_64" ]; then + + logMessage "Ignoring TLS since we're a 64 bit host." + +else + + logMessage "Installing libc6-xen" + installDebianPackage ${prefix} libc6-xen +fi + + +# +# Log our finish +# +logMessage Script $0 finished only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/feisty/99-clean-image +++ xen-tools-3.9/hooks/feisty/99-clean-image @@ -0,0 +1,38 @@ +#!/bin/sh +# +# This script cleans the newly created image's apt-get archive. +# +# Steve +# -- +# http://www.steve.org.uk/ + + +prefix=$1 + + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + +# +# Clean the APT package cache for Debian GNU/Linux. +# +chroot ${prefix} /usr/bin/apt-get clean + + +# +# Log our finish +# +logMessage Script $0 finished only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/feisty/35-setup-users +++ xen-tools-3.9/hooks/feisty/35-setup-users @@ -0,0 +1,181 @@ +#!/usr/bin/perl -w +# +# This script attempts to copy all user accounts from the host to +# the guest. It does this by copying all user accounts which are not +# already present. +# +# NOTE: Unless '--accounts' was specified upon the 'xen-create-image' +# command line we don't do this. +# +# Steve +# -- +# http://www.steve.org.uk/ + + +use strict; +use Env; + + +my $prefix = shift; + +die "Prefix must be given" unless defined( $prefix ); +die "Prefix must be a directory" unless ( -d $prefix ); + + +# +# Exit unless the 'accounts' variable is set. +# +exit unless ( $ENV{'accounts'} ); + +# +# Make sure we have $prefix/etc +# +die "Prefix is missing /etc : $prefix" unless ( -d $prefix . "/etc" ); + + +# +# Read all accounts from the installed /etc/passwd on the guest. +# +my %present; +if ( -e $prefix . "/etc/passwd" ) +{ + %present = readAccounts( $prefix . "/etc/passwd" ); +} + + +# +# Now read the accounts on the host. +# +my %host = readAccounts( "/etc/passwd" ); + + +# +# For each account not present on new installation then add it +# +foreach my $account ( sort keys( %host ) ) +{ + if ( ! $present{ $account } ) + { + print "Adding: $account\n"; + addAccount( $account ); + + # + # Find any groups the user is member of on the host + # and add them on the guest system + # + addGroups( $account ); + } +} + + + +# +# Read the accounts which are already present on the guest image. +# +sub readAccounts +{ + my ( $file ) = ( @_ ); + + + my %found; + + open( EXISTING, "<", $file ); + foreach my $line ( ) + { + # + # Record the userid + username + # + if ( $line =~ /^([^:]+):([^:]+):([^:]+)/ ) + { + my $user = $1; + my $pass = $2; + my $uid = $3; + + $found{$user} = 1; + } + } + close( EXISTING ); + + return( %found ); +} + + + + +# +# Add the passwd + shadow accounts for the given user. +# +sub addAccount +{ + my ( $user ) = ( @_ ); + + # + # passwd file. + # + open( PASSWD, "<", "/etc/passwd" ); + foreach my $line ( ) + { + chomp( $line ); + if ( $line =~ /^\Q$user\E:/ ) + { + # + # Add the line + # + open( OUTY, ">>", $prefix . "/etc/passwd" ); + print OUTY $line . "\n"; + close( OUTY ); + } + } + close( PASSWD ); + + + # + # shadow file. + # + open( SHADOW, "<", "/etc/shadow" ) or die "Failed to open : $!"; + foreach my $line ( ) + { + chomp( $line ); + if ( $line =~ /^\Q$user\E:/ ) + { + # + # Add the line + # + open( OUTY, ">>", $prefix . "/etc/shadow" ); + print OUTY $line . "\n"; + close( OUTY ); + } + } + close( SHADOW ); +} + + + +# +# Find the groups a user is member of on the host, and add them to +# those groups on the new guest. +# +sub addGroups +{ + my( $username ) = ( @_ ); + + # + # Get the groups. + # + my $groups = `groups $username`; + # split off the usernmame. + if ( $groups =~ /^([^:]+):(.*)/ ) + { + $groups = $2; + print "User: $username is member of the groups: $groups\n"; + } + + foreach my $g ( split( / /, $groups ) ) + { + # Make sure the group exists. + system( "chroot $prefix /usr/sbin/addgroup $g" ); + + # add the user to it. + system( "chroot $prefix /usr/sbin/adduser $username $g" ); + } +} only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/feisty/01-disable-daemons +++ xen-tools-3.9/hooks/feisty/01-disable-daemons @@ -0,0 +1,54 @@ +#!/bin/sh +# +# This script ensures that daemons will not be started inside our +# chroot() installation. +# +# Steve +# -- +# http://www.steve.org.uk/ + + +prefix=$1 + + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + +# +# Make sure we have a directory. +# +if [ ! -d "${prefix}/usr/sbin" ]; then + + mkdir -p "${prefix}/usr/sbin" + + logMessage "created missing directory: ${prefix}/usr/sbin" +fi + + +# +# Add the script. +# +echo '#!/bin/sh' > ${prefix}/usr/sbin/policy-rc.d +echo 'exit 101' >> ${prefix}/usr/sbin/policy-rc.d +chmod 755 ${prefix}/usr/sbin/policy-rc.d + + + +# +# Log our finish +# +logMessage Script $0 finished. + only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/feisty/65-copy-user-files +++ xen-tools-3.9/hooks/feisty/65-copy-user-files @@ -0,0 +1,49 @@ +#!/bin/sh +# +# Copy files from a 'skel' directory, if present, into the +# new images +# + + +prefix=$1 + + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + +# +# Copy everything from the skel directory into the new instance +# if that directory exists. +# +if [ -d /etc/xen-tools/skel ]; then + + logMessage Copying files from /etc/xen-tools/skel + + (cd /etc/xen-tools/skel; tar -cf - . ) | (cd ${prefix}/; tar -xpf -) + + logMessage Finished + +else + + logMessage skel directory, /etc/xen-tools/skell, not present ignoring. + +fi + + +# +# Log our finish +# +logMessage Script $0 finished only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/feisty/05-shadowconfig-on +++ xen-tools-3.9/hooks/feisty/05-shadowconfig-on @@ -0,0 +1,45 @@ +#!/bin/sh +# +# This script enforces the use of a shadow password file. +# +# Steve +# -- +# http://www.steve.org.uk/ + + +prefix=$1 + + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + +# +# Enable the shadow passwords if the command is found. +# +if [ -x ${prefix}/sbin/shadowconfig ]; then + + chroot ${prefix} /sbin/shadowconfig on +else + + logMessage "/sbin/shadowconfig not found. skipping." +fi + + +# +# Log our finish +# +logMessage Script $0 finished. + only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/feisty/40-setup-networking +++ xen-tools-3.9/hooks/feisty/40-setup-networking @@ -0,0 +1,145 @@ +#!/bin/sh +# +# This script sets up the /etc/network/interface file for the new +# image. +# +# Steve +# -- +# http://www.steve.org.uk/ + + +prefix=$1 + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + +# +# Make sure we have an /etc/network directory. +# +mkdir -p ${prefix}/etc/network + + +# +# A function to setup DHCP for our new image. +# +setupDynamicNetworking () +{ + # + # The host is using DHCP. + # + cat < ${prefix}/etc/network/interfaces +# This file describes the network interfaces available on your system +# and how to activate them. For more information, see interfaces(5). + +# The loopback network interface +auto lo +iface lo inet loopback + +# The primary network interface +auto eth0 +iface eth0 inet dhcp +# post-up ethtool -K eth0 tx off + +# +# The commented out line above will disable TCP checksumming which +# might resolve problems for some users. It is disabled by default +# +E_O_DHCP +} + + + +# +# A function to setup static IP addresses for our new image. +# +setupStaticNetworking () +{ + # + # broadcast address? + # + bcast=''; + if [ ! -z "${broadcast}" ]; then + bcast = ' broadcast ${broadcast}' + fi + + # + # We have a static IP address + # + cat <${prefix}/etc/network/interfaces +# This file describes the network interfaces available on your system +# and how to activate them. For more information, see interfaces(5). + +# The loopback network interface +auto lo +iface lo inet loopback + +# The primary network interface +auto eth0 +iface eth0 inet static + address ${ip1} + gateway ${gateway} + netmask ${netmask} + ${bcast} + # post-up ethtool -K eth0 tx off + +# +# The commented out line above will disable TCP checksumming which +# might resolve problems for some users. It is disabled by default +# +E_O_STATIC + + interface=1 + count=2 + + while [ "${count}" -le "${ip_count}" ]; do + + value=\$ip${count} + value=`eval echo $value` + + logMessage Adding etho:${interface} + + cat <>${prefix}/etc/network/interfaces +auto eth0:${interface} +iface eth0:${interface} inet static + address ${value} + netmask ${netmask} + # post-up ethtool -K eth0 tx off +E_O_STATIC + count=`expr $count + 1` + interface=`expr $interface + 1` + done +} + + + + +# +# Call the relevant function +# +if [ -z "${dhcp}" ]; then + logMessage "Setting up static networking" + setupStaticNetworking + +else + logMessage "Setting up DHCP networking" + setupDynamicNetworking +fi + + +# +# Log our finish +# +logMessage Script $0 finished only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/feisty/60-copy-host-files +++ xen-tools-3.9/hooks/feisty/60-copy-host-files @@ -0,0 +1,58 @@ +#!/bin/sh +# +# Copy files from a 'skel' directory, if present, into the +# new images +# + + +prefix=$1 + + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + +# +# Copy "required" files from our host. +# +cp /etc/timezone ${prefix}/etc + +# +# If the host has sudo then copy the configuration file, and install +# the package +# +if [ -e /etc/sudoers ]; then + + logMessage Installing SUDO too. + + # + # Copy file and fixup permissions. + # + cp /etc/sudoers ${prefix}/etc + chown root:root ${prefix}/etc/sudoers + chmod 440 ${prefix}/etc/sudoers + + # + # Install sudo + # + installDebianPackage ${prefix} sudo + +fi + + +# +# Log our finish +# +logMessage Script $0 finished only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/feisty/50-setup-hostname +++ xen-tools-3.9/hooks/feisty/50-setup-hostname @@ -0,0 +1,117 @@ +#!/bin/sh +# +# This script places the new systems hostname into a couple of files within +# the new image. +# +# Steve +# -- +# http://www.steve.org.uk/ + + + +prefix=$1 + + +# +# Source our common functions +# +if [ -e /usr/lib/xen-tools/common.sh ]; then + . /usr/lib/xen-tools/common.sh +else + . ./hooks/common.sh +fi + + +# +# Log our start +# +logMessage Script $0 starting + + +# +# Setup the mailname + hostname files. +# +echo ${hostname} > ${prefix}/etc/hostname +echo ${hostname} > ${prefix}/etc/mailname + + +# +# Fixup the /etc/hosts file upon the new image for +# machines with static IPs +# +if [ -z "${dhcp}" ]; then + + # Non-IPv6 stuff. + grep -v '\(::\|IPv6\)' /etc/hosts > ${prefix}/etc/hosts + + # New entry. + echo "${ip1} ${hostname}" >> ${prefix}/etc/hosts + echo " " >> ${prefix}/etc/hosts + + # IPv6 stuff. + grep '\(::\|IPv6\)' /etc/hosts >> ${prefix}/etc/hosts + +else + + # + # Stub /etc/hosts for DHCP clients. + # + cat >> ${prefix}/etc/hosts < /dev/null ) ; then + + logMessage Host already has IP address for the host ${hostname}. + + else + # + # Short host name. + # + name=`echo ${hostname} | awk -F. '{print $1}'` + + logMessage Adding ${hostname} and ${name} to /etc/hosts on the host + + echo "${ip1} ${name} ${hostname}" >> /etc/hosts + + # + # If we've updated the /etc/hosts file on the host machine + # and there is an installation of dnsmasq installed then + # reload it. + # + # This will let the local LAN clients lookup the new address. + # + if [ -x /usr/sbin/dnsmasq ] ; then + if [ -e /var/run/dnsmasq.pid ]; then + + logMessage Allowing DNSMasq to restart. + + kill -HUP `cat /var/run/dnsmasq.pid` + fi + fi + fi +fi + + +# +# Log our finish +# +logMessage Script $0 finished only in patch2: unchanged: --- xen-tools-3.9.orig/hooks/centos-5/55-create-dev +++ xen-tools-3.9/hooks/centos-5/55-create-dev @@ -45,8 +45,11 @@ chroot ${prefix} /bin/sh -c 'cd /dev && ./MAKEDEV console' chroot ${prefix} /bin/sh -c 'cd /dev && ./MAKEDEV null' chroot ${prefix} /bin/sh -c 'cd /dev && ./MAKEDEV zero' - - +mknod /dev/xvda b 202 0 +for i in 1 2 3; do +chroot ${prefix} /bin/sh -c 'mknod /dev/xvda$i b 202 $i' +done +mknod /dev/xvc0 c 204 191 # # Log our finish #