- Preliminary support for xl toolstack
- xen-create-image: Consistently use runCommand() instead of system()
- Makefile accepts DESTDIR=…
+ - Move examples from debian/examples to examples.
* Add debian/gbp.conf to be able to to build xen-tools with
git-buildpackage.
* debian/rules: Don't mention (generated) upstream changelog explicitly,
+++ /dev/null
-#!/bin/sh
-#
-# This script is designed to setup the kernel and ramdisk inside
-# the xen-tools configuration file; and also update any stored values
-# in any pre-generated Xen guests.
-#
-# This is useful if you have upgraded your Xen kernel.
-#
-# Steve
-# --
-#
-
-
-
-
-#
-# Find the kernel to use, and the ramdisk, unless they are specified
-# in the environment.
-#
-if [ -z "${kernel}" ]; then
- kernel=`ls -1 /boot| grep ^vm| grep -v syms| grep xen | sort -r| head -n 1`
- kernel="/boot/${kernel}"
-fi
-if [ -z "${ramdisk}" ]; then
- ramdisk=`ls -1 /boot| grep ^init| grep xen| sort -r| head -n 1`
- ramdisk="/boot/${ramdisk}"
-fi
-
-
-#
-# Abort if we didn't find a kernel / ramdisk
-#
-if [ -z "${kernel}" ]; then
- echo "Failed to find Xen kernel."
- exit
-fi
-if [ -z "${ramdisk}" ]; then
- echo "Failed to find Xen ramdisk."
- exit
-fi
-
-
-#
-# Show what we're going to do - and prompt for confirmation.
-#
-cat <<EOF
-
- Updating xen-tools configuration file, and all Xen guests with:
-
- kernel : ${kernel}
- ramdisk : ${ramdisk}
-
- Press enter to continue, or Ctrl-c to abort.
-
-EOF
-read __dummy
-
-
-
-#
-# Update the xen-tools configuration file.
-#
-perl -pi -e "s|^\s*kernel\s*=(.*)|kernel = ${kernel}|" /etc/xen-tools/xen-tools.conf
-perl -pi -e "s|^\s*initrd\s*=(.*)|initrd = ${ramdisk}|" /etc/xen-tools/xen-tools.conf
-
-
-
-
-
-#
-# Now modify each of the Xen guest configuration files beneath /etc/xen.
-#
-for i in /etc/xen/*.cfg; do
-
- # test that the file exists - ie. glob succeeded.
- if [ -e $i ]; then
-
- #
- # Upgrade kernel + ramdisk
- #
- perl -pi -e "s|^\s*kernel\s*=(.*)|kernel = '${kernel}'|" $i
- perl -pi -e "s|^\s*ramdisk\s*=(.*)|ramdisk = '${ramdisk}'|" $i
-
- fi
-
-done
-
+++ /dev/null
-#!/usr/bin/perl
-#
-# This code is intended to update the modules installed within each
-# Xen guest domain to the named version.
-#
-# It should be fairly safe, but I make no promises - hence why this
-# is an example.
-#
-# Steve
-# --
-#
-
-use strict;
-use warnings;
-
-use File::Path qw/ rmtree /;
-use File::Temp qw/ tempdir /;
-
-
-my $modules = shift;
-if ( ! defined( $modules ) )
-{
- print <<EOF;
-
- Usage: $0 <modules>
-
- eg: $0 2.6.18.xx|/usr/lib/modules/nn.nn.nn-xen
-
-EOF
- exit;
-}
-
-
-#
-# Make sure the path is fully qualified.
-#
-if ( $modules !~ /^[\/\\]/ )
-{
- $modules = "/lib/modules/" . $modules;
-}
-
-
-#
-# Make sure the module directory exists.
-#
-if ( ! -d $modules )
-{
- print "The modules directory $modules doesn't exist.\n";
- exit;
-}
-
-
-#
-# OK now we have the modules so we need to:
-#
-# 0. Read our configuration file.
-# 1. Find each xen guest.
-# 2. Ensure it isn't running (TODO)
-# 3. Mount the disk image.
-# 4. Remove existing modules, and copy in the specified ones.
-#
-#
-
-
-my %CONFIG;
-readConfigurationFile( "/etc/xen-tools/xen-tools.conf" );
-
-
-foreach my $guest ( findGuests() )
-{
- print "Attempting to update guest: $guest\n";
-
- #
- # Create a temporary directory to mount the disk upon.
- #
- my $tmp = tempdir( CLEANUP => 1 );
-
- #
- # Mount the disk.
- #
- if ( $CONFIG{'dir'} )
- {
- # The loopback image.
- my $img = $CONFIG{'dir'} . "/domains/" . $guest . "/disk.img";
- system( "mount -o loop $img $tmp" );
- }
- elsif ( $CONFIG{'lvm'} )
- {
- # The LVM volume
- my $img = "/dev/" . $CONFIG{'lvm'} . "/$guest-disk";
- system( "mount $img $tmp" );
- }
- else
- {
- print "Unhandled disk format - can't mount\n";
- next;
- }
-
-
- #
- # We've got it mounted.
- #
- print "\tMounted disk image.\n";
-
- # make sure we have a directory
- if ( ! -d $tmp . "/lib/modules" )
- {
- print "\tMissing modules. Skipping\n";
- next;
- }
- #
- # Remove the existing module directories.
- #
- `rm -rf $tmp/lib/modules`;
- mkdir $tmp . "/lib/modules";
- print "\tRemoved existing modules\n";
-
- #
- # Copy existing directory.
- #
- if ( -d $tmp . "/lib/modules" )
- {
- `cp -R $modules $tmp/lib/modules/`;
- print "\tCopied over $modules\n";
- }
- else
- {
- print "No module directory .. weirdness\n";
- }
-
- #
- # Unmount
- #
- system( "umount $tmp" );
- print "\tUnmounted disk image.\n\n";
-}
-
-
-
-
-=begin doc
-
- Find each xen guest upon the system.
-
-=end doc
-
-=cut
-
-sub findGuests
-{
- my @results;
-
- #
- # Assume xen-tools.
- #
- foreach my $file ( glob( "/etc/xen/*.cfg" ) )
- {
- #
- # Find the name.
- #
- open( INPUT, "<" , $file );
- foreach my $line ( <INPUT> )
- {
- chomp( $line );
- if ( $line =~ /name\s*=\s*['"]([^'"]+)["']/ )
- {
- push @results, $1;
- }
- }
- close( INPUT );
- }
- return( sort( @results ) );
-}
-
-
-
-
-=begin doc
-
- Read the configuration file specified.
-
-=end doc
-
-=cut
-
-sub readConfigurationFile
-{
- my ($file) = ( @_ );
-
- open( FILE, "<", $file ) or die "Cannot read file '$file' - $!";
-
- my $line = "";
-
- while (defined($line = <FILE>) )
- {
- chomp $line;
- if ($line =~ s/\\$//)
- {
- $line .= <FILE>;
- redo unless eof(FILE);
- }
-
- # Skip lines beginning with comments
- next if ( $line =~ /^([ \t]*)\#/ );
-
- # Skip blank lines
- next if ( length( $line ) < 1 );
-
- # Strip trailing comments.
- if ( $line =~ /(.*)\#(.*)/ )
- {
- $line = $1;
- }
-
- # Find variable settings
- if ( $line =~ /([^=]+)=([^\n]+)/ )
- {
- my $key = $1;
- my $val = $2;
-
- # Strip leading and trailing whitespace.
- $key =~ s/^\s+//;
- $key =~ s/\s+$//;
- $val =~ s/^\s+//;
- $val =~ s/\s+$//;
-
- # Store value.
- $CONFIG{ $key } = $val;
- }
- }
-
- close( FILE );
-}
dh_testdir
dh_testroot
dh_install
- dh_installexamples debian/examples/setup-kernel-initrd debian/examples/update-modules
+ dh_installexamples examples/setup-kernel-initrd examples/update-modules
dh_installchangelogs
dh_installdocs
dh_compress
--- /dev/null
+#!/bin/sh
+#
+# This script is designed to setup the kernel and ramdisk inside
+# the xen-tools configuration file; and also update any stored values
+# in any pre-generated Xen guests.
+#
+# This is useful if you have upgraded your Xen kernel.
+#
+# Steve
+# --
+#
+
+
+
+
+#
+# Find the kernel to use, and the ramdisk, unless they are specified
+# in the environment.
+#
+if [ -z "${kernel}" ]; then
+ kernel=`ls -1 /boot| grep ^vm| grep -v syms| grep xen | sort -r| head -n 1`
+ kernel="/boot/${kernel}"
+fi
+if [ -z "${ramdisk}" ]; then
+ ramdisk=`ls -1 /boot| grep ^init| grep xen| sort -r| head -n 1`
+ ramdisk="/boot/${ramdisk}"
+fi
+
+
+#
+# Abort if we didn't find a kernel / ramdisk
+#
+if [ -z "${kernel}" ]; then
+ echo "Failed to find Xen kernel."
+ exit
+fi
+if [ -z "${ramdisk}" ]; then
+ echo "Failed to find Xen ramdisk."
+ exit
+fi
+
+
+#
+# Show what we're going to do - and prompt for confirmation.
+#
+cat <<EOF
+
+ Updating xen-tools configuration file, and all Xen guests with:
+
+ kernel : ${kernel}
+ ramdisk : ${ramdisk}
+
+ Press enter to continue, or Ctrl-c to abort.
+
+EOF
+read __dummy
+
+
+
+#
+# Update the xen-tools configuration file.
+#
+perl -pi -e "s|^\s*kernel\s*=(.*)|kernel = ${kernel}|" /etc/xen-tools/xen-tools.conf
+perl -pi -e "s|^\s*initrd\s*=(.*)|initrd = ${ramdisk}|" /etc/xen-tools/xen-tools.conf
+
+
+
+
+
+#
+# Now modify each of the Xen guest configuration files beneath /etc/xen.
+#
+for i in /etc/xen/*.cfg; do
+
+ # test that the file exists - ie. glob succeeded.
+ if [ -e $i ]; then
+
+ #
+ # Upgrade kernel + ramdisk
+ #
+ perl -pi -e "s|^\s*kernel\s*=(.*)|kernel = '${kernel}'|" $i
+ perl -pi -e "s|^\s*ramdisk\s*=(.*)|ramdisk = '${ramdisk}'|" $i
+
+ fi
+
+done
+
--- /dev/null
+#!/usr/bin/perl
+#
+# This code is intended to update the modules installed within each
+# Xen guest domain to the named version.
+#
+# It should be fairly safe, but I make no promises - hence why this
+# is an example.
+#
+# Steve
+# --
+#
+
+use strict;
+use warnings;
+
+use File::Path qw/ rmtree /;
+use File::Temp qw/ tempdir /;
+
+
+my $modules = shift;
+if ( ! defined( $modules ) )
+{
+ print <<EOF;
+
+ Usage: $0 <modules>
+
+ eg: $0 2.6.18.xx|/usr/lib/modules/nn.nn.nn-xen
+
+EOF
+ exit;
+}
+
+
+#
+# Make sure the path is fully qualified.
+#
+if ( $modules !~ /^[\/\\]/ )
+{
+ $modules = "/lib/modules/" . $modules;
+}
+
+
+#
+# Make sure the module directory exists.
+#
+if ( ! -d $modules )
+{
+ print "The modules directory $modules doesn't exist.\n";
+ exit;
+}
+
+
+#
+# OK now we have the modules so we need to:
+#
+# 0. Read our configuration file.
+# 1. Find each xen guest.
+# 2. Ensure it isn't running (TODO)
+# 3. Mount the disk image.
+# 4. Remove existing modules, and copy in the specified ones.
+#
+#
+
+
+my %CONFIG;
+readConfigurationFile( "/etc/xen-tools/xen-tools.conf" );
+
+
+foreach my $guest ( findGuests() )
+{
+ print "Attempting to update guest: $guest\n";
+
+ #
+ # Create a temporary directory to mount the disk upon.
+ #
+ my $tmp = tempdir( CLEANUP => 1 );
+
+ #
+ # Mount the disk.
+ #
+ if ( $CONFIG{'dir'} )
+ {
+ # The loopback image.
+ my $img = $CONFIG{'dir'} . "/domains/" . $guest . "/disk.img";
+ system( "mount -o loop $img $tmp" );
+ }
+ elsif ( $CONFIG{'lvm'} )
+ {
+ # The LVM volume
+ my $img = "/dev/" . $CONFIG{'lvm'} . "/$guest-disk";
+ system( "mount $img $tmp" );
+ }
+ else
+ {
+ print "Unhandled disk format - can't mount\n";
+ next;
+ }
+
+
+ #
+ # We've got it mounted.
+ #
+ print "\tMounted disk image.\n";
+
+ # make sure we have a directory
+ if ( ! -d $tmp . "/lib/modules" )
+ {
+ print "\tMissing modules. Skipping\n";
+ next;
+ }
+ #
+ # Remove the existing module directories.
+ #
+ `rm -rf $tmp/lib/modules`;
+ mkdir $tmp . "/lib/modules";
+ print "\tRemoved existing modules\n";
+
+ #
+ # Copy existing directory.
+ #
+ if ( -d $tmp . "/lib/modules" )
+ {
+ `cp -R $modules $tmp/lib/modules/`;
+ print "\tCopied over $modules\n";
+ }
+ else
+ {
+ print "No module directory .. weirdness\n";
+ }
+
+ #
+ # Unmount
+ #
+ system( "umount $tmp" );
+ print "\tUnmounted disk image.\n\n";
+}
+
+
+
+
+=begin doc
+
+ Find each xen guest upon the system.
+
+=end doc
+
+=cut
+
+sub findGuests
+{
+ my @results;
+
+ #
+ # Assume xen-tools.
+ #
+ foreach my $file ( glob( "/etc/xen/*.cfg" ) )
+ {
+ #
+ # Find the name.
+ #
+ open( INPUT, "<" , $file );
+ foreach my $line ( <INPUT> )
+ {
+ chomp( $line );
+ if ( $line =~ /name\s*=\s*['"]([^'"]+)["']/ )
+ {
+ push @results, $1;
+ }
+ }
+ close( INPUT );
+ }
+ return( sort( @results ) );
+}
+
+
+
+
+=begin doc
+
+ Read the configuration file specified.
+
+=end doc
+
+=cut
+
+sub readConfigurationFile
+{
+ my ($file) = ( @_ );
+
+ open( FILE, "<", $file ) or die "Cannot read file '$file' - $!";
+
+ my $line = "";
+
+ while (defined($line = <FILE>) )
+ {
+ chomp $line;
+ if ($line =~ s/\\$//)
+ {
+ $line .= <FILE>;
+ redo unless eof(FILE);
+ }
+
+ # Skip lines beginning with comments
+ next if ( $line =~ /^([ \t]*)\#/ );
+
+ # Skip blank lines
+ next if ( length( $line ) < 1 );
+
+ # Strip trailing comments.
+ if ( $line =~ /(.*)\#(.*)/ )
+ {
+ $line = $1;
+ }
+
+ # Find variable settings
+ if ( $line =~ /([^=]+)=([^\n]+)/ )
+ {
+ my $key = $1;
+ my $val = $2;
+
+ # Strip leading and trailing whitespace.
+ $key =~ s/^\s+//;
+ $key =~ s/\s+$//;
+ $val =~ s/^\s+//;
+ $val =~ s/\s+$//;
+
+ # Store value.
+ $CONFIG{ $key } = $val;
+ }
+ }
+
+ close( FILE );
+}