diff options
Diffstat (limited to 'tools/ddcprobe/vesamode.c')
0 files changed, 0 insertions, 0 deletions
![]() |
index : drakx | |
Mageia Installer and base platform for many utilities | Thierry Vignaud [tv] |
summaryrefslogtreecommitdiffstats |
package install_steps_interactive; # $Id$
use strict;
use vars qw(@ISA $new_bootstrap);
@ISA = qw(install_steps);
#-######################################################################################
#- misc imports
#-######################################################################################
use common;
use partition_table;
use fs::type;
use install_steps;
use install_interactive;
use install_any;
use install_messages;
use detect_devices;
use run_program;
use devices;
use fsedit;
use mouse;
use modules;
use modules::interactive;
use lang;
use keyboard;
use any;
use log;
#-######################################################################################
#- In/Out Steps Functions
#-######################################################################################
sub errorInStep {
my ($o, $err) = @_;
$o->ask_warn(N("Error"), [ N("An error occurred"), formatError($err) ]);
}
sub kill_action {
my ($o) = @_;
$o->kill;
}
#-######################################################################################
#- Steps Functions
#-######################################################################################
#------------------------------------------------------------------------------
sub selectLanguage {
my ($o) = @_;
any::selectLanguage_install($o, $o->{locale});
install_steps::selectLanguage($o);
if ($o->isa('interactive::gtk')) {
$o->ask_warn('', formatAlaTeX(
"If you see this message it is because you chose a language for
which DrakX does not include a translation yet; however the fact
that it is listed means there is some support for it anyway.
That is, once GNU/Linux will be installed, you will be able to at
least read and write in that language; and possibly more (various
fonts, spell checkers, various programs translated etc. that
varies from language to language).")) if $o->{locale}{lang} !~ /^en/ && !lang::load_mo();
} else {
#- no need to have this in po since it is never translated
$o->ask_warn('', "The characters of your language can not be displayed in console,
so the messages will be displayed in english during installation") if $ENV{LANGUAGE} eq 'C';
}
}
sub acceptLicense {
my ($o) = @_;
$o->{release_notes} = join("\n\n", map {
my $f = install_any::getFile($_);
$f && cat__($f);
} 'release-notes.txt', 'release-notes.' . arch() . '.txt');
return if $o->{useless_thing_accepted};
my $r = $::testing ? 'Accept' : 'Refuse';
$o->ask_from_({ title => N("License agreement"),
cancel => N("Quit"),
messages => formatAlaTeX(install_messages::main_license() . "\n\n\n" . install_messages::warning_about_patents()),
interactive_help_id => 'acceptLicense',
if_(!$::globetrotter, more_buttons => [ [ N("Release Notes"), sub { $o->ask_warn(N("Release Notes"), $o->{release_notes}) }, 1 ] ]),
callbacks => { ok_disabled => sub { $r eq 'Refuse' } },
},
[ { list => [ N_("Accept"), N_("Refuse") ], val => \$r, type => 'list', format => sub { translate($_[0]) } } ])
or do {
if ($::globetrotter) {
run_program::run('killall', 'Xorg');
exec("/sbin/reboot");
}
install_any::ejectCdrom();
$o->exit;
};
}
#------------------------------------------------------------------------------
sub selectKeyboard {
my ($o, $clicked) = @_;
my $from_usb = keyboard::from_usb();
my $l = keyboard::lang2keyboards(lang::langs($o->{locale}{langs}));
if ($::expert || $clicked || !($from_usb || @$l && $l->[0][1] >= 90) || listlength(lang::langs($o->{locale}{langs})) > 1) {
add2hash($o->{keyboard}, $from_usb);
my @best = uniq($from_usb ? $from_usb->{KEYBOARD} : (), map { $_->[0] } @$l);
my $format = sub { translate(keyboard::KEYBOARD2text($_[0])) };
my $other;
my $ext_keyboard = my $KEYBOARD = $o->{keyboard}{KEYBOARD};
$o->ask_from_(
{ title => N("Keyboard"),
messages => N("Please choose your keyboard layout."),
interactive_help_id => 'selectKeyboard',
advanced_messages => N("Here is the full list of available keyboards"),
advanced_label => N("More"),
callbacks => { changed => sub { $other = $_[0] == 1 } },
},
[ if_(@best > 1, { val => \$KEYBOARD, type => 'list', format => $format, sort => 1,
list => [ @best ] }),
{ val => \$ext_keyboard, type => 'list', format => $format,
list => [ difference2([ keyboard::KEYBOARDs() ], \@best) ], advanced => @best > 1 }
]);
$o->{keyboard}{KEYBOARD} = @best <= 1 || $other ? $ext_keyboard : $KEYBOARD;
delete $o->{keyboard}{unsafe};
}
keyboard::group_toggle_choose($o, $o->{keyboard}) or goto &selectKeyboard;
install_steps::selectKeyboard($o);
}
#------------------------------------------------------------------------------
sub selectInstallClass {
my ($o) = @_;
if (my @l = install_any::find_root_parts($o->{fstab}, $o->{prefix})) {
log::l("proposing to upgrade partitions " . join(" ", map { $_->{part} && $_->{part}{device} } @l));
my @releases = uniq(map { $_->{release} } @l);
if (@releases != @l) {
#- same release name so adding the device to differentiate them:
$_->{release} .= " ($_->{part}{device})" foreach @l;
}
my $p;
$o->ask_from_({ title => N("Install/Upgrade"),
messages => N("Is this an install or an upgrade?"),
interactive_help_id => 'selectInstallClass',
},
[ { val => \$p,
list => [ @l, N_("Install") ],
type => 'list',
format => sub { ref($_[0]) ? N("Upgrade %s", $_[0]{release}) : translate($_[0]) }
} ]);
if (ref $p) {
if ($p->{part}) {
log::l("choosing to upgrade partition $p->{part}{device}");
$o->{migrate_device_names} = install_any::use_root_part($o->{all_hds}, $p->{part}, $o);
}
foreach (grep { $_->{mntpoint} } @{$o->{fstab}}) {
my ($options, $_unknown) = fs::mount_options::unpack($_);
$options->{encrypted} or next;
$o->ask_from_({ focus_first => 1 },
[ { label => N("Encryption key for %s", $_->{mntpoint}),
hidden => 1, val => \$_->{encrypt_key} } ]);
}
$o->{isUpgrade} = $p->{release_file} =~ /redhat/ ? 'redhat' : 'mandrake';
}
}
}
#------------------------------------------------------------------------------
sub selectMouse {
my ($o, $force) = @_;
$force ||= $o->{mouse}{unsafe};
if ($force) {
my $prev = $o->{mouse}{type} . '|' . $o->{mouse}{name};
$o->ask_from_({ messages => N("Please choose your type of mouse."),
interactive_help_id => 'selectMouse',
},
[ { list => [ mouse::fullnames() ], separator => '|', val => \$prev, format => sub { join('|', map { translate($_) } split('\|', $_[0])) } } ]);
$o->{mouse} = mouse::fullname2mouse($prev);
}
if ($force && $o->{mouse}{type} eq 'serial') {
$o->{mouse}{device} =
$o->ask_from_listf_raw({ title => N("Mouse Port"),
messages => N("Please choose which serial port your mouse is connected to."),
interactive_help_id => 'selectSerialPort',
},
\&mouse::serial_port2text,
[ mouse::serial_ports() ]) or return &selectMouse;
}
if (arch() =~ /ppc/ && $o->{mouse}{nbuttons} == 1) {
#- set a sane default F11/F12
$o->{mouse}{button2_key} = 87;
$o->{mouse}{button3_key} = 88;
$o->ask_from('', N("Buttons emulation"),
[
{ label => N("Button 2 Emulation"), val => \$o->{mouse}{button2_key}, list => [ mouse::ppc_one_button_keys() ], format => \&mouse::ppc_one_button_key2text },
{ label => N("Button 3 Emulation"), val => \$o->{mouse}{button3_key}, list => [ mouse::ppc_one_button_keys() ], format => \&mouse::ppc_one_button_key2text },
]) or return;
}
if ($o->{mouse}{device} eq "usbmouse") {
modules::interactive::load_category($o, $o->{modules_conf}, 'bus/usb', 1, 1);
eval {
devices::make("usbmouse");
modules::load(qw(hid mousedev usbmouse));
};
}
$o->SUPER::selectMouse;
1;
}
#------------------------------------------------------------------------------
sub setupSCSI {
my ($o) = @_;
if (!$::noauto && arch() =~ /i.86/) {
if ($o->{pcmcia} ||= detect_devices::real_pcmcia_probe()) {
my $w = $o->wait_message(N("PCMCIA"), N("Configuring PCMCIA cards..."));
my $results = install_any::configure_pcmcia($o->{modules_conf}, $o->{pcmcia});
undef $w;
$results and $o->ask_warn('', $results);
}
}
{
my $_w = $o->wait_message(N("IDE"), N("Configuring IDE"));
modules::load(modules::category2modules('disk/cdrom'));
}
modules::interactive::load_category($o, $o->{modules_conf}, 'bus/firewire', 1);
my $have_non_scsi = detect_devices::hds(); #- at_least_one scsi device if we have no disks
modules::interactive::load_category($o, $o->{modules_conf}, 'disk/ide|scsi|hardware_raid|sata|firewire', 1, !$have_non_scsi);
modules::interactive::load_category($o, $o->{modules_conf}, 'disk/ide|scsi|hardware_raid|sata|firewire') if !detect_devices::hds(); #- we really want a disk!
install_interactive::tellAboutProprietaryModules($o);
install_any::getHds($o, $o);
}
sub ask_mntpoint_s { #- }{}
my ($o, $fstab) = @_;
my @fstab = grep { isTrueFS($_) } @$fstab;
@fstab = grep { isSwap($_) } @$fstab if @fstab == 0;
@fstab = @$fstab if @fstab == 0;
die N("No partition available") if @fstab == 0;
{
my $_w = $o->wait_message('', N("Scanning partitions to find mount points"));
install_any::suggest_mount_points($fstab, $o->{prefix}, 'uniq');
log::l("default mntpoint $_->{mntpoint} $_->{device}") foreach @fstab;
}
if (@fstab == 1) {
$fstab[0]{mntpoint} = '/';
} else {
$o->ask_from_({ messages => N("Choose the mount points"),
interactive_help_id => 'ask_mntpoint_s',
callbacks => {
complete => sub {
require diskdrake::interactive;
eval { 1, find_index {
!diskdrake::interactive::check_mntpoint($o, $_->{mntpoint}, $_, $o->{all_hds});
} @fstab };
},
},
},
[ map {
{
label => partition_table::description($_),
val => \$_->{mntpoint},
not_edit => 0,
list => [ '', fsedit::suggestions_mntpoint(fs::get::empty_all_hds()) ],
};
} @fstab ]) or return;
}
$o->SUPER::ask_mntpoint_s($fstab);
}
#------------------------------------------------------------------------------
sub doPartitionDisks {
my ($o) = @_;
if (arch() =~ /ppc/) {
my $generation = detect_devices::get_mac_generation();
if ($generation =~ /NewWorld/) {
#- mac partition table
if (defined $partition_table::mac::bootstrap_part) {
#- do not do anything if we've got the bootstrap setup
#- otherwise, go ahead and create one somewhere in the drive free space
} else {
my $freepart = $partition_table::mac::freepart;
if ($freepart && $freepart->{size} >= 1) {
log::l("creating bootstrap partition on drive /dev/$freepart->{hd}{device}, block $freepart->{start}");
$partition_table::mac::bootstrap_part = $freepart->{part};
log::l("bootstrap now at $partition_table::mac::bootstrap_part");
my $p = { start => $freepart->{start}, size => 1 << 11, mntpoint => '' };
fs::type::set_pt_type($p, 0x401);
fsedit::add($freepart->{hd}, $p, $o->{all_hds}, { force => 1, primaryOrExtended => 'Primary' });
$new_bootstrap = 1;
} else {
$o->ask_warn('', N("No free space for 1MB bootstrap! Install will continue, but to boot your system, you'll need to create the bootstrap partition in DiskDrake"));
}
}
} elsif ($generation =~ /IBM/) {
#- dos partition table
$o->ask_warn('', N("You'll need to create a PPC PReP Boot bootstrap! Install will continue, but to boot your system, you'll need to create the bootstrap partition in DiskDrake"));
}
}
if (!$o->{isUpgrade}) {
install_interactive::partitionWizard($o);
}
}
#------------------------------------------------------------------------------
sub rebootNeeded {
my ($o) = @_;
$o->ask_warn('', N("You need to reboot for the partition table modifications to take place"));
install_steps::rebootNeeded($o);
}
#------------------------------------------------------------------------------
sub choosePartitionsToFormat {
my ($o, $fstab) = @_;
$o->SUPER::choosePartitionsToFormat($fstab);
my @l = grep { !$_->{isMounted} && $_->{mntpoint} &&
(!isSwap($_) || $::expert) &&
(!isFat_or_NTFS($_) || $_->{notFormatted} || $::expert) &&
(!isOtherAvailableFS($_) || $::expert || $_->{toFormat});
} @$fstab;
$_->{toFormat} = 1 foreach grep { isSwap($_) && !$::expert } @$fstab;
return if @l == 0 || !$::expert && every { $_->{toFormat} } @l;
#- keep it temporary until the guy has accepted
$_->{toFormatTmp} = $_->{toFormat} || $_->{toFormatUnsure} foreach @l;
$o->ask_from_(
{ messages => N("Choose the partitions you want to format"),
interactive_help_id => 'formatPartitions',
advanced_messages => N("Check bad blocks?"),
},
[ map {
my $e = $_;
({
text => partition_table::description($e), type => 'bool',
val => \$e->{toFormatTmp}
}, if_(!isLoopback($_) && !member($_->{fs_type}, 'reiserfs', 'xfs', 'jfs'), {
text => partition_table::description($e), type => 'bool', advanced => 1,
disabled => sub { !$e->{toFormatTmp} },
val => \$e->{toFormatCheck}
})) } @l ]
) or die 'already displayed';
#- ok now we can really set toFormat
foreach (@l) {
$_->{toFormat} = delete $_->{toFormatTmp};
set_isFormatted($_, 0);
}
}
sub formatMountPartitions {
my ($o, $_fstab) = @_;
my ($w, $wait_message) = fs::format::wait_message($o);
catch_cdie {
fs::format::formatMount_all($o->{all_hds}, $o->{fstab}, $wait_message);
} sub {
$@ =~ /fsck failed on (\S+)/ or return;