From 80370a58c86eada2ac765a0e6b974599b02f9b11 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Tue, 19 Jan 2021 21:46:18 +0000 Subject: service_harddrake: support switching drivers when using Live ISOs with persistence --- perl-install/NEWS | 4 ++++ perl-install/standalone/service_harddrake | 14 +++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/perl-install/NEWS b/perl-install/NEWS index cf5124d26..a43a43db8 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -1,3 +1,7 @@ +- service_harddrake: + o support switching between free and proprietary drivers when + using Live ISOs with persistence + Version 18.40 - 11 January 2021 - updated translations diff --git a/perl-install/standalone/service_harddrake b/perl-install/standalone/service_harddrake index d69af68bd..3891370ed 100755 --- a/perl-install/standalone/service_harddrake +++ b/perl-install/standalone/service_harddrake @@ -65,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: @@ -312,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'; @@ -361,7 +367,9 @@ foreach my $hw_class (@harddrake::data::tree) { modules::load_category($modules_conf, 'bus/usb'); $modules_conf->write; } elsif ($Ident eq "VIDEO") { - next if $noxconf; + # 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(); -- cgit v1.2.1