mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-08-31 22:35:23 +00:00
add /etc/sysconfig/lm_sensors generation - patch from
mike808 <mike808@users.sourceforge.net> git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1416 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
@@ -2993,6 +2993,61 @@ sub main
|
||||
print $configfile;
|
||||
print "#----cut here----\n";
|
||||
|
||||
print "\nDo you want to generate /etc/sysconfig/lm_sensors? (YES/no): ";
|
||||
if ($> != 0) {
|
||||
print "\nAs you are not root, we shall skip this step.\n";
|
||||
} else {
|
||||
if (not <STDIN> =~ /^\s*[Nn]/) {
|
||||
open(SYSCONFIG, ">/etc/sysconfig/lm_sensors")
|
||||
or die "Sorry, can't create /etc/sysconfig/lm_sensors ($!)?!?";
|
||||
print SYSCONFIG <<'EOT';
|
||||
# /etc/sysconfig/sensors - Defines modules loaded by /etc/rc.d/init.d/lm_sensors
|
||||
# Copyright (c) 1998 - 2001 Frodo Looijaard <frodol@dds.nl>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
#
|
||||
# See also the lm_sensors homepage at:
|
||||
# http://www2.lm-sensors.nu/~lm78/index.html
|
||||
#
|
||||
# This file is used by /etc/rc.d/init.d/lm_sensors and defines the modules to
|
||||
# be loaded/unloaded. This file is sourced into /etc/rc.d/init.d/lm_sensors.
|
||||
#
|
||||
# The format of this file is a shell script that simply defines the modules
|
||||
# in order as normal variables with the special names:
|
||||
# MODULE_1, MODULE_2, MODULE_3, etc.
|
||||
#
|
||||
# List the modules that are to be loaded for your system
|
||||
#
|
||||
EOT
|
||||
print SYSCONFIG
|
||||
"# Generated by sensors-detect on " . scalar localtime . "\n";
|
||||
my @modules = grep /^modprobe /, split "\n", $modprobes;
|
||||
my $i = 1;
|
||||
my $sysconfig = "";
|
||||
foreach (@modules) {
|
||||
s/^modprobe //;
|
||||
$sysconfig .= "MODULE_$i=$_\n";
|
||||
$i++;
|
||||
}
|
||||
print SYSCONFIG $sysconfig;
|
||||
close(SYSCONFIG);
|
||||
print "Copy prog/init/lm_sensors.init to /etc/rc.d/init.d/lm_sensors\n";
|
||||
print "for initialization at boot time.\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
main;
|
||||
|
Reference in New Issue
Block a user