From 3d3d3e7e3e29baefb02f8e1070d1223270f4e4b4 Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Thu, 26 Feb 2004 16:38:22 +0000 Subject: support two-floppies boot style for replay_install disk as well (not nice at all..) --- perl-install/install_any.pm | 36 ++++++++++++++++++++++++++++++------ perl-install/standalone/drakautoinst | 17 +++++++++++++++++ 2 files changed, 47 insertions(+), 6 deletions(-) (limited to 'perl-install') diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index e2ba5eafd..1dcf554d9 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -712,17 +712,27 @@ sub g_auto_install { sub getAndSaveInstallFloppy { my ($o, $where) = @_; + my @generated_floppies; if ($postinstall_rpms && -d $postinstall_rpms && -r "$postinstall_rpms/auto_install.img") { log::l("getAndSaveInstallFloppy: using file saved as $postinstall_rpms/auto_install.img"); cp_af("$postinstall_rpms/auto_install.img", $where); + push @generated_floppies, $where; } else { my $image = cat_("/proc/cmdline") =~ /pcmcia/ ? "pcmcia" : arch() =~ /ia64|ppc/ ? "all" : #- we only use all.img there ${{ disk => 'hd_grub', cdrom => 'cdrom', ftp => 'network', nfs => 'network', http => 'network' }}{$o->{method}}; $image .= arch() =~ /sparc64/ && "64"; #- for sparc64 there are a specific set of image. + if ($image eq 'network') { + my $boot = $where; + $boot =~ s/(.*)\.img$/$1_boot.img/ or $boot .= '_boot.img'; + getAndSaveFile("images/$image.img", $boot) or log::l("failed to write Install Floppy ($image.img) to $boot"), return; + push @generated_floppies, $boot; + $image .= '_drivers'; + } getAndSaveFile("images/$image.img", $where) or log::l("failed to write Install Floppy ($image.img) to $where"), return; + push @generated_floppies, $where; } - 1; + return @generated_floppies; } sub getAndSaveAutoInstallFloppy { @@ -771,11 +781,15 @@ sub getAndSaveAutoInstallFloppy { my $param = 'kickstart=floppy ' . generate_automatic_stage1_params($o); - getAndSaveInstallFloppy($o, $imagefile) or return; + my @generated_floppies = getAndSaveInstallFloppy($o, $imagefile); + @generated_floppies or return; my $dev = devices::set_loop($imagefile) or log::l("couldn't set loopback device"), return; - eval { fs::mount($dev, $mountdir, 'vfat', 0); 1 } or return; - + foreach my $fs (qw(ext2 vfat)) { + eval { fs::mount($dev, $mountdir, $fs, 0); 1 } and goto mount_ok; + } + return; + mount_ok: substInFile { s/timeout.*/$replay ? 'timeout 1' : ''/e; s/^(\s*append)/$1 $param/ @@ -796,8 +810,18 @@ sub getAndSaveAutoInstallFloppy { rmdir $mountdir; devices::del_loop($dev); require commands; - commands::dd("if=$imagefile", "of=$where", "bs=1440", "count=1024"); - unlink $imagefile; + while (defined($imagefile = shift @generated_floppies)) { + commands::dd("if=$imagefile", "of=$where", "bs=1440", "count=1024"); + if (@generated_floppies) { + if ($where =~ m|^/dev|) { + $o->ask_warn('', N("Please insert another floppy for drivers disk"), 1); + } else { + $where =~ s/(.*)\.img/$1_drivers.img/; + } + } + unlink $imagefile; + common::sync(); + } } 1; } diff --git a/perl-install/standalone/drakautoinst b/perl-install/standalone/drakautoinst index 19c0cd880..4512571ca 100755 --- a/perl-install/standalone/drakautoinst +++ b/perl-install/standalone/drakautoinst @@ -34,6 +34,7 @@ my $direct = /-direct/; my $in = 'interactive'->vnew('su', 'default'); my $imagefile = "/root/drakx/replay_install.img"; +my $imagefile2 = "/root/drakx/replay_install_drivers.img"; -f $imagefile or $in->ask_warn(N("Error!"), N("I can't find needed image file `%s'.", $imagefile), 1), quit_global($in, 0); @@ -82,6 +83,22 @@ do { $again = $@; #- grrr... $@ is localized in code block :-( } while $again; fs::mount($dev, $mountdir, 'vfat', 0); + +if (-f $imagefile2) { + do { + eval { fs::umount($mountdir) }; + $in->ask_okcancel('', N("Insert another blank floppy in drive %s (for drivers disk)", $floppy), 1) or quit_global($in, 0); + log::explanations(N("Creating auto install floppy (drivers disk)")); + my $_w = $in->wait_message('', N("Creating auto install floppy")); + eval { + commands::dd("if=$imagefile2", "of=$dev", "bs=1440", "count=1024"); + common::sync(); + }; + $again = $@; #- grrr... $@ is localized in code block :-( + } while $again; + fs::mount($dev, $mountdir, 'ext2', 0); +} + my $cfgfile = "$mountdir/auto_inst.cfg"; eval(cat_($cfgfile)); my $o_old = $o; # BUG (maybe install's $::o ?) -- cgit v1.2.1