2007-07-07 23:48:08 by steve
INITIAL COMMIT: Support for arbitary partitioning systems. Patch from Sascha Kettler.
This commit is contained in:
3
AUTHORS
3
AUTHORS
@@ -32,6 +32,9 @@ Contributions
|
||||
Kirk Ismay <captain [at] com.netidea>
|
||||
- Added hook for automatic CFEngine installation.
|
||||
|
||||
Sascha Kettler <kettler [at] net.gmx>
|
||||
- Implemented support for arbitary partitioning schemes.
|
||||
|
||||
Eric Lemoine <eric.lemoine [at] com.gmail>
|
||||
- Improved binary detection and good suggestions.
|
||||
- Better portability for non-bash shells.
|
||||
|
||||
4
Makefile
4
Makefile
@@ -8,7 +8,7 @@
|
||||
# --
|
||||
# http://www.steve.org.uk/
|
||||
#
|
||||
# $Id: Makefile,v 1.105 2007-06-16 13:44:37 steve Exp $
|
||||
# $Id: Makefile,v 1.106 2007-07-07 23:48:08 steve Exp $
|
||||
|
||||
|
||||
#
|
||||
@@ -100,9 +100,11 @@ install-etc:
|
||||
-if [ -d ${prefix}/etc/xen-tools/hook.d ]; then mv ${prefix}/etc/xen-tools/hook.d/ ${prefix}/etc/xen-tools/hook.d.obsolete ; fi
|
||||
-mkdir -p ${prefix}/etc/xen-tools/skel/
|
||||
-mkdir -p ${prefix}/etc/xen-tools/role.d/
|
||||
-mkdir -p ${prefix}/etc/xen-tools/partitions.d/
|
||||
cp etc/xen-tools.conf ${prefix}/etc/xen-tools/
|
||||
cp etc/xm.tmpl ${prefix}/etc/xen-tools/
|
||||
cp etc/xm-nfs.tmpl ${prefix}/etc/xen-tools/
|
||||
cp partitions/*-* ${prefix}/etc/xen-tools/partitions.d/
|
||||
-mkdir -p ${prefix}/etc/bash_completion.d
|
||||
cp misc/xen-tools ${prefix}/etc/bash_completion.d/
|
||||
cp misc/xm ${prefix}/etc/bash_completion.d/
|
||||
|
||||
1049
bin/xen-create-image
1049
bin/xen-create-image
File diff suppressed because it is too large
Load Diff
@@ -103,7 +103,7 @@ xt-create-config - Create a Xen configuration file for a new guest
|
||||
--
|
||||
http://www.steve.org.uk/
|
||||
|
||||
$Id: xt-create-xen-config,v 1.40 2007-06-16 13:44:38 steve Exp $
|
||||
$Id: xt-create-xen-config,v 1.41 2007-07-07 23:48:09 steve Exp $
|
||||
|
||||
=cut
|
||||
|
||||
@@ -136,6 +136,11 @@ use Text::Template;
|
||||
#
|
||||
my %CONFIG;
|
||||
|
||||
#
|
||||
# Partition layout information values read from the partitions file.
|
||||
#
|
||||
my @PARTITIONS = undef;
|
||||
|
||||
#
|
||||
# Default options
|
||||
#
|
||||
@@ -225,7 +230,7 @@ sub parseCommandLineArguments
|
||||
|
||||
if ( $VERSION )
|
||||
{
|
||||
my $REVISION = '$Revision: 1.40 $';
|
||||
my $REVISION = '$Revision: 1.41 $';
|
||||
if ( $REVISION =~ /1.([0-9.]+) / )
|
||||
{
|
||||
$REVISION = $1;
|
||||
@@ -287,6 +292,36 @@ sub checkArguments
|
||||
}
|
||||
|
||||
|
||||
=begin doc
|
||||
|
||||
Reconstructs the internal partitions array from the text representation exported by the xen-create-image script.
|
||||
|
||||
=end doc
|
||||
|
||||
=cut
|
||||
|
||||
sub importPartitionsFromEnvironment
|
||||
{
|
||||
@PARTITIONS = ();
|
||||
|
||||
for (my $i=1; $i <= $ENV{'NUMPARTITIONS'}; $i++)
|
||||
{
|
||||
my @parts = split(/:/, $ENV{'PARTITION' . $i}, 7);
|
||||
push( @PARTITIONS,
|
||||
{
|
||||
'name' => $parts[0],
|
||||
'size' => $parts[1],
|
||||
'type' => $parts[2],
|
||||
'mountpoint' => $parts[3],
|
||||
'options' => $parts[4],
|
||||
'imagetype' => $parts[5],
|
||||
'image' => $parts[6]
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
=begin doc
|
||||
|
||||
@@ -343,45 +378,38 @@ sub createXenConfig
|
||||
#
|
||||
# Images as presented to Xen - either loopback images, or LVM partitions.
|
||||
#
|
||||
my $image_vbd;
|
||||
my $swap_vbd;
|
||||
|
||||
if ( $ENV{'lvm'} )
|
||||
{
|
||||
$image_vbd = "phy:$ENV{'lvm'}/$ENV{'hostname'}-disk";
|
||||
$swap_vbd = "phy:$ENV{'lvm'}/$ENV{'hostname'}-swap";
|
||||
$ENV{'image_prefix'} = "phy:$ENV{'lvm'}/$ENV{'hostname'}-";
|
||||
$ENV{'image_suffix'} = '';
|
||||
importPartitionsFromEnvironment();
|
||||
}
|
||||
elsif ( $ENV{'evms'} )
|
||||
{
|
||||
$image_vbd = "phy:/dev/evms/$ENV{'hostname'}-disk";
|
||||
$swap_vbd = "phy:/dev/evms/$ENV{'hostname'}-swap";
|
||||
$ENV{'image_prefix'} = "phy:/dev/evms/$ENV{'hostname'}-";
|
||||
$ENV{'image_suffix'} = '';
|
||||
importPartitionsFromEnvironment();
|
||||
}
|
||||
elsif ( $ENV{'image-dev'} )
|
||||
{
|
||||
$image_vbd = "phy:$ENV{'image-dev'}";
|
||||
$ENV{'image_vbd'} = "phy:$ENV{'image-dev'}";
|
||||
|
||||
if ( $ENV{'swap-dev'} )
|
||||
{
|
||||
$swap_vbd = "phy:$ENV{'swap-dev'}";
|
||||
$ENV{'swap_vbd'} = "phy:$ENV{'swap-dev'}";
|
||||
}
|
||||
else
|
||||
{
|
||||
$swap_vbd = undef;
|
||||
$ENV{'swap_vbd'} = undef;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$image_vbd = "file:$ENV{'dir'}/domains/$ENV{'hostname'}/disk.img";
|
||||
$swap_vbd = "file:$ENV{'dir'}/domains/$ENV{'hostname'}/swap.img";
|
||||
$ENV{'image_prefix'} = "file:$ENV{'dir'}/domains/$ENV{'hostname'}/";
|
||||
$ENV{'image_suffix'} = '.img';
|
||||
importPartitionsFromEnvironment();
|
||||
}
|
||||
|
||||
#
|
||||
# Setup the two devices in our environment.
|
||||
#
|
||||
$ENV{'image_vbd'} = $image_vbd;
|
||||
$ENV{'swap_vbd'} = $swap_vbd;
|
||||
|
||||
|
||||
#
|
||||
# The xen-tools version.
|
||||
#
|
||||
@@ -398,6 +426,7 @@ sub createXenConfig
|
||||
{
|
||||
$vars{$key} = $ENV{$key};
|
||||
}
|
||||
$vars{'PARTITIONS'} = \@PARTITIONS;
|
||||
|
||||
#
|
||||
# Now output the data.
|
||||
|
||||
7
debian/changelog
vendored
7
debian/changelog
vendored
@@ -1,3 +1,10 @@
|
||||
xen-tools (3.6-1) unstable; urgency=low
|
||||
|
||||
* UNRELEASED.
|
||||
- Partitioning support.
|
||||
|
||||
-- Steve Kemp <steve@steve.org.uk> Sun, 16 Jun 2007 14:43:00 +0000
|
||||
|
||||
xen-tools (3.5-1) unstable; urgency=low
|
||||
|
||||
* Only add Debian sources for security.debian.org if enabled upon the host.
|
||||
|
||||
2
debian/control
vendored
2
debian/control
vendored
@@ -8,7 +8,7 @@ Standards-Version: 3.7.2
|
||||
|
||||
Package: xen-tools
|
||||
Architecture: all
|
||||
Depends: debootstrap, perl-modules, libtext-template-perl
|
||||
Depends: debootstrap, perl-modules, libtext-template-perl, libconfig-inifiles-perl
|
||||
Recommends: xen-hypervisor-amd64 | xen-hypervisor-i386 | xen-hypervisor-i386-pae, reiserfsprogs, xfsprogs, rpmstrap, perl-doc, xen-shell, libexpect-perl
|
||||
Description: Tools to manage debian XEN virtual servers
|
||||
This package contains tools to manage Debian based XEN virtual servers.
|
||||
|
||||
17
etc/xm.tmpl
17
etc/xm.tmpl
@@ -21,15 +21,20 @@ memory = '{$memory}'
|
||||
#
|
||||
# Disk device(s).
|
||||
#
|
||||
root = '/dev/{$device}1 ro'
|
||||
{ if ( $noswap )
|
||||
{
|
||||
for ( my $i = 0; $i <= $#PARTITIONS; $i++ )
|
||||
{
|
||||
$OUT .= "disk = [ '$image_vbd,$device" . "1,w' ]";
|
||||
if ( $PARTITIONS[$i]{'mountpoint'} eq '/' )
|
||||
{
|
||||
$OUT .= "root = '/dev/$device" . ($i + 1) . " ro'\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
$OUT .= "disk = [\n";
|
||||
for ( my $i = 0; $i <= $#PARTITIONS; $i++ )
|
||||
{
|
||||
$OUT .= "disk = [ '$image_vbd,$device" . "1,w', '$swap_vbd,$device" . "2,w' ]";
|
||||
$OUT .= " '$PARTITIONS[$i]{'imagetype'}$PARTITIONS[$i]{'image'},$device" . ( $i + 1 ) .",w',\n";
|
||||
}
|
||||
$OUT .= " ]\n";
|
||||
}
|
||||
|
||||
#
|
||||
@@ -81,4 +86,4 @@ on_crash = 'restart'
|
||||
{
|
||||
$OUT .= "xen_shell = '$admins'\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,20 +30,6 @@ fi
|
||||
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, and reiserfs.
|
||||
#
|
||||
options="errors=remount-ro"
|
||||
|
||||
case "${fs}" in
|
||||
xfs)
|
||||
options="defaults"
|
||||
;;
|
||||
esac
|
||||
|
||||
logMessage Filesystem options are ${options}
|
||||
|
||||
|
||||
@@ -58,36 +44,52 @@ fi
|
||||
#
|
||||
# Now we have the options we can create the fstab.
|
||||
#
|
||||
has_xfs=0
|
||||
has_reiserfs=0
|
||||
cat <<E_O_FSTAB > ${prefix}/etc/fstab
|
||||
/dev/${device}1 / ${fs} ${options} 0 1
|
||||
proc /proc proc rw,nodev,nosuid,noexec 0 0
|
||||
E_O_FSTAB
|
||||
|
||||
|
||||
# /etc/fstab: static file system information.
|
||||
#
|
||||
# Add in the swap unless it is disabled
|
||||
#
|
||||
if [ "${noswap}" ]; then
|
||||
:
|
||||
else
|
||||
cat <<E_O_FSTAB >> ${prefix}/etc/fstab
|
||||
/dev/${device}2 none swap sw 0 0
|
||||
# <file system> <mount point> <type> <options> <dump> <pass>
|
||||
proc /proc proc defaults 0 0
|
||||
E_O_FSTAB
|
||||
fi
|
||||
for part in `seq 1 ${NUMPARTITIONS}`; do
|
||||
eval "PARTITION=\"\${PARTITION${part}}\""
|
||||
OLDIFS="${IFS}"
|
||||
IFS=:
|
||||
x=0
|
||||
for partdata in ${PARTITION}; do
|
||||
eval "partdata${x}=\"${partdata}\""
|
||||
x=$(( x+1 ))
|
||||
done
|
||||
IFS="${OLDIFS}"
|
||||
|
||||
case "${partdata2}" in
|
||||
xfs)
|
||||
has_xfs=1
|
||||
;;
|
||||
reiserfs)
|
||||
has_reiserfs=1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "${partdata2}" = "swap" ]; then
|
||||
echo "/dev/${device}${part} none swap sw 0 0" >> ${prefix}/etc/fstab
|
||||
else
|
||||
echo "/dev/${device}${part} ${partdata3} ${partdata2} ${partdata4} 0 1" >> ${prefix}/etc/fstab
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Finally we can install any required packages for the given root
|
||||
# filesystem
|
||||
#
|
||||
#case "${fs}" in
|
||||
# xfs)
|
||||
# install_package xfsprogs
|
||||
# ;;
|
||||
# reiserfs)
|
||||
# install_package reiserfsprogs
|
||||
# ;;
|
||||
#esac
|
||||
#if [ $has_xfs -eq 1 ]; then
|
||||
# installDebianPackage ${prefix} xfsprogs
|
||||
#fi
|
||||
#if [ $has_reiserfs -eq 1 ]; then
|
||||
# installDebianPackage ${prefix} reiserfsprogs
|
||||
#fi
|
||||
|
||||
|
||||
#
|
||||
|
||||
@@ -41,7 +41,16 @@ 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
|
||||
if [ -n "${modules}" -a -d "${modules}" ]; then
|
||||
|
||||
#
|
||||
# Modules path was specified during install
|
||||
#
|
||||
logMessage "Copying modules from ${modules}"
|
||||
|
||||
mkdir -p ${prefix}/lib/modules
|
||||
cp -au ${modules} ${prefix}/lib/modules
|
||||
elif chroot ${prefix} /usr/bin/apt-cache show ${linux_modules_package} >/dev/null 2>/dev/null; then
|
||||
|
||||
logMessage "Package '${linux_modules_package}' is available - installing"
|
||||
|
||||
|
||||
@@ -30,24 +30,6 @@ fi
|
||||
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
|
||||
#
|
||||
@@ -59,35 +41,52 @@ fi
|
||||
#
|
||||
# Now we have the options we can create the fstab.
|
||||
#
|
||||
has_xfs=0
|
||||
has_reiserfs=0
|
||||
cat <<E_O_FSTAB > ${prefix}/etc/fstab
|
||||
/dev/${device}1 / ${fs} ${options} 0 1
|
||||
proc /proc proc rw,nodev,nosuid,noexec 0 0
|
||||
E_O_FSTAB
|
||||
|
||||
# /etc/fstab: static file system information.
|
||||
#
|
||||
# Add in the swap unless it is disabled
|
||||
#
|
||||
if [ "${noswap}" ]; then
|
||||
:
|
||||
else
|
||||
cat <<E_O_FSTAB >> ${prefix}/etc/fstab
|
||||
/dev/${device}2 none swap sw 0 0
|
||||
# <file system> <mount point> <type> <options> <dump> <pass>
|
||||
proc /proc proc defaults 0 0
|
||||
E_O_FSTAB
|
||||
fi
|
||||
for part in `seq 1 ${NUMPARTITIONS}`; do
|
||||
eval "PARTITION=\"\${PARTITION${part}}\""
|
||||
OLDIFS="${IFS}"
|
||||
IFS=:
|
||||
x=0
|
||||
for partdata in ${PARTITION}; do
|
||||
eval "partdata${x}=\"${partdata}\""
|
||||
x=$(( x+1 ))
|
||||
done
|
||||
IFS="${OLDIFS}"
|
||||
|
||||
case "${partdata2}" in
|
||||
xfs)
|
||||
has_xfs=1
|
||||
;;
|
||||
reiserfs)
|
||||
has_reiserfs=1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "${partdata2}" = "swap" ]; then
|
||||
echo "/dev/${device}${part} none swap sw 0 0" >> ${prefix}/etc/fstab
|
||||
else
|
||||
echo "/dev/${device}${part} ${partdata3} ${partdata2} ${partdata4} 0 1" >> ${prefix}/etc/fstab
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Finally we can install any required packages for the given root
|
||||
# filesystem
|
||||
#
|
||||
case "${fs}" in
|
||||
xfs)
|
||||
installDebianPackage ${prefix} xfsprogs
|
||||
;;
|
||||
reiserfs)
|
||||
installDebianPackage ${prefix} reiserfsprogs
|
||||
;;
|
||||
esac
|
||||
if [ $has_xfs -eq 1 ]; then
|
||||
installDebianPackage ${prefix} xfsprogs
|
||||
fi
|
||||
if [ $has_reiserfs -eq 1 ]; then
|
||||
installDebianPackage ${prefix} reiserfsprogs
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
|
||||
@@ -29,9 +29,20 @@ logMessage Script $0 starting
|
||||
#
|
||||
# Disable the startup scripts from all runlevels.
|
||||
#
|
||||
chmod -x ${prefix}/etc/init.d/hwclock.sh
|
||||
chmod -x ${prefix}/etc/init.d/hwclockfirst.sh
|
||||
if [ -x ${prefix}/etc/init.d/hwclock.sh ]; then
|
||||
|
||||
chmod -x ${prefix}/etc/init.d/hwclock.sh
|
||||
else
|
||||
|
||||
logMessage "/etc/init.d/hwclock.sh not found. skipping."
|
||||
fi
|
||||
if [ -x ${prefix}/etc/init.d/hwclockfirst.sh ]; then
|
||||
|
||||
chmod -x ${prefix}/etc/init.d/hwclockfirst.sh
|
||||
else
|
||||
|
||||
logMessage "/etc/init.d/hwclockfirst.sh not found. skipping."
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
|
||||
@@ -32,6 +32,14 @@ logMessage Script $0 starting
|
||||
# should speed up installs which use --copy/--tar
|
||||
#
|
||||
if ( test `ls -1 ${prefix}/dev | wc -l` -gt 10 ); then
|
||||
#
|
||||
# We still need to make sure the basic devices are present
|
||||
#
|
||||
cd ${prefix}/dev
|
||||
./MAKEDEV std
|
||||
./MAKEDEV hda
|
||||
./MAKEDEV sda
|
||||
|
||||
logMessage "Terminating because there appear to be files in /dev already"
|
||||
exit
|
||||
fi
|
||||
|
||||
@@ -41,7 +41,16 @@ 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
|
||||
if [ -n "${modules}" -a -d "${modules}" ]; then
|
||||
|
||||
#
|
||||
# Modules path was specified during install
|
||||
#
|
||||
logMessage "Copying modules from ${modules}"
|
||||
|
||||
mkdir -p ${prefix}/lib/modules
|
||||
cp -au ${modules} ${prefix}/lib/modules
|
||||
elif chroot ${prefix} /usr/bin/apt-cache show ${linux_modules_package} >/dev/null 2>/dev/null; then
|
||||
|
||||
logMessage "Package '${linux_modules_package}' is available - installing"
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
# --
|
||||
# http://www.steve.org.uk/
|
||||
|
||||
|
||||
prefix=$1
|
||||
|
||||
#
|
||||
@@ -30,24 +29,6 @@ fi
|
||||
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
|
||||
#
|
||||
@@ -59,35 +40,52 @@ fi
|
||||
#
|
||||
# Now we have the options we can create the fstab.
|
||||
#
|
||||
has_xfs=0
|
||||
has_reiserfs=0
|
||||
cat <<E_O_FSTAB > ${prefix}/etc/fstab
|
||||
/dev/${device}1 / ${fs} ${options} 0 1
|
||||
proc /proc proc rw,nodev,nosuid,noexec 0 0
|
||||
E_O_FSTAB
|
||||
|
||||
# /etc/fstab: static file system information.
|
||||
#
|
||||
# Add in the swap unless it is disabled
|
||||
#
|
||||
if [ "${noswap}" ]; then
|
||||
:
|
||||
else
|
||||
cat <<E_O_FSTAB >> ${prefix}/etc/fstab
|
||||
/dev/${device}2 none swap sw 0 0
|
||||
# <file system> <mount point> <type> <options> <dump> <pass>
|
||||
proc /proc proc defaults 0 0
|
||||
E_O_FSTAB
|
||||
fi
|
||||
for part in `seq 1 ${NUMPARTITIONS}`; do
|
||||
eval "PARTITION=\"\${PARTITION${part}}\""
|
||||
OLDIFS="${IFS}"
|
||||
IFS=:
|
||||
x=0
|
||||
for partdata in ${PARTITION}; do
|
||||
eval "partdata${x}=\"${partdata}\""
|
||||
x=$(( x+1 ))
|
||||
done
|
||||
IFS="${OLDIFS}"
|
||||
|
||||
case "${partdata2}" in
|
||||
xfs)
|
||||
has_xfs=1
|
||||
;;
|
||||
reiserfs)
|
||||
has_reiserfs=1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "${partdata2}" = "swap" ]; then
|
||||
echo "/dev/${device}${part} none swap sw 0 0" >> ${prefix}/etc/fstab
|
||||
else
|
||||
echo "/dev/${device}${part} ${partdata3} ${partdata2} ${partdata4} 0 1" >> ${prefix}/etc/fstab
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Finally we can install any required packages for the given root
|
||||
# filesystem
|
||||
#
|
||||
case "${fs}" in
|
||||
xfs)
|
||||
installDebianPackage ${prefix} xfsprogs
|
||||
;;
|
||||
reiserfs)
|
||||
installDebianPackage ${prefix} reiserfsprogs
|
||||
;;
|
||||
esac
|
||||
if [ $has_xfs -eq 1 ]; then
|
||||
installDebianPackage ${prefix} xfsprogs
|
||||
fi
|
||||
if [ $has_reiserfs -eq 1 ]; then
|
||||
installDebianPackage ${prefix} reiserfsprogs
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
|
||||
@@ -38,11 +38,6 @@ fi
|
||||
installDebianPackage ${prefix} locales
|
||||
installDebianPackage ${prefix} util-linux-locales
|
||||
|
||||
#
|
||||
# Now generate the actual locale files.
|
||||
#
|
||||
chroot ${prefix} /usr/sbin/locale-gen
|
||||
|
||||
|
||||
|
||||
#
|
||||
|
||||
@@ -41,7 +41,16 @@ 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
|
||||
if [ -n "${modules}" -a -d "${modules}" ]; then
|
||||
|
||||
#
|
||||
# Modules path was specified during install
|
||||
#
|
||||
logMessage "Copying modules from ${modules}"
|
||||
|
||||
mkdir -p ${prefix}/lib/modules
|
||||
cp -au ${modules} ${prefix}/lib/modules
|
||||
elif chroot ${prefix} /usr/bin/apt-cache show ${linux_modules_package} >/dev/null 2>/dev/null; then
|
||||
|
||||
logMessage "Package '${linux_modules_package}' is available - installing"
|
||||
|
||||
|
||||
@@ -30,24 +30,6 @@ fi
|
||||
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
|
||||
#
|
||||
@@ -59,35 +41,52 @@ fi
|
||||
#
|
||||
# Now we have the options we can create the fstab.
|
||||
#
|
||||
has_xfs=0
|
||||
has_reiserfs=0
|
||||
cat <<E_O_FSTAB > ${prefix}/etc/fstab
|
||||
/dev/${device}1 / ${fs} ${options} 0 1
|
||||
proc /proc proc rw,nodev,nosuid,noexec 0 0
|
||||
E_O_FSTAB
|
||||
|
||||
# /etc/fstab: static file system information.
|
||||
#
|
||||
# Add in the swap unless it is disabled
|
||||
#
|
||||
if [ "${noswap}" ]; then
|
||||
:
|
||||
else
|
||||
cat <<E_O_FSTAB >> ${prefix}/etc/fstab
|
||||
/dev/${device}2 none swap sw 0 0
|
||||
# <file system> <mount point> <type> <options> <dump> <pass>
|
||||
proc /proc proc defaults 0 0
|
||||
E_O_FSTAB
|
||||
fi
|
||||
for part in `seq 1 ${NUMPARTITIONS}`; do
|
||||
eval "PARTITION=\"\${PARTITION${part}}\""
|
||||
OLDIFS="${IFS}"
|
||||
IFS=:
|
||||
x=0
|
||||
for partdata in ${PARTITION}; do
|
||||
eval "partdata${x}=\"${partdata}\""
|
||||
x=$(( x+1 ))
|
||||
done
|
||||
IFS="${OLDIFS}"
|
||||
|
||||
case "${partdata2}" in
|
||||
xfs)
|
||||
has_xfs=1
|
||||
;;
|
||||
reiserfs)
|
||||
has_reiserfs=1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "${partdata2}" = "swap" ]; then
|
||||
echo "/dev/${device}${part} none swap sw 0 0" >> ${prefix}/etc/fstab
|
||||
else
|
||||
echo "/dev/${device}${part} ${partdata3} ${partdata2} ${partdata4} 0 1" >> ${prefix}/etc/fstab
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Finally we can install any required packages for the given root
|
||||
# filesystem
|
||||
#
|
||||
case "${fs}" in
|
||||
xfs)
|
||||
installDebianPackage ${prefix} xfsprogs
|
||||
;;
|
||||
reiserfs)
|
||||
installDebianPackage ${prefix} reiserfsprogs
|
||||
;;
|
||||
esac
|
||||
if [ $has_xfs -eq 1 ]; then
|
||||
installDebianPackage ${prefix} xfsprogs
|
||||
fi
|
||||
if [ $has_reiserfs -eq 1 ]; then
|
||||
installDebianPackage ${prefix} reiserfsprogs
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
|
||||
@@ -30,23 +30,6 @@ fi
|
||||
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, and reiserfs.
|
||||
#
|
||||
options="errors=remount-ro"
|
||||
|
||||
case "${fs}" in
|
||||
xfs)
|
||||
options="defaults"
|
||||
;;
|
||||
esac
|
||||
|
||||
logMessage Filesystem options are ${options}
|
||||
|
||||
|
||||
#
|
||||
# Make sure we use ide style device names if required
|
||||
#
|
||||
@@ -58,37 +41,52 @@ fi
|
||||
#
|
||||
# Now we have the options we can create the fstab.
|
||||
#
|
||||
has_xfs=0
|
||||
has_reiserfs=0
|
||||
cat <<E_O_FSTAB > ${prefix}/etc/fstab
|
||||
/dev/${device}1 / ${fs} ${options} 0 1
|
||||
proc /proc proc rw,nodev,nosuid,noexec 0 0
|
||||
E_O_FSTAB
|
||||
|
||||
|
||||
# /etc/fstab: static file system information.
|
||||
#
|
||||
# Add in the swap unless it is disabled
|
||||
#
|
||||
if [ "${noswap}" ]; then
|
||||
:
|
||||
else
|
||||
cat <<E_O_FSTAB >> ${prefix}/etc/fstab
|
||||
/dev/${device}2 none swap sw 0 0
|
||||
# <file system> <mount point> <type> <options> <dump> <pass>
|
||||
proc /proc proc defaults 0 0
|
||||
E_O_FSTAB
|
||||
fi
|
||||
|
||||
for part in `seq 1 ${NUMPARTITIONS}`; do
|
||||
eval "PARTITION=\"\${PARTITION${part}}\""
|
||||
OLDIFS="${IFS}"
|
||||
IFS=:
|
||||
x=0
|
||||
for partdata in ${PARTITION}; do
|
||||
eval "partdata${x}=\"${partdata}\""
|
||||
x=$(( x+1 ))
|
||||
done
|
||||
IFS="${OLDIFS}"
|
||||
|
||||
case "${partdata2}" in
|
||||
xfs)
|
||||
has_xfs=1
|
||||
;;
|
||||
reiserfs)
|
||||
has_reiserfs=1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "${partdata2}" = "swap" ]; then
|
||||
echo "/dev/${device}${part} none swap sw 0 0" >> ${prefix}/etc/fstab
|
||||
else
|
||||
echo "/dev/${device}${part} ${partdata3} ${partdata2} ${partdata4} 0 1" >> ${prefix}/etc/fstab
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Finally we can install any required packages for the given root
|
||||
# filesystem
|
||||
#
|
||||
#case "${fs}" in
|
||||
# xfs)
|
||||
# install_package xfsprogs
|
||||
# ;;
|
||||
# reiserfs)
|
||||
# install_package reiserfsprogs
|
||||
# ;;
|
||||
#esac
|
||||
#if [ $has_xfs -eq 1 ]; then
|
||||
# installDebianPackage ${prefix} xfsprogs
|
||||
#fi
|
||||
#if [ $has_reiserfs -eq 1 ]; then
|
||||
# installDebianPackage ${prefix} reiserfsprogs
|
||||
#fi
|
||||
|
||||
|
||||
#
|
||||
|
||||
@@ -30,21 +30,6 @@ fi
|
||||
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, and reiserfs.
|
||||
#
|
||||
options="errors=remount-ro"
|
||||
|
||||
case "${fs}" in
|
||||
xfs)
|
||||
options="defaults"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
#
|
||||
# Make sure we use ide style device names if required
|
||||
#
|
||||
@@ -56,22 +41,52 @@ fi
|
||||
#
|
||||
# Now we have the options we can create the fstab.
|
||||
#
|
||||
has_xfs=0
|
||||
has_reiserfs=0
|
||||
cat <<E_O_FSTAB > ${prefix}/etc/fstab
|
||||
/dev/${device}1 / ${fs} ${options} 0 1
|
||||
proc /proc proc rw,nodev,nosuid,noexec 0 0
|
||||
# /etc/fstab: static file system information.
|
||||
#
|
||||
# <file system> <mount point> <type> <options> <dump> <pass>
|
||||
proc /proc proc defaults 0 0
|
||||
E_O_FSTAB
|
||||
for part in `seq 1 ${NUMPARTITIONS}`; do
|
||||
eval "PARTITION=\"\${PARTITION${part}}\""
|
||||
OLDIFS="${IFS}"
|
||||
IFS=:
|
||||
x=0
|
||||
for partdata in ${PARTITION}; do
|
||||
eval "partdata${x}=\"${partdata}\""
|
||||
x=$(( x+1 ))
|
||||
done
|
||||
IFS="${OLDIFS}"
|
||||
|
||||
case "${partdata2}" in
|
||||
xfs)
|
||||
has_xfs=1
|
||||
;;
|
||||
reiserfs)
|
||||
has_reiserfs=1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "${partdata2}" = "swap" ]; then
|
||||
echo "/dev/${device}${part} none swap sw 0 0" >> ${prefix}/etc/fstab
|
||||
else
|
||||
echo "/dev/${device}${part} ${partdata3} ${partdata2} ${partdata4} 0 1" >> ${prefix}/etc/fstab
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Add in the swap unless it is disabled
|
||||
# Finally we can install any required packages for the given root
|
||||
# filesystem
|
||||
#
|
||||
if [ "${noswap}" ]; then
|
||||
:
|
||||
else
|
||||
cat <<E_O_FSTAB >> ${prefix}/etc/fstab
|
||||
/dev/${device}2 none swap sw 0 0
|
||||
E_O_FSTAB
|
||||
fi
|
||||
#if [ $has_xfs -eq 1 ]; then
|
||||
# installDebianPackage ${prefix} xfsprogs
|
||||
#fi
|
||||
#if [ $has_reiserfs -eq 1 ]; then
|
||||
# installDebianPackage ${prefix} reiserfsprogs
|
||||
#fi
|
||||
|
||||
|
||||
#
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
# --
|
||||
# http://www.steve.org.uk
|
||||
#
|
||||
# $Id: xen-tools,v 1.49 2007-06-19 10:47:56 steve Exp $
|
||||
# $Id: xen-tools,v 1.50 2007-07-07 23:48:44 steve Exp $
|
||||
#
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ function _find_xen_images
|
||||
#
|
||||
_xen_create_image()
|
||||
{
|
||||
local cur prev ip roles dists vgs
|
||||
local cur prev ip roles partitions dists vgs
|
||||
|
||||
COMPREPLY=()
|
||||
cur=${COMP_WORDS[COMP_CWORD]}
|
||||
@@ -137,6 +137,11 @@ _xen_create_image()
|
||||
COMPREPLY=( $( compgen -W '${roles}' -- "${COMP_WORDS[COMP_CWORD]}" ) )
|
||||
return 0
|
||||
;;
|
||||
--partitions)
|
||||
partitions=$(for x in `ls -1 /etc/xen-tools/partitions.d/ 2>/dev/null | grep -v \/ 2>/dev/null`; do echo ${x} ; done )
|
||||
COMPREPLY=( $( compgen -W '${partitions}' -- "${COMP_WORDS[COMP_CWORD]}" ) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ ${cur} == -* ]]; then
|
||||
|
||||
45
partitions/sample-server
Normal file
45
partitions/sample-server
Normal file
@@ -0,0 +1,45 @@
|
||||
[root]
|
||||
size=1G
|
||||
type=ext3
|
||||
mountpoint=/
|
||||
options=sync,errors=remount-ro
|
||||
|
||||
[swap]
|
||||
size=2G
|
||||
type=swap
|
||||
|
||||
[home]
|
||||
size=1G
|
||||
type=xfs
|
||||
mountpoint=/home
|
||||
options=nodev,nosuid
|
||||
|
||||
[opt]
|
||||
size=1.5G
|
||||
type=xfs
|
||||
mountpoint=/opt
|
||||
options=nodev
|
||||
|
||||
[tmp]
|
||||
size=0.5G
|
||||
type=xfs
|
||||
mountpoint=/tmp
|
||||
options=nodev,nosuid
|
||||
|
||||
[usr]
|
||||
size=4G
|
||||
type=xfs
|
||||
mountpoint=/usr
|
||||
options=nodev
|
||||
|
||||
[var]
|
||||
size=4G
|
||||
type=xfs
|
||||
mountpoint=/var
|
||||
options=nodev,nosuid
|
||||
|
||||
[var-tmp]
|
||||
size=1.5G
|
||||
type=xfs
|
||||
mountpoint=/var/tmp
|
||||
options=nodev,nosuid
|
||||
@@ -14,6 +14,10 @@ BEGIN{ use_ok( 'Config' ); }
|
||||
require_ok( 'Config' );
|
||||
|
||||
|
||||
BEGIN{ use_ok( 'Config::IniFiles' ); }
|
||||
require_ok( 'Config::IniFiles' );
|
||||
|
||||
|
||||
BEGIN{ use_ok( 'Digest::MD5' ); }
|
||||
require_ok( 'Digest::MD5' );
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# Steve
|
||||
# --
|
||||
# $Id: xt-create-xen-config.t,v 1.4 2006-08-17 21:01:46 steve Exp $
|
||||
# $Id: xt-create-xen-config.t,v 1.5 2007-07-07 23:49:02 steve Exp $
|
||||
#
|
||||
|
||||
|
||||
@@ -128,8 +128,8 @@ sub runCreateCommand
|
||||
#
|
||||
# Create a temporary directory, and make sure it is present.
|
||||
#
|
||||
my $dir = File::Temp::tempdir( CLEANUP => 1 );
|
||||
ok ( -d $dir, "The temporary directory was created." );
|
||||
my $dir = File::Temp::tempdir( CLEANUP => 0 );
|
||||
ok ( -d $dir, "The temporary directory was created: $dir" );
|
||||
|
||||
#
|
||||
# Save the environment.
|
||||
|
||||
Reference in New Issue
Block a user