# conditional build
# _without_dist_kernel without kernel for distributions
-# TODO: init script for loading sensors modules and sensord
-
%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 smpstr %{?_with_smp:-smp}
Summary(pl): Monitor stanu sprzĂȘtu
Name: lm_sensors
Version: 2.6.2
-Release: 1
+Release: 2
License: GPL
Group: Applications/System
Group(de): Applikationen/System
Group(pl): Aplikacje/System
Source0: http://www.netroedge.com/~lm78/archive/%{name}-%{version}.tar.gz
+Source1: sensors.init
+Source2: sensors.sysconfig
Patch0: %{name}-make.patch
URL: http://www.netroedge.com/~lm78/
BuildRequires: flex >= 2.5.1
BuildRequires: bison
BuildRequires: i2c-devel >= 2.6.0
+PreReq: /sbin/chkconfig
Requires: %{name}-modules = %{version}
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
install prog/sensord/sensord $RPM_BUILD_ROOT%{_sbindir}
install prog/sensord/sensord.8 $RPM_BUILD_ROOT%{_mandir}/man8
+install -d $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig}
+install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/sensors
+install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/sensors
+
gzip -9nf BACKGROUND BUGS CHANGES README README.thinkpad TODO
find doc -type f ! -name \*.\* -a ! -name \*ticket | xargs gzip -9nf
%clean
rm -rf $RPM_BUILD_ROOT
-%post -p /sbin/ldconfig
-%postun -p /sbin/ldconfig
+%post
+/sbin/ldconfig
+/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."
+ echo "Please edit /etc/sysconfig/sensors file according to your hardware."
+ echo
+ echo "Run \"/etc/rc.d/init.d/sensors start\" to start sensors daemon." >&2
+fi
+
+%preun
+if [ "$1" = "0" ]; then
+ if [ -f /var/lock/subsys/sensors ]; then
+ /etc/rc.d/init.d/sensors stop >&2
+ fi
+ /sbin/chkconfig --del sensors
+fi
+
+%postun
+/sbin/ldconfig
%post -n kernel%{smpstr}-misc-lm_sensors
/sbin/depmod -a
%doc doc/*.gz doc/*.html doc/busses doc/chips
%attr(755,root,root) %{_bindir}/sensors
%attr(755,root,root) %{_sbindir}/sensors-detect
-%attr(755,root,root) %{_sbindir}/sensord
+%attr(754,root,root) %{_sbindir}/sensord
+%attr(754,root,root) /etc/rc.d/init.d/sensors
%attr(755,root,root) %{_libdir}/lib*.so.*.*
%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/sensors.conf
+%config(noreplace) %verify(not size mtime md5) /etc/sysconfig/sensors
%{_mandir}/man1/*
%{_mandir}/man5/*
+%{_mandir}/man8/*
%files devel
%defattr(644,root,root,755)
%doc doc/developers doc/kernel
-%defattr(644,root,root,755)
%attr(755,root,root) %{_libdir}/lib*.so
%{_includedir}/sensors
%{_includedir}/linux/*