--- prog/detect/sensors-detect 2004-06-11 19:47:13.000000000 +0100 +++ prog/detect/sensors-detect-2.8.7 2004-07-12 15:44:13.715998584 +0100 @@ -26,6 +26,14 @@ # each be put in a separate file, using modules and packages. That is beyond # me. +# Changelog +# 02/Mar/2003, Rudo Thomas +# * a few small changes in config file output to reflect Gentoo Linux layout +# - /etc/sysconfig -> /etc/conf.d +# - /etc/rc.d/init.d -> /etc/init.d +# - added a warning to the generated config file +# - small change when asking about writing the new config file + require 5.004; use strict; @@ -4803,39 +4811,44 @@ my $use_isa = not =~ /\s*[Ss]/; my ($modprobes,$configfile) = generate_modprobes $use_isa; + print "\nIf you want to load the modules at startup, generate a config file\n", + "below and make sure lm_sensors gets started; e.g\n", + "\$ rc-update add lm_sensors default.\n"; print "\nTo make the sensors modules behave correctly, add these lines to\n", - "$modules_conf:\n\n"; + "/etc/modules.conf:\n\n"; print "#----cut here----\n"; print $configfile; - print "#----cut here----\n"; - print "\nTo load everything that is needed, add this to some /etc/rc* ", - "file:\n\n"; - print "#----cut here----\n"; - print $modprobes; - print "# sleep 2 # optional\n", - "/usr/local/bin/sensors -s # recommended\n"; - print "#----cut here----\n"; + print "#----end cut here----\n"; print "\nWARNING! If you have some things built into your kernel, the list above\n", "will contain too many modules. Skip the appropriate ones! You really should\n", "try these commands right now to make sure everything is working properly.\n", "Monitoring programs won't work until it's done.\n"; - - my $have_sysconfig = -d '/etc/sysconfig'; - print "\nDo you want to generate /etc/sysconfig/lm_sensors? (". - ($have_sysconfig?"YES/no":"yes/NO")."): "; - if ($> != 0) { - print "\nAs you are not root, we shall skip this step.\n"; - } else { - $_ = ; - if (($have_sysconfig and not m/^\s*[Nn]/) or m/^\s*[Yy]/) { - unless ($have_sysconfig) { - mkdir '/etc/sysconfig', 0777 - or die "Sorry, can't create /etc/sysconfig ($!)?!?"; - } - 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 + + print "To load everything that is needed, execute the commands above..."; + + print "\n\n#----cut here----\n"; + print $modprobes; + print "# sleep 2 # optional\n", + "/usr/bin/sensors -s # recommended\n"; + + my $have_config = -f '/etc/conf.d/lm_sensors'; + print "\nDo you want to ".($have_config?"overwrite":"generate"). + " /etc/conf.d/lm_sensors? Enter s to specify other file name?\n", + " (".($have_config?"yes/NO":"YES/no")."/s): "; + my $reply = ; + + if (($have_config and $reply =~ /^\s*[Yy]/) or + (not $have_config and not $reply =~ /^\s*[Nn]/) or + $reply =~ /^\s*[Ss]/) { + my $filename = "/etc/conf.d/lm_sensors"; + if ($reply =~ /^\s*[Ss]/) { + print "Specify the file to store the configuration to: "; + $filename = ; + } + open(SYSCONFIG, ">".$filename) + or die "Sorry, can't create $filename ($!)."; + print SYSCONFIG <<'EOT'; +# /etc/conf.d/sensors - Defines modules loaded by /etc/init.d/lm_sensors # Copyright (c) 1998 - 2001 Frodo Looijaard # # This program is free software; you can redistribute it and/or modify @@ -4856,13 +4869,17 @@ # 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. +# This file is used by /etc/init.d/lm_sensors and defines the modules to +# be loaded/unloaded. This file is sourced into /etc/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_0, MODULE_1, MODULE_2, etc. # +# Please note that the numbers in MODULE_X must start at 0 and increase in +# steps of 1. Any number that is missing will make the init script skip the +# rest of the modules. Use MODULE_X_ARGS for arguments. +# # List the modules that are to be loaded for your system # EOT @@ -4878,9 +4895,7 @@ } 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"; - } + print "Done.\n"; } }