Lines 27-32
Link Here
|
27 |
# each be put in a separate file, using modules and packages. That is beyond |
27 |
# each be put in a separate file, using modules and packages. That is beyond |
28 |
# me. |
28 |
# me. |
29 |
|
29 |
|
|
|
30 |
# Gentoo specific modifications based on a patch from Rudo Thomas |
31 |
# <thomr9am@ss1000.ms.mff.cuni.cz> |
32 |
|
30 |
require 5.004; |
33 |
require 5.004; |
31 |
|
34 |
|
32 |
use strict; |
35 |
use strict; |
Lines 5899-5927
Link Here
|
5899 |
print MODPROBE_D $configfile; |
5902 |
print MODPROBE_D $configfile; |
5900 |
close(MODPROBE_D); |
5903 |
close(MODPROBE_D); |
5901 |
} else { |
5904 |
} else { |
|
|
5905 |
print "\nIf you want to load the modules at startup, generate a config file\n", |
5906 |
"below and make sure lm_sensors gets started at boot time; e.g\n", |
5907 |
"\$ rc-update add lm_sensors default\n"; |
5902 |
print "To make the sensors modules behave correctly, add these lines to\n". |
5908 |
print "To make the sensors modules behave correctly, add these lines to\n". |
5903 |
"$modules_conf:\n\n"; |
5909 |
"/etc/modules.d/lm_sensors and run modules-update:\n\n"; |
5904 |
print "#----cut here----\n". |
5910 |
print "#----cut here----\n". |
5905 |
$configfile. |
5911 |
$configfile. |
5906 |
"#----cut here----\n\n"; |
5912 |
"#----cut here----\n\n"; |
5907 |
} |
5913 |
} |
5908 |
} |
5914 |
} |
5909 |
|
5915 |
|
5910 |
my $have_sysconfig = -d '/etc/sysconfig'; |
5916 |
print "To load everything that is needed, execute the commands below..."; |
5911 |
printf "Do you want to \%s /etc/sysconfig/lm_sensors? (\%s): ", |
5917 |
|
5912 |
(-e '/etc/sysconfig/lm_sensors' ? 'overwrite' : 'generate'), |
5918 |
print "\n\n#----cut here----\n"; |
|
|
5919 |
print $modprobes; |
5920 |
print "# sleep 2 # optional\n", |
5921 |
"/usr/bin/sensors -s # recommended\n"; |
5922 |
print "#----end cut here----\n"; |
5923 |
|
5924 |
my $have_sysconfig = -f '/etc/conf.d/lm_sensors'; |
5925 |
printf "Do you want to \%s /etc/conf.d/lm_sensors? Enter s for other filename (\%s/s): ", |
5926 |
($have_sysconfig ? 'overwrite' : 'generate'), |
5913 |
($have_sysconfig ? 'YES/no' : 'yes/NO'); |
5927 |
($have_sysconfig ? 'YES/no' : 'yes/NO'); |
5914 |
$_ = <STDIN>; |
5928 |
$_ = <STDIN>; |
5915 |
if (($have_sysconfig and not m/^\s*n/i) or m/^\s*y/i) { |
5929 |
if (m/^\s*s/i or ($have_sysconfig and not m/^\s*n/i) or m/^\s*y/i) { |
5916 |
unless ($have_sysconfig) { |
5930 |
my $filename = '/etc/conf.d/lm_sensors'; |
5917 |
mkdir '/etc/sysconfig', 0777 |
5931 |
if (m/^\s*s/i) { |
5918 |
or die "Sorry, can't create /etc/sysconfig ($!)"; |
5932 |
print "Specify the file to store the configuration to: "; |
|
|
5933 |
$filename = <STDIN>; |
5919 |
} |
5934 |
} |
5920 |
open(local *SYSCONFIG, ">/etc/sysconfig/lm_sensors") |
5935 |
open(local *SYSCONFIG, ">$filename") |
5921 |
or die "Sorry, can't create /etc/sysconfig/lm_sensors ($!)"; |
5936 |
or die "Sorry, can't create $filename ($!)"; |
5922 |
print SYSCONFIG <<'EOT'; |
5937 |
print SYSCONFIG <<'EOT'; |
5923 |
# /etc/sysconfig/lm_sensors - Defines modules loaded by |
5938 |
# /etc/conf.d/sensors - Defines modules loaded by /etc/init.d/lm_sensors |
5924 |
# /etc/init.d/lm_sensors |
|
|
5925 |
# Copyright (c) 1998 - 2001 Frodo Looijaard <frodol@dds.nl> |
5939 |
# Copyright (c) 1998 - 2001 Frodo Looijaard <frodol@dds.nl> |
5926 |
# |
5940 |
# |
5927 |
# This program is free software; you can redistribute it and/or modify |
5941 |
# This program is free software; you can redistribute it and/or modify |
Lines 5950-5961
Link Here
|
5950 |
# in order as normal variables with the special names: |
5964 |
# in order as normal variables with the special names: |
5951 |
# MODULE_0, MODULE_1, MODULE_2, etc. |
5965 |
# MODULE_0, MODULE_1, MODULE_2, etc. |
5952 |
# |
5966 |
# |
|
|
5967 |
# Please note that the numbers in MODULE_X must start at 0 and increase in |
5968 |
# steps of 1. Any number that is missing will make the init script skip the |
5969 |
# rest of the modules. Use MODULE_X_ARGS for arguments. |
5970 |
# |
5953 |
# List the modules that are to be loaded for your system |
5971 |
# List the modules that are to be loaded for your system |
5954 |
# |
5972 |
# |
5955 |
EOT |
5973 |
EOT |
5956 |
print SYSCONFIG |
5974 |
print SYSCONFIG |
5957 |
"# Generated by sensors-detect on " . scalar localtime() . "\n"; |
5975 |
"# Generated by sensors-detect on " . scalar localtime() . "\n"; |
5958 |
my @modules = grep /^modprobe /, split "\n", $modprobes; |
5976 |
my @modules = grep /^modprobe /, split "\n", $modprobes; |
|
|
5977 |
print SYSCONFIG |
5978 |
"# Load modules at startup\n". |
5979 |
"LOADMODULES=yes\n\n". |
5980 |
"# Initialize sensors at startup\n". |
5981 |
"INITSENSORS=yes\n\n"; |
5959 |
my $i = 0; |
5982 |
my $i = 0; |
5960 |
my $sysconfig = ""; |
5983 |
my $sysconfig = ""; |
5961 |
foreach (@modules) { |
5984 |
foreach (@modules) { |
Lines 5966-5974
Link Here
|
5966 |
print SYSCONFIG $sysconfig; |
5989 |
print SYSCONFIG $sysconfig; |
5967 |
close(SYSCONFIG); |
5990 |
close(SYSCONFIG); |
5968 |
|
5991 |
|
5969 |
print "Copy prog/init/lm_sensors.init to /etc/init.d/lm_sensors\n". |
5992 |
print "Done.\n"; |
5970 |
"for initialization at boot time.\n" |
|
|
5971 |
unless -f "/etc/init.d/lm_sensors"; |
5972 |
|
5993 |
|
5973 |
if (-x "/sbin/insserv" && -f "/etc/init.d/lm_sensors") { |
5994 |
if (-x "/sbin/insserv" && -f "/etc/init.d/lm_sensors") { |
5974 |
system("/sbin/insserv", "/etc/init.d/lm_sensors"); |
5995 |
system("/sbin/insserv", "/etc/init.d/lm_sensors"); |