Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 499620
Collapse All | Expand All

(-)file_not_specified_in_diff (-50 / +29 lines)
Line  Link Here
0
-- lm_sensors-3.3.5/prog/detect/sensors-detect
0
++ lm_sensors-3.3.5/prog/detect/sensors-detect
Lines 20-25 Link Here
20
#    MA 02110-1301 USA.
20
#    MA 02110-1301 USA.
21
#
21
#
22
22
23
# Gentoo specific modifications based on a patch from Rudo Thomas
24
# <thomr9am@ss1000.ms.mff.cuni.cz>
25
23
require 5.004;
26
require 5.004;
24
27
25
use strict;
28
use strict;
Lines 6762-6787 Link Here
6762
			print MODPROBE_D $configfile;
6765
			print MODPROBE_D $configfile;
6763
			close(MODPROBE_D);
6766
			close(MODPROBE_D);
6764
		} else {
6767
		} else {
6768
			print "\nIf you want to load the modules at startup, generate a config file\n",
6769
			      "below and make sure lm_sensors gets started at boot time; e.g\n",
6770
			      "\$ rc-update add lm_sensors default\n";
6765
			print "To make the sensors modules behave correctly, add these lines to\n".
6771
			print "To make the sensors modules behave correctly, add these lines to\n".
6766
			      "/etc/modprobe.conf:\n\n";
6772
			      "/etc/modules.d/lm_sensors and run modules-update:\n\n";
6767
			print "#----cut here----\n".
6773
			print "#----cut here----\n".
6768
			      $configfile.
6774
			      $configfile.
6769
			      "#----cut here----\n\n";
6775
			      "#----cut here----\n\n";
6770
		}
6776
		}
6771
	}
6777
	}
6772
6778
6773
	my $have_sysconfig = -d '/etc/sysconfig';
6779
	my $have_sysconfig = -f '/etc/conf.d/lm_sensors';
6774
	printf "Do you want to \%s /etc/sysconfig/lm_sensors? (\%s): ",
6780
	printf "Do you want to ".($have_sysconfig?"overwrite":"generate").
6775
	       (-e '/etc/sysconfig/lm_sensors' ? 'overwrite' : 'generate'),
6781
	       " /etc/conf.d/lm_sensors? Enter s to specify other file name?\n",
6776
	       ($have_sysconfig ? 'YES/no' : 'yes/NO');
6782
	       "  (".($have_sysconfig?"yes/NO":"YES/no")."/s): ";
6777
	$_ = read_answer();
6783
	my $reply = read_answer();
