Changeset 1416

Show
Ignore:
Timestamp:
07/01/02 01:57:34 (11 years ago)
Author:
mds
Message:

add /etc/sysconfig/lm_sensors generation - patch from

mike808 <mike808@…>

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/prog/detect/sensors-detect

    r1410 r1416  
    29942994  print "#----cut here----\n"; 
    29952995   
     2996  print "\nDo you want to generate /etc/sysconfig/lm_sensors? (YES/no): "; 
     2997  if ($> != 0) { 
     2998    print "\nAs you are not root, we shall skip this step.\n"; 
     2999  } else { 
     3000    if (not <STDIN> =~ /^\s*[Nn]/) { 
     3001      open(SYSCONFIG, ">/etc/sysconfig/lm_sensors") 
     3002        or die "Sorry, can't create /etc/sysconfig/lm_sensors ($!)?!?"; 
     3003      print SYSCONFIG <<'EOT'; 
     3004#    /etc/sysconfig/sensors - Defines modules loaded by /etc/rc.d/init.d/lm_sensors 
     3005#    Copyright (c) 1998 - 2001  Frodo Looijaard <frodol@dds.nl> 
     3006# 
     3007#    This program is free software; you can redistribute it and/or modify 
     3008#    it under the terms of the GNU General Public License as published by 
     3009#    the Free Software Foundation; either version 2 of the License, or 
     3010#    (at your option) any later version. 
     3011# 
     3012#    This program is distributed in the hope that it will be useful, 
     3013#    but WITHOUT ANY WARRANTY; without even the implied warranty of 
     3014#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     3015#    GNU General Public License for more details. 
     3016# 
     3017#    You should have received a copy of the GNU General Public License 
     3018#    along with this program; if not, write to the Free Software 
     3019#    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
     3020# 
     3021# 
     3022# See also the lm_sensors homepage at: 
     3023#     http://www2.lm-sensors.nu/~lm78/index.html 
     3024# 
     3025# This file is used by /etc/rc.d/init.d/lm_sensors and defines the modules to 
     3026# be loaded/unloaded. This file is sourced into /etc/rc.d/init.d/lm_sensors. 
     3027# 
     3028# The format of this file is a shell script that simply defines the modules 
     3029# in order as normal variables with the special names: 
     3030#    MODULE_1, MODULE_2, MODULE_3, etc. 
     3031# 
     3032# List the modules that are to be loaded for your system 
     3033# 
     3034EOT 
     3035      print SYSCONFIG 
     3036       "# Generated by sensors-detect on " . scalar localtime . "\n"; 
     3037      my @modules = grep /^modprobe /, split "\n", $modprobes; 
     3038      my $i = 1; 
     3039      my $sysconfig = ""; 
     3040      foreach (@modules) { 
     3041        s/^modprobe //; 
     3042        $sysconfig .= "MODULE_$i=$_\n"; 
     3043        $i++; 
     3044      } 
     3045      print SYSCONFIG $sysconfig; 
     3046      close(SYSCONFIG); 
     3047      print "Copy prog/init/lm_sensors.init to /etc/rc.d/init.d/lm_sensors\n"; 
     3048      print "for initialization at boot time.\n"; 
     3049    } 
     3050  } 
    29963051} 
    29973052