summaryrefslogtreecommitdiffstats
path: root/globetrotter
Commit message (Expand)AuthorAgeFilesLines
* re-sync after the big svn lossPascal Rigaux2007-04-251-2/+2
* adapt to DOCS -> CAT_MINIMAL_DOCS switchPascal Rigaux2006-03-091-1/+1
* typo fixThierry Vignaud2005-11-211-1/+1
* (init) hotplug is obsoleted by udevThierry Vignaud2005-09-261-2/+0
* try to cleanup fs.pmPascal Rigaux2005-06-281-5/+5
* recreate existing user accounts on restoringThierry Vignaud2005-06-261-0/+11
* switch from GRUB to LILO since the later now enable to boot from USBThierry Vignaud2005-06-201-10/+7
* rollbackThierry Vignaud2005-06-201-9/+11
* switch from GRUB to LILO since the later now enable to boot from USBThierry Vignaud2005-06-201-11/+9
* rollbackThierry Vignaud2005-06-201-34/+24
* switch from GRUB to LILO since the later now enable to boot from USBThierry Vignaud2005-06-201-24/+34
* patch is needed for dkms-atiThierry Vignaud2005-06-171-1/+1
* fix end message (do not speak about restoration when installing)Thierry Vignaud2005-06-161-1/+1
* fix mounting /procThierry Vignaud2005-06-161-1/+2
* (install2::configMove) fix infinite loop while adding usersThierry Vignaud2005-06-161-1/+1
* bump copyright + s/Mandrakesoft/Mandriva/Thierry Vignaud2005-06-091-1/+1
* *** empty log message ***Thierry Vignaud2005-06-091-1/+158
* (changelog) only track HEAD changesThierry Vignaud2005-06-091-1/+1
* - sync with DrakX's APIThierry Vignaud2005-06-091-38/+65
* (installPackages) help packages' post-install scriptsThierry Vignaud2005-06-091-0/+3
* (installPackages) help DrakX moreThierry Vignaud2005-06-091-2/+2
* detect both old and new LaCie modelsThierry Vignaud2005-06-091-1/+1
* prevent building a disk w/o translation catalogsThierry Vignaud2005-06-091-0/+4
* prevent warning message about /proc to appear at bootThierry Vignaud2005-06-091-1/+3
* - urpmi syntax had changedThierry Vignaud2005-06-091-2/+1
* devfs is deadThierry Vignaud2005-06-091-3/+1
* save X.org conf too on profile switchThierry Vignaud2005-06-091-1/+1
* set $::build_globetrotterThierry Vignaud2005-06-091-0/+1
* (install2::configMove) prevent dm service to fail to startup becauseThierry Vignaud2005-06-091-0/+2
* (install2::configMove) workaround init reading inittab before any.pm alters itThierry Vignaud2005-06-091-1/+5
* sync with drakx's APIThierry Vignaud2005-06-091-3/+3
* (automatic_xconf) class_discard is needed way earlierThierry Vignaud2005-06-091-1/+1
* (install2::configMove) fix killing X11 due to XFree86 -> X.org switchThierry Vignaud2005-06-091-1/+1
* (install2::configMove) if formatError() returns nothing, better display the r...Thierry Vignaud2005-06-091-1/+1
* fix buildThierry Vignaud2005-06-091-2/+2
* blacklist more pakcagesThierry Vignaud2005-06-091-1/+5
* fix commentThierry Vignaud2005-06-091-1/+1
* fix netprofile stuffOlivier Blin2005-06-021-7/+5
* fix broken hdThierry Vignaud2005-05-251-0/+127
* unmount partitions even when failledThierry Vignaud2005-05-251-4/+22
* display message earlierThierry Vignaud2005-05-251-1/+1
* on restoration, tell which one is the packages partition when foundThierry Vignaud2005-05-251-0/+1
* nicely tell that the restoration is completedThierry Vignaud2005-05-251-0/+2
* use newly introduced my_exit() in order to display better messagesThierry Vignaud2005-05-251-3/+5
* (my_exit) introduce it for smoother messagesThierry Vignaud2005-05-251-0/+10
* handle smoothly packages partition with multiple kernel packagesThierry Vignaud2005-05-251-2/+2
* fix fs checking prior to restoration, thus handling restoration onThierry Vignaud2005-05-251-0/+5
* when we format the root fs prior to restoring the hd, set back theThierry Vignaud2005-05-251-1/+1
* factorize some code through find_partition()Thierry Vignaud2005-05-251-2/+7
* do not try to run killall until it has been installedThierry Vignaud2004-10-261-1/+1
= "$::prefix/lib/hotplug/firmware"; my %network_settings = ( rtc => [ { matching => qr/^Hcf:/, description => 'HCF 56k Modem', url => 'http://www.linuxant.com/drivers/hcf/', name => 'hcfpcimodem', kernel_module => 1, tools => { test_file => '/usr/sbin/hcfpciconfig', }, device => '/dev/ttySHSF0', post => '/usr/sbin/hcfpciconfig --auto', }, { matching => qr/^Hsf:/, description => 'HSF 56k Modem', url => 'http://www.linuxant.com/drivers/hsf/', name => 'hsflinmodem', kernel_module => 1, tools => { test_file => '/usr/sbin/hsfconfig', }, device => '/dev/ttySHSF0', post => '/usr/sbin/hsfconfig --auto', }, { matching => qr/^LT:/, description => 'LT WinModem', url => 'http://www.heby.de/ltmodem/', name => 'ltmodem', kernel_module => 1, tools => { test_file => '/etc/devfs/conf.d/ltmodem.conf', }, device => '/dev/ttyS14', links => [ 'http://linmodems.technion.ac.il/Ltmodem.html', 'http://linmodems.technion.ac.il/packages/ltmodem/', ], }, { matching => [ list_modules::category2modules('network/slmodem') ], description => 'Smartlink WinModem', url => 'http://www.smlink.com/content.aspx?id=135/', name => 'slmodem', kernel_module => 1, tools => { test_file => '/usr/sbin/slmodemd', }, device => '/dev/ttySL0', restart_service => 1, }, ], wireless => [ { matching => 'zd1201', description => 'ZyDAS ZD1201', url => 'http://linux-lc100020.sourceforge.net/', firmware => { test_file => 'zd1201*.fw', }, }, (map { ( "ipw${_}" => { matching => "ipw${_}", description => "Intel® PRO/Wireless ${_}", url => "http://ipw${_}.sourceforge.net/", name => "ipw${_}", firmware => { test_file => ($_ == 2100 ? "ipw2100-*.fw" : "ipw-*.fw"), }, }, ); } (2100, 2200)), { matching => 'prism54', description => 'Prism GT / Prism Duette / Prism Indigo Chipsets', url => 'http://prism54.org/', name => 'prism54', firmware => { url => 'http://prism54.org/~mcgrof/firmware/', test_file => "isl38*", }, }, { matching => qr/^at76c50/, description => 'Atmel at76c50x cards', url => 'http://thekelleys.org.uk/atmel/', name => 'atmel', firmware => { test_file => 'atmel_at76c50*', }, links => 'http://at76c503a.berlios.de/', }, ], dsl => [ { matching => sub { detect_devices::getSpeedtouch() }, description => N_("Alcatel speedtouch USB modem"), url => "http://www.speedtouch.com/supuser.htm", name => 'speedtouch', tools => { test_file => '/usr/sbin/modem_run', }, firmware => { package => 'speedtouch_mgmt', prefix => '/usr/share/speedtouch', test_file => 'mgmt*.o', explanations => N_("Copy the Alcatel microcode as mgmt.o in /usr/share/speedtouch/"), user_install => \&install_speedtouch_microcode, }, links => 'http://linux-usb.sourceforge.net/SpeedTouch/mandrake/index.html', }, { matching => 'eciadsl', url => 'http://eciadsl.flashtux.org/', name => 'eciadsl', tools => 1, }, { matching => 'eagle-usb', description => 'Eagle chipset (from Analog Devices), e.g. Sagem F@st 800/840/908', url => 'http://www.eagle-usb.org/', name => 'eagle-usb', tools => { test_file => '/sbin/eaglectrl', }, }, { matching => 'bewan', description => 'Bewan Adsl (Unicorn)', url => 'http://www.bewan.com/bewan/users/downloads/', name => 'unicorn', kernel_module => 1, tools => 1, }, ], ); sub device_get_package { my ($settings, $option, $o_default) = @_; $settings->{$option} or return; my $package; if (ref $settings->{$option} eq 'HASH') { $package = $settings->{$option}{package} || 1; } else { $package = $settings->{$option}; } $package == 1 ? $o_default || $settings->{name} : $package; } sub device_get_option { my ($settings, $option) = @_; $settings->{$option} or return; my $value = $settings->{$option}; $value == 1 ? $settings->{name} : $value; } sub find_settings { my ($category, $driver) = @_; find { my $type = ref $_->{matching}; $type eq 'Regexp' && $driver =~ $_->{matching} || $type eq 'CODE' && $_->{matching}->($driver) || $type eq 'ARRAY' && member($driver, @{$_->{matching}}) || $driver eq $_->{matching}; } @{$network_settings{$category}}; } sub warn_not_installed { my ($in, @packages) = @_; $in->ask_warn(N("Error"), N("Could not install the packages (%s)!", @packages)); } sub warn_not_found { my ($in, $settings, $option, @packages) = @_; my ($url, $expl); if (ref $settings->{$option}) { $url = $settings->{$option}{url}; $expl = $settings->{$option}{explanations}; } $url ||= $settings->{url}; $in->ask_warn(N("Error"), N("Some packages (%s) are required but aren't available. They can be found in Mandriva Club or in Mandriva commercial releases.", @packages) . if_($url, "\n\n" . N("The required files can also be installed from this URL: %s", $url)) . if_($expl, "\n\n" . translate($expl))); } sub is_file_installed { my ($settings, $option) = @_; my $file = exists $settings->{$option} && $settings->{$option}{test_file}; $file && -e "$::prefix$file"; } sub is_module_installed { my ($driver) = @_; find { m!/\Q$driver\E\.k?o! } cat_("$::prefix/lib/modules/" . c::kernel_version() . '/modules.dep'); } sub is_firmware_installed { my ($settings) = @_; my $wildcard = exists $settings->{firmware} && $settings->{firmware}{test_file} or return; my $path = $settings->{firmware}{prefix} || $hotplug_firmware_prefix; scalar glob_("$::prefix$path/$wildcard"); } sub find_file_on_windows_system { my ($in, $file) = @_; my $source; require fsedit; my $all_hds = fsedit::get_hds(); fs::get_info_from_fstab($all_hds); if (my $part = find { $_->{device_windobe} eq 'C' } fs::get::fstab($all_hds)) { foreach (qw(windows/system winnt/system windows/system32/drivers winnt/system32/drivers)) { -d $_ and $source = first(glob_("$part->{mntpoint}/$_/$file")) and last; } $source or $in->ask_warn(N("Error"), N("Unable to find \"%s\" on your Windows system!", $file)); } else { $in->ask_warn(N("Error"), N("No Windows system has been detected!")); } { file => $source }; } sub find_file_on_floppy { my ($in, $file) = @_; my $floppy = detect_devices::floppy(); my $mountpoint = '/mnt/floppy'; my $h; $in->ask_okcancel(N("Insert floppy"), N("Insert a FAT formatted floppy in drive %s with %s in root directory and press %s", $floppy, $file, N("Next"))) or return; if (eval { fs::mount(devices::make($floppy), $mountpoint, 'vfat', 'readonly'); 1 }) { log::explanations("Mounting floppy device $floppy in $mountpoint"); $h = before_leaving { fs::umount($mountpoint) }; if ($h->{file} = first(glob("$mountpoint/$file"))) { log::explanations("Found $h->{file} on floppy device"); } else { log::explanations("Unabled to find $file on floppy device"); } } else { $in->ask_warn(N("Error"), N("Floppy access error, unable to mount device %s", $floppy)); log::explanations("Unable to mount floppy device $floppy"); } $h; } sub install_speedtouch_microcode { my ($in) = @_; my $choice; $in->ask_from('', N("You need the Alcatel microcode. You can provide it now via a floppy or your windows partition, or skip and do it later."), [ { type => "list", val => \$choice, format => \&translate, list => [ N_("Use a floppy"), N_("Use my Windows partition") ] } ]) or return; my ($h, $source); if ($choice eq N_("Use a floppy")) { $source = 'mgmt*.o'; $h = find_file_on_floppy($in, $source); } else { $source = 'alcaudsl.sys'; $h = find_file_on_windows_system($in, $source); } unless (-e $h->{file} && cp_f($h->{file}, "$::prefix/usr/share/speedtouch/mgmt.o")) { $in->ask_warn(N("Error"), N("Firmware copy failed, file %s not found", $source)); log::explanations("Firmware copy of $source ($h->{file}) failed"); return; } log::explanations("Firmware copy of $h->{file} succeeded"); $in->ask_warn(N("Congratulations!"), N("Firmware copy succeeded")); 1; } sub install_packages { my ($in, $settings, $driver, @options) = @_; foreach my $option (@options) { my %methods = ( default => { find_package_name => sub { device_get_package($settings, $option) }, check_installed => sub { is_file_installed($settings, $option) }, get_packages => sub { my ($name) = @_; $in->do_pkgs->is_available($name) }, user_install => sub { my $f = $settings->{$option}{user_install}; $f && $f->($in) }, }, kernel_module => { find_package_name => sub { device_get_package($settings, $option, "$settings->{name}-kernel") }, check_installed => sub { is_module_installed($driver) }, get_packages => sub { my ($name) = @_; my $l = $in->do_pkgs->check_kernel_module_packages($name); $l ? @$l : () } }, firmware => { find_package_name => sub { device_get_package($settings, $option, "$settings->{name}-firmware") }, check_installed => sub { is_firmware_installed($settings) }, }, ); my $get_method = sub { my ($method) = @_; exists $methods{$option} && $methods{$option}{$method} || $methods{default}{$method} }; my $name = $get_method->('find_package_name')->(); unless ($name) { log::explanations(qq(No $option package for module "$driver" is required, skipping)); next; } if ($get_method->('check_installed')->()) { log::explanations(qq(Required $option package for module "$driver" is already installed, skipping)); next; } if (my @packages = $get_method->('get_packages')->($name)) { log::explanations("Installing thirdparty packages ($option) " . join(', ', @packages)); $in->do_pkgs->install(@packages) and next; warn_not_installed($in, @packages); } log::explanations("Thirdparty package $name ($option) is required but not available"); unless ($get_method->('user_install')->($in)) { warn_not_found($in, $settings, $option, $name); return; } } 1; } sub setup_device { my ($in, $category, $driver, $o_config, $o_fields) = @_; if (my $settings = find_settings($category, $driver)) { log::explanations(qq(Found settings for driver "$driver" in category "$category")); my $_w = $in->wait_message('', N("Looking for required software and drivers...")); install_packages($in, $settings, $driver, qw(kernel_module firmware tools)) or return; if (my $service = device_get_option($settings, 'service')) { log::explanations("Restarting service $service"); services::restart_or_start($service); } if (my $post = $settings->{post}) { my $_w = $in->wait_message('', N("Please wait, running device configuration commands...")); log::explanations("Running post-install command $post"); run_program::rooted($::prefix, $post); } log::explanations(qq(Settings for driver "$driver" applied)); } else { log::explanations(qq(No settings found for driver "$driver" in category "$category")); } #- assign requested settings, erase with undef if no settings have been found $o_config->{$_} = $settings->{$_} foreach ($o_fields); 1; } 1;