-# conditional build
-# _without_dist_kernel without kernel for distributions
+# TODO
+# - unpackaged:
+# /usr/sbin/fancontrol.pl (isn't that the same as sh fancontrol script?)
+# - a big trigger warning how to use fancontrol and to init it first
#
-%include /usr/lib/rpm/macros.perl
-
-%define _kernel_ver %(grep UTS_RELEASE %{_kernelsrcdir}/include/linux/version.h 2>/dev/null | cut -d'"' -f2)
-%define _kernel_ver_str %(echo %{_kernel_ver} | sed s/-/_/g)
+%define cmodule %{_sysconfdir}/sysconfig/sensors_modules
+%define cdaemon %{_sysconfdir}/sysconfig/sensors
+%define smodule %{_sysconfdir}/rc.d/init.d/sensors_modules
+%define sdaemon %{_sysconfdir}/rc.d/init.d/sensors
+%include /usr/lib/rpm/macros.perl
Summary: Hardware health monitoring
Summary(pl): Monitor stanu sprzêtu
Summary(pt_BR): Ferramentas para monitoração do hardware
Summary(ru): õÔÉÌÉÔÙ ÄÌÑ ÍÏÎÉÔÏÒÉÎÇÁ ÁÐÐÁÒÁÔÕÒÙ
Summary(uk): õÔÉ̦ÔÉ ÄÌÑ ÍÏΦÔÏÒÉÎÇÕ ÁÐÁÒÁÔÕÒÉ
Name: lm_sensors
-Version: 2.6.4
-%define _rel 6
-Release: %{_rel}
+Version: 2.10.1
+Release: 2
License: GPL
Group: Applications/System
-Source0: http://secure.netroedge.com/~lm78/archive/%{name}-%{version}.tar.gz
+Source0: http://dl.lm-sensors.org/lm-sensors/releases/%{name}-%{version}.tar.gz
+# Source0-md5: cdc857b78e813b88cbf8be92441aa299
Source1: sensors.init
Source2: sensors.sysconfig
+Source3: fancontrol.init
+Source4: fancontrol.sysconfig
+Source5: sensors.sh
+Source6: sensors_modules.init
+Source7: sensors_modules.sysconfig
Patch0: %{name}-make.patch
Patch1: %{name}-ppc.patch
+Patch2: %{name}-iconv-in-libc.patch
+Patch3: %{name}-sensors-detect-PATH.patch
URL: http://www.lm-sensors.nu/
BuildRequires: bison
BuildRequires: flex >= 2.5.1
BuildRequires: perl-modules >= 5.6
BuildRequires: rpm-perlprov >= 3.0.3-16
-BuildRequires: rrdtool-devel
-%{!?_without_dist_kernel:BuildRequires: i2c-devel >= 2.6.0}
-PreReq: /sbin/chkconfig
-PreReq: /sbin/ldconfig
+BuildRequires: rpmbuild(macros) >= 1.268
+BuildRequires: rrdtool-devel >= 1.2.10
+BuildRequires: sysfsutils-devel
+Requires: %{name}-libs = %{version}-%{release}
+Requires: dev >= 2.9.0-13
+Requires: dmidecode
+Requires: %{name}-config
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-Obsoletes: liblm_sensors1
-
-%define _kernel24 %(echo %{_kernel_ver} | grep -q '2\.[012]\.' ; echo $?)
%description
Tools for monitoring the hardware health of Linux systems containing
hardware health monitoring hardware such as the LM78 and LM75.
%description -l pl
-Narzêdzie do monitorowania sprzêtu w systemach Linuksowych
+Narzêdzie do monitorowania sprzêtu w systemach linuksowych
wyposa¿onych w sprzêt monitoruj±cy, taki jak LM78 lub LM75.
%description -l pt_BR
%description -l ru
ðÁËÅÔ lm_sensors ÓÏÄÅÒÖÉÔ ÎÁÂÏÒ ÍÏÄÕÌÅÊ ÄÌÑ ÓÔÁÎÄÁÒÔÎÏÇÏ ÄÏÓÔÕÐÁ Ë
SMBus É ÍÏÎÉÔÏÒÉÎÇÁ. ÷îéíáîéå: ÄÌÑ ÜÔÏÇÏ ÎÅÏÂÈÏÄÉÍÁ ÓÐÅÃÉÁÌØÎÁÑ
-ÐÏÄÄÅÒÖËÁ, ÏÔÓÕÔÓÔ×ÕÀÝÁÑ × ÓÔÁÎÄÁÒÔÎÙÈ ÓÔÁÒÙÈ ÑÄÒÁÈ 2.2.XX !
+ÐÏÄÄÅÒÖËÁ, ÏÔÓÕÔÓÔ×ÕÀÝÁÑ × ÓÔÁÎÄÁÒÔÎÙÈ ÓÔÁÒÙÈ ÑÄÒÁÈ 2.2.XX!
%description -l uk
ðÁËÅÔ lm_sensors ͦÓÔÉÔØ ÎÁÂ¦Ò ÍÏÄÕÌ¦× ÄÌÑ ÓÔÁÎÄÁÒÔÎÏÇÏ ÄÏÓÔÕÐÕ ÄÏ
SMBus ÔÁ ÍÏΦÔÏÒÉÎÇÕ. õ÷áçá: ÄÌÑ ÃØÏÇÏ ÐÏÔÒ¦ÂÎÁ ÓÐÅæÁÌØÎÁ ЦÄÔÒÉÍËÁ,
-ÑËÁ צÄÓÕÔÎÑ Õ ÓÔÁÎÄÁÒÔÎÉÈ ÓÔÁÒÉÈ ÑÄÒÁÈ 2.2.XX !
+ÑËÁ צÄÓÕÔÎÑ Õ ÓÔÁÎÄÁÒÔÎÉÈ ÓÔÁÒÉÈ ÑÄÒÁÈ 2.2.XX!
-%package sensord
-Summary: Sensord daemon
-Summary(pl): Demon sensord
-Group: Daemon
-Requires: %{name} = %{version}
+%package libs
+Summary: lm_sensors library
+Summary(pl): Biblioteka lm_sensors
+Group: Libraries
+Obsoletes: liblm_sensors1
+Conflicts: lm_sensors <= 2.9.2-2
-%description sensord
-Sensord daemon.
+%description libs
+lm_sensors library.
-%description sensord -l pl
-Demon sensord.
+%description libs -l pl
+Biblioteka lm_sensors.
%package devel
Summary: Header files for lm_sensors
Summary(ru): æÁÊÌÙ ÒÁÚÒÁÂÏÔÞÉËÁ ÄÌÑ ÐÒÏÇÒÁÍÍ, ÉÓÐÏÌØÚÕÀÝÉÈ lm_sensors
Summary(uk): æÁÊÌÉ ÐÒÏÇÒÁͦÓÔÁ ÄÌÑ ÐÒÏÇÒÁÍ, Ñ˦ ×ÉËÏÒÉÓÔÏ×ÕÀÔØ lm_sensors
Group: Development/Libraries
-Requires: %{name} = %{version}
+Requires: %{name}-libs = %{version}-%{release}
Obsoletes: liblm_sensors1-devel
%description devel
Summary(ru): óÔÁÔÉÞÅÓËÁÑ ÂÉÂÌÉÏÔÅËÁ ÄÌÑ ÐÒÏÇÒÁÍÍ, ÉÓÐÏÌØÚÕÀÝÉÈ lm_sensors
Summary(uk): óÔÁÔÉÞÎÁ ¦Â̦ÏÔÅËÁ ÄÌÑ ÐÒÏÇÒÁÍ, Ñ˦ ×ÉËÏÒÉÓÔÏ×ÕÀÔØ lm_sensors
Group: Development/Libraries
-Requires: %{name}-devel = %{version}
+Requires: %{name}-devel = %{version}-%{release}
%description static
Static libraries for lm_sensors.
ðÁËÅÔ lm_sensors-static ͦÓÔÉÔØ ÓÔÁÔÉÞΦ ¦Â̦ÏÔÅËÉ, ÎÅÏÂȦÄΦ ÄÌÑ
ÐÏÂÕÄÏ×É ÐÒÏÇÒÁÍ, Ñ˦ ×ÉËÏÒÉÓÔÏ×ÕÀÔØ ÄÁΦ ÓÅÎÓÏÒ¦×.
-%package -n kernel-misc-%{name}
-Summary: Kernel modules for various buses and monitor chips
-Summary(pl): Modu³y j±dra dla ró¿nego rodzaju sensorów
+%package config-default
+Summary: Sensors configuration files
+Summary(pl): Pliki konfiguracyjne lm_sensors
Group: Applications/System
-Release: %{_rel}@%{_kernel_ver_str}
-Prereq: /sbin/depmod
-%{!?_without_dist_kernel:%requires_releq_kernel_up}
-%{!?_without_dist_kernel:Requires: i2c >= 2.6.0}
-Provides: %{name}-modules = %{version}
-Obsoletes: %{name}-modules
-
-%description -n kernel-misc-%{name}
-Kernel modules for various buses and monitor chips.
-
-%description -n kernel-misc-%{name} -l pl
-Modu³y j±dra dla ró¿nego rodzaju sensorów monitoruj±cych.
-
-%package -n kernel-smp-misc-%{name}
-Summary: Kernel modules for various buses and monitor chips
-Summary(pl): Modu³y j±dra dla ró¿nego rodzaju sensorów
-Group: Applications/System
-Release: %{_rel}@%{_kernel_ver_str}
-Prereq: /sbin/depmod
-%{!?_without_dist_kernel:%requires_releq_kernel_smp}
-%{!?_without_dist_kernel:Requires: i2c >= 2.6.0}
-Provides: %{name}-modules = %{version}
-Obsoletes: %{name}-modules
+Requires: %{name} = %{version}-%{release}
+Provides: %{name}-config
-%description -n kernel-smp-misc-%{name}
-Kernel SMP modules for various buses and monitor chips.
+%description config-default
+Default configuration files for lm_sensors.
-%description -n kernel-smp-misc-%{name} -l pl
-Modu³y j±dra SMP dla ró¿nego rodzaju sensorów monitoruj±cych.
+%package sensord
+Summary: Sensord daemon
+Summary(pl): Demon sensord
+Group: Daemons
+Requires(post,preun): /sbin/chkconfig
+Requires: %{name} = %{version}-%{release}
+Requires: %{name}-config
+Requires: rc-scripts
+
+%description sensord
+Sensord daemon.
+
+%description sensord -l pl
+Demon sensord.
+
+%package fancontrol
+Summary: Fancontrol daemon
+Summary(pl): Demon sterowania wiatraczkami
+Group: Daemons
+Requires(post,preun): /sbin/chkconfig
+Requires: %{name} = %{version}-%{release}
+Requires: %{name}-sensord = %{version}-%{release}
+Requires: rc-scripts
+
+%description fancontrol
+Fancontrol daemon monitors current temperature of the computer and
+adjusts fans speed acordingly.
+
+It is crucial to correctly configure this daemon (via running service
+fancontrol init) and ensuring, that the temperature levels are set not
+to burn the insides of the computer!
+
+%description fancontrol -l pl
+Demon fancontrol monitoruje obecn± temperaturê komputera i ustawia
+odpowiednio prêdko¶æ wiatraków.
+
+Kluczowym jest, aby poprawnie skonfigurowaæ tego demona (poprzez
+uruchomienie service fancontrol init) oraz upewniæ siê, ¿e progi
+temperatury s± ustawione poprawnie, by nie spaliæ wnêtrza komputera!
%prep
%setup -q
%patch0 -p1
%patch1 -p1
+%patch2 -p1
+%patch3 -p1
%build
-#up
-%{__make} \
+%{__make} user \
+ CC="%{__cc}" \
OPTS="%{rpmcflags}" \
+ LIBDIR=%{_libdir} \
LINUX=/dev/null \
LINUX_HEADERS=%{_kernelsrcdir}/include \
- I2C_HEADERS=%{_kernelsrcdir}/include \
- SMP=0
-
-%{__make} install-kernel \
- MODDIR=kernel-up-modules
-%{__make} install-kernel-busses \
- MODPREF=kernel-up-modules
-%{__make} install-kernel-chips \
- MODPREF=kernel-up-modules
-
-%{__make} clean
-
-#smp
-%{__make} \
- OPTS="%{rpmcflags} -D__KERNEL_SMP=1" \
- LINUX=/dev/null \
- LINUX_HEADERS=%{_kernelsrcdir}/include \
- I2C_HEADERS=%{_kernelsrcdir}/include \
- PROG_EXTRA:="sensord dump" \
- SMP=1
+ I2C_HEADERS=/usr/include \
+ PROG_EXTRA:="sensord" \
+ SYSFS_SUPPORT:=1
-cd prog/eepromer
-%{__make}
+%{__make} -C prog/eepromer \
+ CC="%{__cc}" \
+ CFLAGS="%{rpmcflags} -I../../kernel/include"
%install
rm -rf $RPM_BUILD_ROOT
+
install -d $RPM_BUILD_ROOT{%{_sbindir},%{_mandir}/man8} \
- $RPM_BUILD_ROOT{/etc/{rc.d/init.d,sysconfig},/lib/modules/%{_kernel_ver}/misc}
+ $RPM_BUILD_ROOT%{_sysconfdir}/{rc.d/init.d,sysconfig}
-%{__make} install \
+%{__make} user_install \
DESTDIR=$RPM_BUILD_ROOT \
PREFIX=%{_prefix} \
ETCDIR=%{_sysconfdir} \
+ LIBDIR=%{_libdir} \
MANDIR=%{_mandir} \
- PROG_EXTRA:="sensord dump" \
- MODDIR=/lib/modules/%{_kernel_ver}smp/misc \
- MODPREF=/lib/modules/%{_kernel_ver}smp
+ PROG_EXTRA:="sensord" \
+ LINUX=/dev/null \
+ LINUX_HEADERS=%{_kernelsrcdir}/include \
+ I2C_HEADERS=/usr/include
install prog/eepromer/{eeprom,eepromer} $RPM_BUILD_ROOT%{_sbindir}
-install prog/dump/{i2c{dump,set},isadump} $RPM_BUILD_ROOT%{_sbindir}
-install prog/detect/i2cdetect $RPM_BUILD_ROOT%{_sbindir}
-install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/sensors
-install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/sensors
+install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/sensors
+install %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/sensors
+install %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/fancontrol
+install %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/fancontrol
+install %{SOURCE5} $RPM_BUILD_ROOT%{_bindir}
+install %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/sensors_modules
+install %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/sensors_modules
-install kernel-up-modules/misc/* $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc
+# i2c API for userspace - included in glibc-kernel-headers
+rm -f $RPM_BUILD_ROOT%{_includedir}/linux/i2c-dev.h
%clean
rm -rf $RPM_BUILD_ROOT
-%post -p /sbin/ldconfig
+%post libs -p /sbin/ldconfig
+%postun libs -p /sbin/ldconfig
-%post sensord
-/sbin/chkconfig --add sensors
-if [ -f /var/lock/subsys/sensors ]; then
- /etc/rc.d/init.d/sensors restart >&2
-else
- echo "You have to configure sensors modules in /etc/sysconfig/sensors"
- echo
- echo "Run \"/etc/rc.d/init.d/sensors start\" to start sensors daemon." >&2
+%post
+if [ -f "%{cmodule}" ]; then
+ /sbin/chkconfig --add sensors_modules
+ %service sensors_modules restart "sensors modules"
+ if [ -f "%{sdaemon}" ]; then
+ /sbin/chkconfig --add sensors
+ %service sensors restart "sensors deamon"
+ fi
fi
-%preun sensord
+%preun
if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/sensors ]; then
- /etc/rc.d/init.d/sensors stop >&2
+ if [ -f "%{sdaemon}" ]; then
+ %service sensors stop
+ /sbin/chkconfig --del sensors
fi
- /sbin/chkconfig --del sensors
+ %service sensors_modules stop
+ /sbin/chkconfig --del sensors_modules
+fi
+
+%post config-default
+if [ "$1" = 1 ]; then
+cat << EOF
+ *********************************************************************
+ * *
+ * NOTE: *
+ * You have to configure sensors to match your motherboard sensors *
+ * in /etc/sensors.conf and /etc/sysconfig/sensors_modules. Use *
+ * sensors-detect script which can help you find proper modules. *
+ * *
+ *********************************************************************
+EOF
+fi
+if [ -f "%{smodule}" ]; then
+ /sbin/chkconfig --add sensors_modules
+ %service sensors_modules restart "sensors modules"
+fi
+if [ -f "%{sdaemon}" ]; then
+ /sbin/chkconfig --add sensors
+ %service sensors restart "sensors daemon"
fi
-%postun -p /sbin/ldconfig
+%preun config-default
+if [ "$1" = "0" ]; then
+ if [ -f "%{sdaemon}" ]; then
+ %service sensors stop
+ /sbin/chkconfig --del sensors
+ fi
+ if [ -f "%{smodule}" ]; then
+ %service sensors_modules stop
+ /sbin/chkconfig --del sensors_modules
+ fi
+fi
-%post -n kernel-misc-%{name}
-/sbin/depmod -a
+%post sensord
+if [ -f "%{cmodule}" ]; then
+ /sbin/chkconfig --add sensors
+ %service sensors restart "sensors daemon"
+fi
-%post -n kernel-smp-misc-%{name}
-/sbin/depmod -a
+%preun sensord
+if [ "$1" = "0" ]; then
+ %service sensors stop
+ /sbin/chkconfig --del sensors
+fi
-%postun -n kernel-misc-%{name}
-/sbin/depmod -a
+%post fancontrol
+if [ "$1" = 1 ]; then
+ echo "You have to configure fancontrol by running service fancontrol init first."
+fi
+/sbin/chkconfig --add fancontrol
+%service fancontrol restart "fancontrol daemon"
-%postun -n kernel-smp-misc-%{name}
-/sbin/depmod -a
+%preun fancontrol
+if [ "$1" = "0" ]; then
+ %service fancontrol stop
+ /sbin/chkconfig --del fancontrol
+fi
%files
%defattr(644,root,root,755)
%doc BACKGROUND BUGS CHANGES README README.thinkpad TODO doc/{busses,chips}
%doc doc/{FAQ,donations,fan-divisors,progs,temperature-sensors,*html,vid}
-%doc prog/{config,daemon,eeprom,eepromer/README*,matorb,maxilife,xeon}
+%doc prog/{config,daemon,eepromer/README*,matorb,maxilife}
+%attr(755,root,root) %{_bindir}/ddcmon
+%attr(755,root,root) %{_bindir}/decode-*.pl
%attr(755,root,root) %{_bindir}/sensors
-%attr(755,root,root) %{_sbindir}/sensors-detect
-%if %{_kernel24}
-%attr(755,root,root) %{_sbindir}/dmidecode
-%endif
+%attr(755,root,root) %{_bindir}/sensors.sh
%attr(755,root,root) %{_sbindir}/eeprom*
%attr(755,root,root) %{_sbindir}/i2c*
+%attr(755,root,root) %{_sbindir}/sensors-detect
+%ifarch %{ix86} %{x8664}
%attr(755,root,root) %{_sbindir}/isadump
-%attr(755,root,root) %{_libdir}/lib*.so.*.*
-%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/sensors.conf
-%{_mandir}/man1/*
-%{_mandir}/man5/*
+%attr(755,root,root) %{_sbindir}/isaset
+%attr(754,root,root) %{_sysconfdir}/rc.d/init.d/sensors_modules
+%{_mandir}/man8/isadump.8*
+%{_mandir}/man8/isaset.8*
+%endif
+%{_mandir}/man1/sensors.1*
+%{_mandir}/man5/sensors.conf.5*
+%{_mandir}/man8/i2c*.8*
-%files sensord
+%files config-default
%defattr(644,root,root,755)
-%attr(754,root,root) %{_sbindir}/sensord
-%attr(754,root,root) /etc/rc.d/init.d/sensors
-%config(noreplace) %verify(not size mtime md5) /etc/sysconfig/sensors
-%{_mandir}/man8/*
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/sensors.conf
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/sysconfig/sensors_modules
+
+%files libs
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/lib*.so.*.*
%files devel
%defattr(644,root,root,755)
%doc doc/{developers,kernel}
%attr(755,root,root) %{_libdir}/lib*.so
%{_includedir}/sensors
-%{_includedir}/linux/*
+%{_includedir}/linux/sensors.h
%{_mandir}/man3/*
%files static
%defattr(644,root,root,755)
%{_libdir}/libsensors.a
-%files -n kernel-misc-%{name}
+%files sensord
%defattr(644,root,root,755)
-/lib/modules/%{_kernel_ver}/misc/*
+%attr(754,root,root) %{_sbindir}/sensord
+%attr(754,root,root) %{_sysconfdir}/rc.d/init.d/sensors
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/sysconfig/sensors
+%{_mandir}/man8/sensors-detect.8*
+%{_mandir}/man8/sensord.8*
-%files -n kernel-smp-misc-%{name}
+%files fancontrol
%defattr(644,root,root,755)
-/lib/modules/%{_kernel_ver}smp/misc/*
+%attr(755,root,root) %{_sbindir}/fancontrol
+%attr(755,root,root) %{_sbindir}/pwmconfig
+%attr(754,root,root) %{_sysconfdir}/rc.d/init.d/fancontrol
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/sysconfig/fancontrol
+%{_mandir}/man8/fancontrol.8*
+%{_mandir}/man8/pwmconfig.8*