6778
	if (($have_sysconfig and not m/^\s*n/i) or m/^\s*y/i) {
6784
6779
		unless ($have_sysconfig) {
6785
	if (($have_sysconfig and $reply =~ /^\s*[Yy]/) or
6780
			mkdir('/etc/sysconfig', 0777)
6786
		(not $have_sysconfig and not $reply =~ /^\s*[Nn]/) or
6781
				or die "Sorry, can't create /etc/sysconfig ($!)";
6787
		$reply =~ /^\s*[Ss]/) {
6788
		my $filename = "/etc/conf.d/lm_sensors";
6789
		if ($reply =~ /^\s*[Ss]/) {
6790
			print "Specify the file to store the configuration to: ";
6791
			$filename = read_answer();
6782
		}
6792
		}
6783
		open(local *SYSCONFIG, ">/etc/sysconfig/lm_sensors")
6793
		open(local *SYSCONFIG, ">".$filename)
6784
			or die "Sorry, can't create /etc/sysconfig/lm_sensors ($!)";
6794
			or die "Sorry, can't create $filename ($!).";
6785
		print SYSCONFIG "# Generated by sensors-detect on " . scalar localtime() . "\n";
6795
		print SYSCONFIG "# Generated by sensors-detect on " . scalar localtime() . "\n";
6786
		print SYSCONFIG <<'EOT';
6796
		print SYSCONFIG <<'EOT';
6787
# This file is sourced by /etc/init.d/lm_sensors and defines the modules to
6797
# This file is sourced by /etc/init.d/lm_sensors and defines the modules to
Lines 6792-6821 Link Here
6792
# BUS_MODULES for any required bus driver module (for example for I2C or SPI).
6802
# BUS_MODULES for any required bus driver module (for example for I2C or SPI).
6793
6803
6794
EOT
6804
EOT
6805
		print SYSCONFIG
6806
			"# Load modules at startup\n".
6807
			"LOADMODULES=yes\n\n".
6808
			"# Initialize sensors at startup\n".
6809
			"INITSENSORS=yes\n\n";
6795
		print SYSCONFIG "BUS_MODULES=\"", join(" ", @{$bus_modules}), "\"\n"
6810
		print SYSCONFIG "BUS_MODULES=\"", join(" ", @{$bus_modules}), "\"\n"
6796
			if @{$bus_modules};
6811
			if @{$bus_modules};
6797
		print SYSCONFIG "HWMON_MODULES=\"", join(" ", @{$hwmon_modules}), "\"\n";
6812
		print SYSCONFIG "HWMON_MODULES=\"", join(" ", @{$hwmon_modules}), "\"\n";
6798
		close(SYSCONFIG);
6813
		close(SYSCONFIG);
6799
6814
6800
		if (-x "/bin/systemctl" && -d "/lib/systemd/system" &&
6815
		print "Done.\n";
6801
		    ! -f "/lib/systemd/system/lm_sensors.service") {
6802
			print "Copy prog/init/lm_sensors.service to /lib/systemd/system\n".
6803
			      "and run 'systemctl enable lm_sensors.service'\n".
6804
			      "for initialization at boot time.\n";
6805
			return;
6806
		}
6807
6808
		if (-x "/bin/systemctl" &&
6809
		    -f "/lib/systemd/system/lm_sensors.service") {
6810
			system("/bin/systemctl", "enable", "lm_sensors.service");
6811
			system("/bin/systemctl", "start", "lm_sensors.service");
6812
			# All done, don't check for /etc/init.d/lm_sensors
6813
			return;
6814
		}
6815
6816
		print "Copy prog/init/lm_sensors.init to /etc/init.d/lm_sensors\n".
6817
		      "for initialization at boot time.\n"
6818
			unless -f "/etc/init.d/lm_sensors";
6819
6816
6820
		if (-x "/sbin/insserv" && -f "/etc/init.d/lm_sensors") {
6817
		if (-x "/sbin/insserv" && -f "/etc/init.d/lm_sensors") {
6821
			system("/sbin/insserv", "/etc/init.d/lm_sensors");
6818
			system("/sbin/insserv", "/etc/init.d/lm_sensors");
Lines 6828-6851 Link Here
6828
			print "You should now start the lm_sensors service to load the required\n".
6825
			print "You should now start the lm_sensors service to load the required\n".
6829
			      "kernel modules.\n\n";
6826
			      "kernel modules.\n\n";
6830
		}
6827
		}
6831
	} else {
6832
		print "To load everything that is needed, add this to one of the system\n".
6833
		      "initialization scripts (e.g. /etc/rc.d/rc.local):\n\n";
6834
		print "#----cut here----\n";
6835
		if (@{$bus_modules}) {
6836
			print "# Adapter drivers\n";
6837
			print "modprobe $_\n" foreach (@{$bus_modules});
6838
		}
6839
		print "# Chip drivers\n";
6840
		print "modprobe $_\n" foreach (@{$hwmon_modules});
6841
		print((-e '/usr/bin/sensors' ?
6842
		       "/usr/bin/sensors -s\n" :
6843
		       "/usr/local/bin/sensors -s\n").
6844
		      "#----cut here----\n\n");
6845
6846
		print "You really should try these commands right now to make sure everything\n".
6847
		      "is working properly. Monitoring programs won't work until the needed\n".
6848
		      "modules are loaded.\n\n";
6849
	}
6828
	}
6850
}
6829
}
6851
6830

Return to bug 499620