From f981bde259111fe8467866e4545a0e341fa6ad56 Mon Sep 17 00:00:00 2001 From: "Mark D. Studebaker" Date: Sun, 30 Jun 2002 23:57:34 +0000 Subject: [PATCH] add /etc/sysconfig/lm_sensors generation - patch from mike808 git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1416 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 55 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index f3512ac2..910d0d6f 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -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 =~ /^\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 +# +# 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;