File lm_sensors-r5760-rename-modprobe-conf.patch of Package sensors

Upstream commit: http://www.lm-sensors.org/changeset/5760

Recent versions of module-init-tools only want *.conf files under
/etc/modprobe.d. So rename our configuration file to lm_sensors.conf
there. Also let "make install" rename the file if it already exists.

--- lm_sensors-3.1.1.orig/Makefile
+++ lm_sensors-3.1.1/Makefile
@@ -118,6 +118,7 @@ SRCDIRS += lib/test
 MKDIR := mkdir -p
 RMDIR := rmdir
 RM := rm -f
+MV := mv -f
 BISON := bison
 FLEX := flex
 AR := ar
--- lm_sensors-3.1.1.orig/etc/Module.mk
+++ lm_sensors-3.1.1/etc/Module.mk
@@ -28,6 +28,10 @@ install-etc:
 	fi
 	$(MKDIR) $(DESTDIR)$(BINDIR)
 	$(INSTALL) -m 755 $(ETC_DIR)/sensors-conf-convert $(DESTDIR)$(BINDIR)
+	if [ -e $(DESTDIR)$(ETCDIR)/modprobe.d/lm_sensors \
+	     -a ! -e $(DESTDIR)$(ETCDIR)/modprobe.d/lm_sensors.conf ] ; then \
+	  $(MV) $(DESTDIR)$(ETCDIR)/modprobe.d/lm_sensors $(DESTDIR)$(ETCDIR)/modprobe.d/lm_sensors.conf ; \
+	fi
 
 user_install :: install-etc
 
--- lm_sensors-3.1.1.orig/prog/detect/sensors-detect
+++ lm_sensors-3.1.1/prog/detect/sensors-detect
@@ -5430,8 +5430,8 @@ sub write_config
 
 	if (defined $configfile) {
 		my $have_modprobe_d = -d '/etc/modprobe.d';
-		printf "Do you want to \%s /etc/modprobe.d/lm_sensors? (\%s): ",
-		       (-e '/etc/modprobe.d/lm_sensors' ? 'overwrite' : 'generate'),
+		printf "Do you want to \%s /etc/modprobe.d/lm_sensors.conf? (\%s): ",
+		       (-e '/etc/modprobe.d/lm_sensors.conf' ? 'overwrite' : 'generate'),
 		       ($have_modprobe_d ? 'YES/no' : 'yes/NO');
 		$_ = <STDIN>;
 		if (($have_modprobe_d and not m/^\s*n/i) or m/^\s*y/i) {
@@ -5439,8 +5439,8 @@ sub write_config
 				mkdir('/etc/modprobe.d', 0777)
 					or die "Sorry, can't create /etc/modprobe.d ($!)";
 			}
-			open(local *MODPROBE_D, ">/etc/modprobe.d/lm_sensors")
-				or die "Sorry, can't create /etc/modprobe.d/lm_sensors ($!)";
+			open(local *MODPROBE_D, ">/etc/modprobe.d/lm_sensors.conf")
+				or die "Sorry, can't create /etc/modprobe.d/lm_sensors.conf ($!)";
 			print MODPROBE_D "# Generated by sensors-detect on " . scalar localtime() . "\n";
 			print MODPROBE_D $configfile;
 			close(MODPROBE_D);
openSUSE Build Service is sponsored by