summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/NEWS2
-rwxr-xr-xperl-install/standalone/service_harddrake25
2 files changed, 25 insertions, 2 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index 40bac8890..734770470 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -1,6 +1,8 @@
- service_harddrake:
o adapt splash handling for plymouth (for showing dialogs)
o add/remove nokmsboot boot option if needed when switching the driver
+ o ask for a reboot after a driver switch if needed, and load the new driver
+ if no reboot is needed
Version 13.42 - 24 February 2011
- increase default disk size to suggest /home partition
diff --git a/perl-install/standalone/service_harddrake b/perl-install/standalone/service_harddrake
index 6989ac24b..63104fa57 100755
--- a/perl-install/standalone/service_harddrake
+++ b/perl-install/standalone/service_harddrake
@@ -30,6 +30,7 @@ use Storable qw(store retrieve);
my $force = member('--force', @ARGV);
+my $reboot_needed;
my $invert_do_it = $ARGV[0] eq 'X11' ? 1 : 0;
my ($hw_sysconfdir, $timeout) = ("/etc/sysconfig/harddrake2", $invert_do_it ? 600 : 25);
@@ -124,6 +125,15 @@ sub switch_x_driver {
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();
+
+ # 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) {
+ # Load any new drivers.
+ system("udevadm", "trigger", "--subsystem-match=pci", "--attr-match=class=0x03*");
+ system("udevadm", "settle", "--timeout=10");
+ }
+ $reboot_needed;
}
sub should_reconfigure_x_driver {
@@ -188,7 +198,7 @@ foreach my $device (@devices) {
# auto reconfigure x11 only on first time default driver have changed:
my ($should_reconfigure, $reason) = should_reconfigure_x_driver($card_data, $device, $current_driver);
if ($should_reconfigure) {
- switch_x_driver($current_driver, $card_data->{Driver}, $reason);
+ $reboot_needed |= switch_x_driver($current_driver, $card_data->{Driver}, $reason);
schedule_warn_about_switch($reason) if any { $current_driver =~ $_->{xorg_driver_regexp} } @cards;
# Update $current_driver with the new one
$current_driver = $card_data->{Driver};
@@ -229,7 +239,7 @@ foreach my $card (@cards) {
if ($old_driver) {
my $reason = N("The proprietary kernel driver was not found for '%s' X.org driver",
$old_driver);
- switch_x_driver($card->{xorg_driver_regexp}, $driver, $reason);
+ $reboot_needed |= switch_x_driver($card->{xorg_driver_regexp}, $driver, $reason);
schedule_warn_about_switch($reason);
}
}
@@ -391,4 +401,15 @@ foreach my $hw_class (@harddrake::data::tree) {
log::explanations("created file $last_boot_config");
Storable::store(\%config, $last_boot_config);
+# Handle $reboot_needed from earlier:
+my ($reply, $timedout);
+# Don't do autoreboot if X was somehow already started (not normally the case).
+if ($reboot_needed && ! -e "/tmp/.X11-unix/X0") {
+ ($reply, $timedout) = ask_with_timeout(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");
+ }
+}
+
$in->exit(0) if $in;