Lines 25-30
Link Here
|
25 |
# each be put in a separate file, using modules and packages. That is beyond |
25 |
# each be put in a separate file, using modules and packages. That is beyond |
26 |
# me. |
26 |
# me. |
27 |
|
27 |
|
|
|
28 |
# Changelog |
29 |
# 02/Mar/2003, Rudo Thomas <thomr9am@ss1000.ms.mff.cuni.cz> |
30 |
# * a few small changes in config file output to reflect Gentoo Linux layout |
31 |
# - /etc/sysconfig -> /etc/conf.d |
32 |
# - /etc/rc.d/init.d -> /etc/init.d |
33 |
# - added a warning to the generated config file |
34 |
# - small change when asking about writing the new config file |
35 |
|
28 |
require 5.004; |
36 |
require 5.004; |
29 |
|
37 |
|
30 |
use strict; |
38 |
use strict; |
Lines 3718-3755
Link Here
|
3718 |
my $use_isa = not <STDIN> =~ /\s*[Ss]/; |
3726 |
my $use_isa = not <STDIN> =~ /\s*[Ss]/; |
3719 |
|
3727 |
|
3720 |
my ($modprobes,$configfile) = generate_modprobes $use_isa; |
3728 |
my ($modprobes,$configfile) = generate_modprobes $use_isa; |
3721 |
print "\nTo make the sensors modules behave correctly, add these lines to either\n", |
3729 |
|
3722 |
"/etc/modules.conf or /etc/conf.modules:\n\n"; |
3730 |
print "#-----------------"; |
|
|
3731 |
print "\nIf you want to load the modules at startup, generate a config", |
3732 |
" file\n", |
3733 |
"below and make sure lm_sensors get started ", |
3734 |
"(eg. rc-update add lm_sensors default).\n"; |
3735 |
print "\nTo make the sensor modules behave correctly, add these lines to\n", |
3736 |
"/etc/modules.conf:\n\n"; |
3723 |
print "#----cut here----\n"; |
3737 |
print "#----cut here----\n"; |
3724 |
print $configfile; |
3738 |
print $configfile; |
3725 |
print "#----cut here----\n"; |
3739 |
print "#----end cut here----\n"; |
3726 |
print "\nTo load everything that is needed, add this to some /etc/rc* ", |
3740 |
|
3727 |
"file:\n\n"; |
|
|
3728 |
print "#----cut here----\n"; |
3729 |
print $modprobes; |
3730 |
print "# sleep 2 # optional\n", |
3731 |
"/usr/local/bin/sensors -s # recommended\n"; |
3732 |
print "#----cut here----\n"; |
3733 |
print "\nWARNING! If you have some things built into your kernel, the list above\n", |
3741 |
print "\nWARNING! If you have some things built into your kernel, the list above\n", |
3734 |
"will contain too many modules. Skip the appropriate ones! You really should\n", |
3742 |
"will contain too many modules. Skip the appropriate ones! You really should\n", |
3735 |
"try these commands right now to make sure everything is working properly.\n", |
3743 |
"try these commands right now to make sure everything is working properly.\n", |
3736 |
"Monitoring programs won't work until it's done.\n"; |
3744 |
"Monitoring programs won't work until it's done.\n"; |
3737 |
|
3745 |
print "To load everything that is needed, execute the commands above..."; |
3738 |
my $have_sysconfig = -d '/etc/sysconfig'; |
3746 |
|
3739 |
print "\nDo you want to generate /etc/sysconfig/lm_sensors? (". |
3747 |
print "#----cut here----\n"; |
3740 |
($have_sysconfig?"YES/no":"yes/NO")."): "; |
3748 |
print $modprobes; |
3741 |
if ($> != 0) { |
3749 |
print "# sleep 2 # optional\n", |
3742 |
print "\nAs you are not root, we shall skip this step.\n"; |
3750 |
"/usr/local/bin/sensors -s # recommended\n"; |
3743 |
} else { |
3751 |
print "#----end cut here----\n"; |
3744 |
if (($have_sysconfig and not <STDIN> =~ /^\s*[Nn]/) or <STDIN> =~ /^\s*[Yy]/) { |
3752 |
|
3745 |
unless ($have_sysconfig) { |
3753 |
my $have_config = -f '/etc/conf.d/lm_sensors'; |
3746 |
mkdir '/etc/sysconfig', 0777 |
3754 |
print "\nDo you want to ".($have_config?"overwrite":"generate"). |
3747 |
or die "Sorry, can't create /etc/sysconfig ($!)?!?"; |
3755 |
" /etc/conf.d/lm_sensors? Enter s to specify other file name?\n", |
3748 |
} |
3756 |
" (".($have_config?"yes/NO":"YES/no")."/s): "; |
3749 |
open(SYSCONFIG, ">/etc/sysconfig/lm_sensors") |
3757 |
my $reply = <STDIN>; |
3750 |
or die "Sorry, can't create /etc/sysconfig/lm_sensors ($!)?!?"; |
3758 |
|
3751 |
print SYSCONFIG <<'EOT'; |
3759 |
if (($have_config and $reply =~ /^\s*[Yy]/) or |
3752 |
# /etc/sysconfig/sensors - Defines modules loaded by /etc/rc.d/init.d/lm_sensors |
3760 |
(not $have_config and not $reply =~ /^\s*[Nn]/) or |
|
|
3761 |
$reply =~ /^\s*[Ss]/) { |
3762 |
my $filename = "/etc/conf.d/lm_sensors"; |
3763 |
if ($reply =~ /^\s*[Ss]/) { |
3764 |
print "Specify the file to store the configuration to: "; |
3765 |
$filename = <STDIN>; |
3766 |
} |
3767 |
open(SYSCONFIG, ">".$filename) |
3768 |
or die "Sorry, can't create $filename ($!)."; |
3769 |
print SYSCONFIG <<'EOT'; |
3770 |
# /etc/conf.d/sensors - Defines modules loaded by /etc/init.d/lm_sensors |
3753 |
# Copyright (c) 1998 - 2001 Frodo Looijaard <frodol@dds.nl> |
3771 |
# Copyright (c) 1998 - 2001 Frodo Looijaard <frodol@dds.nl> |
3754 |
# |
3772 |
# |
3755 |
# This program is free software; you can redistribute it and/or modify |
3773 |
# This program is free software; you can redistribute it and/or modify |
Lines 3766-3782
Link Here
|
3766 |
# along with this program; if not, write to the Free Software |
3784 |
# along with this program; if not, write to the Free Software |
3767 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
3785 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
3768 |
# |
3786 |
# |
3769 |
# |
|
|
3770 |
# See also the lm_sensors homepage at: |
3787 |
# See also the lm_sensors homepage at: |
3771 |
# http://www2.lm-sensors.nu/~lm78/index.html |
3788 |
# http://www2.lm-sensors.nu/~lm78/index.html |
3772 |
# |
3789 |
# |
3773 |
# This file is used by /etc/rc.d/init.d/lm_sensors and defines the modules to |
3790 |
# This file is used by /etc/init.d/lm_sensors and defines the modules to |
3774 |
# be loaded/unloaded. This file is sourced into /etc/rc.d/init.d/lm_sensors. |
3791 |
# be loaded/unloaded. This file is sourced into /etc/init.d/lm_sensors. |
3775 |
# |
3792 |
# |
3776 |
# The format of this file is a shell script that simply defines the modules |
3793 |
# The format of this file is a shell script that simply defines the modules |
3777 |
# in order as normal variables with the special names: |
3794 |
# in order as normal variables with the special names: |
3778 |
# MODULE_0, MODULE_1, MODULE_2, etc. |
3795 |
# MODULE_0, MODULE_1, MODULE_2, etc. |
3779 |
# |
3796 |
# |
|
|
3797 |
# Please note that the numbers in MODULE_X must start at 0 and increase in |
3798 |
# steps of 1. Any number that is missing will make the init script skip the |
3799 |
# rest of the modules. |
3800 |
# |
3780 |
# List the modules that are to be loaded for your system |
3801 |
# List the modules that are to be loaded for your system |
3781 |
# |
3802 |
# |
3782 |
EOT |
3803 |
EOT |
Lines 3792-3800
Link Here
|
3792 |
} |
3813 |
} |
3793 |
print SYSCONFIG $sysconfig; |
3814 |
print SYSCONFIG $sysconfig; |
3794 |
close(SYSCONFIG); |
3815 |
close(SYSCONFIG); |
3795 |
print "Copy prog/init/lm_sensors.init to /etc/rc.d/init.d/lm_sensors\n"; |
3816 |
print "Done.\n"; |
3796 |
print "for initialization at boot time.\n"; |
|
|
3797 |
} |
3798 |
} |
3817 |
} |
3799 |
} |
3818 |
} |
3800 |
|
3819 |
|