diff options
Diffstat (limited to 'perl-install/standalone/service_harddrake')
-rwxr-xr-x | perl-install/standalone/service_harddrake | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/perl-install/standalone/service_harddrake b/perl-install/standalone/service_harddrake index 2e96fe6c7..2f30ad707 100755 --- a/perl-install/standalone/service_harddrake +++ b/perl-install/standalone/service_harddrake @@ -37,6 +37,10 @@ my $force = member('--force', @ARGV); my $reboot_needed; my $do_udev_settle; +my $cmdline = cat_("/proc/cmdline"); +my $noxconf = $cmdline =~ /\bnoxconf\b/; +my $nokmsboot = $cmdline =~ /\bnokmsboot\b/; + my $invert_do_it = $ARGV[0] eq 'X11' ? 1 : 0; my ($hw_sysconfdir, $timeout) = ("/etc/sysconfig/harddrake2", $invert_do_it ? 600 : 25); my $last_boot_config = "$hw_sysconfdir/previous_hw"; @@ -61,7 +65,7 @@ my ($kernel_major) = $curr_kernel =~ /^(\d+\.\d+)/; my %previous_kernel_config = getVarsFromSh("$hw_sysconfdir/kernel"); my %previous_xorg_config = getVarsFromSh("$hw_sysconfdir/xorg"); -setVarsInSh("$hw_sysconfdir/kernel", { KERNEL => $kernel_major, IS_LAPTOP => bool2text($isLaptop) }); +setVarsInSh("$hw_sysconfdir/kernel", { KERNEL => $kernel_major, IS_LAPTOP => bool2text($isLaptop), NOKMSBOOT => $nokmsboot }); my %cfg = getVarsFromSh("$hw_sysconfdir/service.conf"); # default to 'yes' on upgrade: @@ -109,7 +113,7 @@ sub schedule_warn_about_switch { output('/var/run/harddrake-notify-x11-free-driver-switch', $reason); } -my $lib = arch() =~ /x86_64/ ? "lib64" : "lib"; +my $lib = get_libdir(); sub find_xorg_driver { my ($new_driver) = @_; @@ -140,9 +144,9 @@ sub switch_x_driver { substInFile { s!^(\s*Driver\s+)"$old_driver"!$1"$new_driver"!i } '/etc/X11/xorg.conf'; log::explanations("switch X.org driver from '$old_driver' to '$new_driver' ($reason)"); Xconfig::card::libgl_config_and_more({ Driver => $new_driver }); - Xconfig::various::setup_kms(); + my $kms_changed = Xconfig::various::setup_kms(); - after_x_driver_switch(); # returns 1 if reboot is needed + after_x_driver_switch() || $kms_changed; # returns 1 if reboot is needed } sub should_reconfigure_x_driver { @@ -176,7 +180,7 @@ my @cards = ( { ldetect_driver_regexp => 'Card:NVIDIA', xorg_driver_regexp => 'nv.+', - module_names => [ qw(NVdriver nvidia.o nvidia.ko nvidia71xx.ko nvidia96xx.ko nvidia97xx.ko nvidia173.ko nvidia304.ko nvidia-current.ko) ] + module_names => [ qw(nvidia.ko nvidia304.ko nvidia340.ko nvidia390.ko nvidia470.ko nvidia-newfeature.ko nvidia-current.ko) ] }, { ldetect_driver_regexp => 'Card:ATI Radeon', @@ -308,7 +312,13 @@ foreach my $hw_class (@harddrake::data::tree) { $modules_conf->write; } - @added || @was_removed or $cfg{"DETECT_$Ident"} ne 'force' and next; + # When using the Live ISOs, the proprietary driver is enabled or disabled according to which boot + # menu entry is selected. We can use the presence or absence of "nokmsboot" to detect which was + # selected. If persistence is enabled, we must force a reconfiguration if the selection changes. + my $force_xconf = $Ident eq 'VIDEO' && -e '/run/mgalive/persistent' + && $nokmsboot != $previous_kernel_config{NOKMSBOOT}; + + @added || @was_removed || $force_xconf or $cfg{"DETECT_$Ident"} ne 'force' and next; next if $Ident eq 'MOUSE' && $kernel_major ne $previous_kernel_config{KERNEL} && $cfg{"DETECT_$Ident"} ne 'force'; @@ -320,15 +330,9 @@ foreach my $hw_class (@harddrake::data::tree) { harddrake::sound::configure_sound_slots($modules_conf); next; } elsif ($Ident eq "ETHERNET") { - $modules_conf->remove_alias_regexp('^(wlan|eth)[0-9]*$'); - modules::load_category($modules_conf, 'network/main|gigabit|usb|wireless|firewire|pcmcia'); - require network::connection::ethernet; - network::connection::ethernet::configure_eth_aliases($modules_conf); - require network::rfswitch; - network::rfswitch::configure(); - require network::shorewall; - network::shorewall::update_interfaces_list(); - $modules_conf->write; + require interactive; + $in ||= interactive->vnew; + harddrake::autoconf::network_conf($modules_conf, $in, [ @ID{@added} ]); next; } elsif (member($Ident, qw(ATA_STORAGE CARD_READER RAID_STORAGE SATA_STORAGE SCSI_CONTROLLER))) { # set scsi_hostadapter in modprobe.conf: @@ -363,6 +367,9 @@ foreach my $hw_class (@harddrake::data::tree) { modules::load_category($modules_conf, 'bus/usb'); $modules_conf->write; } elsif ($Ident eq "VIDEO") { + # Once an xorg.conf has been created, continue to use it, even if "noxconf" is specified. This + # allows the user to switch back to the free driver without uninstalling the proprietary driver. + next if $noxconf && !($force_xconf || -f '/etc/X11/xorg.conf'); # explicitely NOT read the existing config (eg: new profile with globetrotter) harddrake::autoconf::xconf($modules_conf, {}, member($cfg{SETUP_FB}, qw(NO no)), $cfg{RESOLUTION_WANTED}); $reboot_needed |= after_x_driver_switch(); @@ -430,7 +437,7 @@ if (!$reboot_needed && text2bool($cfg{HANDLE_KMS_BOOT_CONFIG})) { $reboot_needed |= $kms_changed; if (!$reboot_needed) { my $kms_allowed = system("display_driver_helper", "--is-kms-allowed") == 0; - if (!$kms_allowed && cat_("/proc/cmdline") !~ /\bnokmsboot\b/) { + if (!$kms_allowed && !$nokmsboot) { # Wrong driver loaded and boot parameters incorrect, but fixing the # bootloader configuration failed. # Possibly a direct boot from another bootloader. |