2006-05-23 12:26:13 by steve
Updated hooks to work with rpmstrap.
This commit is contained in:
@@ -9,6 +9,17 @@
|
||||
|
||||
prefix=$1
|
||||
|
||||
|
||||
#
|
||||
# If we're installing a distribution with rpmstrap then don't
|
||||
# touch /etc/apt/sources.list
|
||||
#
|
||||
if [ "${rpmstrap}" ]; then
|
||||
echo "APT not available for non-Debian distribution ${dist}"
|
||||
exit;
|
||||
fi
|
||||
|
||||
|
||||
cat <<E_O_APT > ${prefix}/etc/apt/sources.list
|
||||
#
|
||||
# /etc/apt/sources.list
|
||||
|
||||
@@ -10,6 +10,17 @@
|
||||
|
||||
prefix=$1
|
||||
|
||||
|
||||
if [[ "${rpmstrap}" ]]; then
|
||||
echo "TODO : Sort out networking for non-Debian distribution ${dist}."
|
||||
exit;
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# OK now we're in Debian-only land.
|
||||
#
|
||||
|
||||
if [[ -z "${dhcp}" ]]; then
|
||||
|
||||
#
|
||||
|
||||
@@ -19,4 +19,10 @@ cd ${prefix}/dev
|
||||
#
|
||||
# Make the devices.
|
||||
#
|
||||
./MAKEDEV generic
|
||||
if [ "${rpmstrap}" ]; then
|
||||
./MAKEDEV console
|
||||
./MAKEDEV null
|
||||
./MAKEDEV zero
|
||||
else
|
||||
./MAKEDEV generic
|
||||
fi
|
||||
@@ -37,7 +37,7 @@ my @files = ( "/etc/hosts",
|
||||
"/etc/gshadow",
|
||||
"/etc/group"
|
||||
);
|
||||
|
||||
|
||||
foreach my $file ( @files )
|
||||
{
|
||||
File::Copy::copy( $file, $prefix . "/etc/" );
|
||||
@@ -47,7 +47,7 @@ foreach my $file ( @files )
|
||||
#
|
||||
# Only copy the /etc/shadow file if --passwd is *not* specified.
|
||||
#
|
||||
if ( !$ENV{'passwd'} )
|
||||
if ( !$ENV{'passwd'} )
|
||||
{
|
||||
File::Copy::copy( "/etc/shadow", $prefix . "/etc/" );
|
||||
}
|
||||
@@ -74,11 +74,11 @@ if ( ( -e "/etc/sudoers" ) && ( -x $prefix . "/usr/bin/apt-get" ) )
|
||||
#
|
||||
if ( ! $ENV{'passwd'} )
|
||||
{
|
||||
open( ORIG, "<", "/etc/passwd" )
|
||||
open( ORIG, "<", "/etc/passwd" )
|
||||
or die "Failed to open /etc/passwd - $!";
|
||||
open( NEW, ">>", $prefix . "/etc/passwd" )
|
||||
open( NEW, ">>", $prefix . "/etc/passwd" )
|
||||
or die "Failed to open $prefix/etc/passwd - $!";
|
||||
|
||||
|
||||
foreach my $line ( <ORIG> )
|
||||
{
|
||||
chomp( $line );
|
||||
@@ -87,7 +87,7 @@ if ( ! $ENV{'passwd'} )
|
||||
my $user = $1;
|
||||
my $pass = $2;
|
||||
my $uid = $3;
|
||||
|
||||
|
||||
if ( ( $uid >= 1000 ) &&
|
||||
( $user ne "nobody" ) )
|
||||
{
|
||||
|
||||
@@ -8,10 +8,14 @@
|
||||
prefix=$1
|
||||
|
||||
if [ -d /etc/xen-tools/skel ]; then
|
||||
|
||||
#
|
||||
# Copy everything from skel directory, even "dotfiles".
|
||||
#
|
||||
(cd /etc/xen-tools/skel; tar -cf - . ) | (cd ${prefix}/; tar -xpf -)
|
||||
|
||||
else
|
||||
|
||||
echo "skel directory not present, ignoring."
|
||||
|
||||
fi
|
||||
|
||||
@@ -11,6 +11,11 @@
|
||||
|
||||
prefix=$1
|
||||
|
||||
if [ "${rpmstrap}" ]; then
|
||||
echo "ssh installation for non-Debian distribution ${dist} is not available."
|
||||
exit;
|
||||
fi
|
||||
|
||||
#
|
||||
# This function installs a package upon the guest image.
|
||||
#
|
||||
|
||||
@@ -25,6 +25,9 @@ mkdir -p ${prefix}/lib/modules
|
||||
cp -R /lib/modules/*/ ${prefix}/lib/modules
|
||||
|
||||
#
|
||||
# Now install the 'module-init-tools'.
|
||||
# Now install the 'module-init-tools', unless running under rpmstrap.
|
||||
#
|
||||
DEBIAN_FRONTEND=noninteractive chroot ${prefix} /usr/bin/apt-get --yes --force-yes install module-init-tools
|
||||
if [ -z "${rpmstrap}" ]; then
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive chroot ${prefix} /usr/bin/apt-get --yes --force-yes install module-init-tools
|
||||
fi
|
||||
@@ -22,8 +22,12 @@ function install_package
|
||||
{
|
||||
package=$1
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive chroot ${prefix} /usr/bin/apt-get --yes --force-yes install $package
|
||||
|
||||
#
|
||||
# Only install the package if we're not running under rpmstrap
|
||||
#
|
||||
if [ -z "${rpmstrap}" ]; then
|
||||
DEBIAN_FRONTEND=noninteractive chroot ${prefix} /usr/bin/apt-get --yes --force-yes install $package
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,5 +9,12 @@
|
||||
|
||||
prefix=$1
|
||||
|
||||
chroot ${prefix} /usr/bin/apt-get clean
|
||||
|
||||
#
|
||||
# Don't run apt-get if we're running under rpmstrap.
|
||||
#
|
||||
if [ -z "${rpmstrap}" ]; then
|
||||
|
||||
chroot ${prefix} /usr/bin/apt-get clean
|
||||
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user