summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/service_harddrake
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/standalone/service_harddrake')
-rwxr-xr-xperl-install/standalone/service_harddrake74
1 files changed, 47 insertions, 27 deletions
diff --git a/perl-install/standalone/service_harddrake b/perl-install/standalone/service_harddrake
index 316088431..2f30ad707 100755
--- a/perl-install/standalone/service_harddrake
+++ b/perl-install/standalone/service_harddrake
@@ -27,12 +27,20 @@ use Xconfig::card;
use Xconfig::various;
use modules;
use Storable qw(store retrieve);
+use run_program;
+
+# timeout runaway processes after 2mn:
+run_program::set_default_timeout(2*60);
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";
@@ -57,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:
@@ -105,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) = @_;
@@ -114,7 +122,7 @@ sub find_xorg_driver {
|| -e "/usr/$lib/xorg/extra-modules/${new_driver}_drv.so";
}
-sub after_x_driver_switch {
+sub after_x_driver_switch() {
# If a wrong driver is loaded, ask for a reboot.
my $reboot_needed = -x "/sbin/display_driver_helper" && system("/sbin/display_driver_helper", "--check-loaded") != 0;
if (!$reboot_needed) {
@@ -133,12 +141,12 @@ sub switch_x_driver {
# This should use calls to Xconfig instead of substitution. However, currently
# Xconfig probably makes too intrusive changes to xorg.conf when switching the driver.
cp_af('/etc/X11/xorg.conf', "/etc/X11/xorg.conf.mga$^T");
- substInFile { s!Driver "($old_driver)"!Driver "$new_driver"!g } '/etc/X11/xorg.conf';
+ 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 {
@@ -150,7 +158,7 @@ sub should_reconfigure_x_driver {
# auto reconfigure x11 only on first time default driver have changed:
if ($previous_xorg_config{XORG_DRV} ne $new_key) {
if (!member($current_driver, $card_data->{Driver}, $card_data->{Driver2}, 'fbdev', 'vesa')) {
- $reason = N("The graphic card '%s' is no more supported by the '%s' driver",
+ $reason = N("The graphics card '%s' is no longer supported by driver '%s'",
$device->{description}, $current_driver);
$reconfigure = 1;
}
@@ -172,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 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',
@@ -236,7 +244,7 @@ foreach my $card (@cards) {
next if !$device;
if (find { -e join('', "/lib/modules/", c::kernel_version(), $_) }
- map { ("/dkms/$_", "/dkms-binary/$_", "/kernel/$_") } map { "/drivers/$_" } map { ("extra/$_", "video/$_", "char/$_", "char/drm/$_") } map { $_, "$_.gz" } @{$card->{module_names}}) {
+ map { ("/dkms/$_", "/dkms-binary/$_", "/kernel/$_") } map { "/drivers/$_" } map { ("extra/$_", "video/$_", "char/$_", "char/drm/$_") } map { $_, "$_.xz", "$_.gz" } @{$card->{module_names}}) {
# do not automatically switch from nv to nvidia (in order to handle
# cases where nvidia module crashes the system):
@@ -251,7 +259,7 @@ foreach my $card (@cards) {
my $driver = $cards[0]{Driver};
my $old_driver = cat_('/etc/X11/xorg.conf') =~ /Driver "($card->{xorg_driver_regexp})"/ && $1;
if ($old_driver) {
- my $reason = N("The proprietary kernel driver was not found for '%s' X.org driver",
+ my $reason = N("The proprietary kernel driver was not found for X.org driver '%s'",
$old_driver);
$reboot_needed |= switch_x_driver($card->{xorg_driver_regexp}, $driver, $reason);
$do_udev_settle = 1;
@@ -304,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';
@@ -316,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:
@@ -359,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,12 +435,21 @@ if (!$reboot_needed && text2bool($cfg{HANDLE_KMS_BOOT_CONFIG})) {
# or free driver loaded while vesa is configured).
my $kms_changed = Xconfig::various::setup_kms();
$reboot_needed |= $kms_changed;
- if (!$reboot_needed && cat_("/proc/cmdline") !~ /\bnokmsboot\b/) {
- # Wrong driver loaded but fixing the bootloader configuration failed.
- # Possibly a direct boot from another bootloader.
- dialog_with_timeout("warn", N("Display driver issue"),
- N("The display driver currently configured requires you to use the 'nokmsboot' boot option to prevent the KMS driver of the kernel from being loaded in the boot process. Startup of the X server may now fail as that option was not specified."),
- 60, $plymouth);
+ if (!$reboot_needed) {
+ my $kms_allowed = system("display_driver_helper", "--is-kms-allowed") == 0;
+ if (!$kms_allowed && !$nokmsboot) {
+ # Wrong driver loaded and boot parameters incorrect, but fixing the
+ # bootloader configuration failed.
+ # Possibly a direct boot from another bootloader.
+ dialog_with_timeout("warn", N("Display driver issue"),
+ N("The display driver currently configured requires you to use the 'nokmsboot' boot option to prevent the KMS driver of the kernel from being loaded in the boot process. Startup of the X server may now fail as that option was not specified."),
+ 60, $plymouth);
+ } else {
+ # Wrong driver loaded even while boot parameters were correct.
+ dialog_with_timeout("warn", N("Display driver issue"),
+ N("Detected a loaded display driver kernel module which conflicts with the driver the X server is configured to use. Startup of the X server may now fail."),
+ 60, $plymouth);
+ }
}
} elsif (-e "/dev/.late_kms") {
# initrd didn't load the KMS driver; non-fatal but ugly, fix it for next boot
@@ -445,7 +465,7 @@ if ($reboot_needed && ! -e "/tmp/.X11-unix/X0") {
($reply, $timedout) = dialog_with_timeout("okcancel", N("Display driver setup"), N("The system has to be rebooted due to a display driver change.") . "\n\n"
. N("Press Cancel within %d seconds to abort.", 30), 30, $plymouth);
if ($reply || $timedout) {
- exec("/sbin/reboot");
+ exec("/bin/reboot");
}
}