|
From: <ar...@sy...> - 2008-02-23 22:34:39
|
Author: arighi
Date: 2008-02-23 16:34:31 -0600 (Sat, 23 Feb 2008)
New Revision: 4397
Modified:
trunk/etc/autoinstallscript.template
trunk/lib/SystemImager/Server.pm
Log:
- fix: set correct disk names for systemconfigurator
The disk names in /etc/systemconfig/systemconfig.conf are changed in disk edits
procedure (in the same way as /etc/fstab, /boot/grub/device.map, etc.), but
this file is re-generated later, so the first change is lost.
To fix move the disk edit just before the systemconfigurator execution, after
the systemconfig.conf generation.
Modified: trunk/etc/autoinstallscript.template
===================================================================
--- trunk/etc/autoinstallscript.template 2008-02-23 22:16:56 UTC (rev 4396)
+++ trunk/etc/autoinstallscript.template 2008-02-23 22:34:31 UTC (rev 4397)
@@ -389,31 +389,6 @@
beep
-#
-################################################################################
-
-################################################################################
-# BEGIN disk edits
-#
-[ -z $DISKORDER ] || {
- echo "Editing files for actual disk configuration..."
-##SHOW_DISK_EDITS##
- for file in /etc/fstab /etc/systemconfig/systemconfig.conf /boot/grub/menu.lst /etc/lilo.conf /etc/grub.conf /boot/grub/device.map; do
- [ -f /a/$file ] || continue
- echo " $file"
- cp /a/$file /a/$file.image
- cat /a/$file.image |
-##EDIT_DISK_NAMES##
- cat > /a/$file
- done
- echo
- beep
-}
-#
-# END disk edits
-################################################################################
-
-
##################################################################
#
# Uncomment the line below to leave your hostname blank.
@@ -481,13 +456,36 @@
fi
done
+##SYSTEMCONFIGURATOR_PRE##
+
+################################################################################
+# BEGIN disk edits
+#
+[ -z $DISKORDER ] || {
+ echo "Editing files for actual disk configuration..."
+##SHOW_DISK_EDITS##
+ for file in /etc/fstab /etc/systemconfig/systemconfig.conf /boot/grub/menu.lst /etc/lilo.conf /etc/grub.conf /boot/grub/device.map; do
+ [ -f /a/$file ] || continue
+ echo " $file"
+ cp /a/$file /a/$file.image
+##EDIT_DISK_NAMES##
+ done
+ echo
+ beep
+}
+#
+# END disk edits
+################################################################################
+
export PATH=/usr/local/sbin:/usr/local/bin:$PATH
logmsg "Detecting systemconfigurator:"
logmsg "---"
chroot /a/ systemconfigurator --version || \
logmsg "WARNING: systemconfigurator was not found in the image $IMAGENAME"
logmsg "---"
-##SYSTEMCONFIGURATOR##
+
+##SYSTEMCONFIGURATOR_POST##
+
#
################################################################################
Modified: trunk/lib/SystemImager/Server.pm
===================================================================
--- trunk/lib/SystemImager/Server.pm 2008-02-23 22:16:56 UTC (rev 4396)
+++ trunk/lib/SystemImager/Server.pm 2008-02-23 22:34:31 UTC (rev 4397)
@@ -1789,11 +1789,8 @@
sub edit_disk_names{
my ($out) = shift;
foreach (reverse sort keys %dev2disk) {
- print $out qq( sed s:$_:%$dev2disk{$_}%:g |\n);
+ print $out qq( sed -i s:$_:\$$dev2disk{$_}:g /a/\$file\n);
}
- for (my $i = 0; $i < scalar keys %dev2disk; $i++) {
- print $out qq( sed s:%DISK$i%:\$DISK$i:g |\n);
- }
}
# Prep the client for kexec
@@ -1809,7 +1806,7 @@
print $out "kexec_initrd=`basename \$kexec_initrd`\n";
}
-sub write_sc_command {
+sub write_sc_command_pre {
my ( $out, $ip_assignment_method ) = @_;
# Fix device names in systemconfigurator config.
@@ -1820,8 +1817,8 @@
$bootdev = $rootdev;
}
my $bootdev_disk = $bootdev;
- if ($bootdev_disk =~ /^\/dev\/([hs]|ps3)d/) {
- # Standard disk naming (hd*, sd*, ps3d*).
+ if ($bootdev_disk =~ /^\/dev\/([hs]|ps3|xv)d/) {
+ # Standard disk naming (hd*, sd*, xvd*, ps3d*).
$bootdev_disk =~ s/[0-9]+$//;
} elsif ($bootdev_disk =~ /^UUID|^LABEL/) {
# XXX: Boot device in UUID or LABEL form: do nothing,
@@ -1836,11 +1833,15 @@
print $out " sed -i \"s:DEFAULTBOOT = systemimager:DEFAULTBOOT = \$IMAGENAME:g\" $sc_conf_file\n";
print $out " sed -i \"s:LABEL = systemimager:LABEL = \$IMAGENAME:g\" $sc_conf_file\n";
print $out "fi\n";
+}
+sub write_sc_command_post {
+ my ( $out, $ip_assignment_method ) = @_;
+
# Configure the network device used to contact the image-server -AR-
print $out "\n# Configure the network interface used during the auto-installation.\n";
print $out "[ -z \$DEVICE ] && DEVICE=eth0\n";
-
+
my $sc_excludes_to = "/etc/systemimager/systemconfig.local.exclude";
my $sc_cmd = "chroot /a/ systemconfigurator --verbose --excludesto=$sc_excludes_to";
my $sc_options = '';
@@ -1849,8 +1850,7 @@
$sc_options = " --runboot";
$sc_ps3_options = '';
} else {
- ## FIXME - is --excludesto only for the static method?
- ## currently,
+ ## FIXME - is --excludesto only for the static method?
$sc_options = '--confighw --confignet --configboot --runboot';
# PS3 doesn't need hardware and boot-loader configuration.
$sc_ps3_options = '--confignet';
@@ -1891,6 +1891,8 @@
}
+
+
sub create_autoinstall_script{
my (
@@ -2035,11 +2037,16 @@
last SWITCH;
}
- if (/^\s*${delim}SYSTEMCONFIGURATOR${delim}\s*$/) {
- write_sc_command($MASTER_SCRIPT, $ip_assignment_method);
+ if (/^\s*${delim}SYSTEMCONFIGURATOR_PRE${delim}\s*$/) {
+ write_sc_command_pre($MASTER_SCRIPT, $ip_assignment_method);
last SWITCH;
}
+ if (/^\s*${delim}SYSTEMCONFIGURATOR_POST${delim}\s*$/) {
+ write_sc_command_post($MASTER_SCRIPT, $ip_assignment_method);
+ last SWITCH;
+ }
+
if (/^\s*${delim}UMOUNT_FILESYSTEMS${delim}\s*$/) {
_write_out_umount_commands( $MASTER_SCRIPT,
$image_dir,
|