summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/harddrake/autoconf.pm19
-rwxr-xr-xperl-install/standalone/service_harddrake8
2 files changed, 26 insertions, 1 deletions
diff --git a/perl-install/harddrake/autoconf.pm b/perl-install/harddrake/autoconf.pm
index 85be3ea4b..0c1ddff7d 100644
--- a/perl-install/harddrake/autoconf.pm
+++ b/perl-install/harddrake/autoconf.pm
@@ -55,4 +55,23 @@ sub bluetooth {
services::set_status("bluetooth", $enable);
}
+sub laptop {
+ my ($on_laptop) = @_;
+#- FIXME: make sure these packages are installed when needed
+# require do_pkgs;
+# my $do_pkgs = do_pkgs_standalone->new;
+# if ($on_laptop) {
+# $do_pkgs->ensure_is_installed("cpufreq", "/etc/rc.d/init.d/cpufreq");
+# $do_pkgs->ensure_is_installed("apmd", "/usr/bin/apm");
+# $do_pkgs->ensure_is_installed("hotkeys", "/usr/bin/hotkeys");
+# $do_pkgs->ensure_is_installed("laptop-mode-tools", "/usr/sbin/laptop_mode");
+# } else {
+# $do_pkgs->ensure_is_installed("numlock", "/etc/rc.d/init.d/numlock");
+# }
+ require services;
+ services::set_status("cpufreq", $on_laptop);
+ services::set_status("apmd", $on_laptop);
+ services::set_status("laptop-mode", $on_laptop);
+}
+
1;
diff --git a/perl-install/standalone/service_harddrake b/perl-install/standalone/service_harddrake
index 870868c0c..d1f2b651d 100755
--- a/perl-install/standalone/service_harddrake
+++ b/perl-install/standalone/service_harddrake
@@ -34,17 +34,23 @@ $last_boot_config .= '_X11' if $invert_do_it;
my $modules_conf = modules::any_conf->read;
+my $isLaptop = detect_devices::isLaptop();
my $curr_kernel = c::kernel_version();
$curr_kernel =~ s/(^\d+\.\d+).*/$1/;
my %previous_kernel_config = getVarsFromSh("$hw_sysconfdir/kernel");
-setVarsInSh("$hw_sysconfdir/kernel", { KERNEL => $curr_kernel });
+setVarsInSh("$hw_sysconfdir/kernel", { KERNEL => $curr_kernel, IS_LAPTOP => bool2text($isLaptop) });
# autoreconfigure the mouse on major kernel change:
if ($curr_kernel ne $previous_kernel_config{KERNEL}) {
log::explanations("Autoconfiguring mouse since we switched between 2.4.x and 2.6.x kernels");
harddrake::autoconf::mouse_conf($modules_conf);
}
+# autoreconfigure laptop-dependent services when switching from laptop to desktop, and vice versa
+if (!exists $previous_kernel_config{IS_LAPTOP} || $force || $isLaptop ne to_bool($previous_kernel_config{IS_LAPTOP})) {
+ log::explanations("Autoconfiguring laptop tools since we switched between laptop and desktop systems");
+ harddrake::autoconf::laptop($isLaptop);
+}
if (find { $_->{driver} =~ /Card:NVIDIA/ } detect_devices::probeall()) {
if (find { -e join('', "/lib/modules/", c::kernel_version(), "/kernel/drivers/$_") } map { ("extra/$_", "video/$_", "char/$_", "char/drm/$_") } qw(NVdriver nvidia.o nvidia.o.gz nvidia.ko nvidia.ko.gz)) {