diff options
Diffstat (limited to 'perl-install/standalone/service_harddrake')
| -rwxr-xr-x | perl-install/standalone/service_harddrake | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/perl-install/standalone/service_harddrake b/perl-install/standalone/service_harddrake index c661468f3..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'; @@ -357,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(); @@ -424,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. |
