From 2fa8b784cd6f53622c75bdf1e24e4f41217040ff Mon Sep 17 00:00:00 2001 From: Xuchun Shang Date: Fri, 14 Apr 2023 11:20:14 +0800 Subject: [PATCH] Optimize the spec Signed-off-by: Xuchun Shang --- lm_sensors.spec | 143 ++++++++++++++++++++++++------------------------ 1 file changed, 70 insertions(+), 73 deletions(-) diff --git a/lm_sensors.spec b/lm_sensors.spec index 22f9ef4..282cf58 100644 --- a/lm_sensors.spec +++ b/lm_sensors.spec @@ -1,4 +1,4 @@ -%define anolis_release 3 +%define anolis_release 4 %define upstream_version %(echo %{version} | sed -e 's/\\./-/g') Name: lm_sensors @@ -10,7 +10,6 @@ URL: http://github.com/lm-sensors/lm-sensors/ Source0: https://github.com/lm-sensors/lm-sensors/archive/V%{upstream_version}/lm-sensors-%{upstream_version}.tar.gz Source1: lm_sensors.sysconfig -# This one was taken from PLD-linux, Thanks! Source2: sensord.sysconfig Source3: lm_sensors-modprobe-wrapper Source4: lm_sensors-modprobe-r-wrapper @@ -19,40 +18,43 @@ Source6: sensord-service-wrapper Source7: lm_sensors.service Source8: lm_sensors-wrapper -# Downstream-only: Patch0: 0001-Revert-unnecessary-soname-bump.patch -# Upstream patch: Patch1: 0001-Change-PIDFile-path-from-var-run-to-run.patch Patch2: lm_sensors-3.6.0-allow_no_sensors.patch -# Upstream commit 5deee7d0c301df779: Patch3: lm_sensors-3.6.0-sensors-detect-Add-support-for-AMD-CPU-Family-19h.patch Requires: /usr/sbin/modprobe %ifarch x86_64 Requires: /usr/sbin/dmidecode %endif -Requires: %{name}-libs = %{version}-%{release} +Requires: lm_sensors-libs = %{version}-%{release} Requires(post): systemd-units -BuildRequires: kernel-headers >= 2.2.16, bison, flex, gawk -BuildRequires: perl-generators +BuildRequires: gcc make BuildRequires: rrdtool-devel -BuildRequires: gcc -BuildRequires: make +BuildRequires: perl-generators +BuildRequires: kernel-headers >= 2.2.16, bison, flex, gawk %description -The lm_sensors package includes a collection of modules for general SMBus -access and hardware monitoring. - - -%package doc -Summary: Documentation files for %{name} -Requires: %{name} = %{version}-%{release} -BuildArch: noarch - -%description doc -The %{name}-doc package contains documentation files for %{name}. +lm_sensors is a free and open-source software tool that is used to monitor +the hardware health of a computer system. It is developed to work with Linux +operating systems and provides information about the system’s temperatures, +fan speeds, and voltage levels. The tool can be installed in any Linux distribu +tion and is compatible with a wide range of hardware sensors. + +The lm_sensors tool interacts with the hardware sensors through the kernel +modules that are responsible for detecting and monitoring the sensors. The +modules communicate with the sensors and provide the information to lm_senso +rs, which then interprets the data and displays it to the user in a readable +format. The tool can be customized to display the information in different +formats, such as text, graph, or chart. + +The lm_sensors tool can also be configured to trigger alerts when the system’s +hardware reaches critical levels. For example, it can be configured to send an +email or a notification when the system’s temperature exceeds a certain +threshold. This feature is particularly useful for server administrators who +need to monitor their systems’ health continuously. %package libs Summary: Lm_sensors core libraries @@ -64,7 +66,7 @@ Core libraries for lm_sensors applications %package devel Summary: Development files for programs which will use lm_sensors -Requires: %{name}-libs = %{version}-%{release} +Requires: lm_sensors-libs = %{version}-%{release} # One manual page is licensed Verbatim (lib/libsensors.3). The rest is LGPLv2+. License: LGPLv2+ and Verbatim @@ -75,8 +77,8 @@ when building applications that make use of sensor data. %package sensord Summary: Daemon that periodically logs sensor readings -Requires: %{name} = %{version}-%{release} -Requires: %{name}-libs = %{version}-%{release} +Requires: lm_sensors = %{version}-%{release} +Requires: lm_sensors-libs = %{version}-%{release} # One man page is licensed Verbatim (prog/sensord/sensord.8). Files from # dist-git are licensed MIT according to the FPCA. The rest is GPLv2+. License: GPLv2+ and Verbatim and MIT @@ -85,21 +87,27 @@ License: GPLv2+ and Verbatim and MIT Daemon that periodically logs sensor readings to syslog or a round-robin database, and warns of sensor alarms. +%package doc +Summary: Documentation files for lm_sensors +Requires: lm_sensors = %{version}-%{release} +BuildArch: noarch + +%description doc +The lm_sensors-doc package contains documentation files for lm_sensors. + %prep %autosetup -n lm-sensors-%{upstream_version} -p1 -# Remove currently unused files to make sure we've got the license right rm -f prog/init/sysconfig-lm_sensors-convert prog/hotplug/unhide_ICH_SMBus mv prog/init/README prog/init/README.initscripts chmod -x prog/init/fancontrol.init -# fixing the sensord-service-wrapper path cp -p %{SOURCE5} sensord.service cp -p %{SOURCE7} lm_sensors.service -sed -i "s|\@WRAPPER_DIR\@|%{_libexecdir}/%{name}|" sensord.service -sed -i "s|\@WRAPPER_DIR\@|%{_libexecdir}/%{name}|" lm_sensors.service +sed -i "s|\@WRAPPER_DIR\@|%{_libexecdir}/lm_sensors|" sensord.service +sed -i "s|\@WRAPPER_DIR\@|%{_libexecdir}/lm_sensors|" lm_sensors.service %build @@ -120,80 +128,64 @@ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig install -pm 644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/lm_sensors install -pm 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/sensord -# service files mkdir -p $RPM_BUILD_ROOT%{_unitdir} install -pm 644 prog/init/fancontrol.service $RPM_BUILD_ROOT%{_unitdir} install -pm 644 lm_sensors.service $RPM_BUILD_ROOT%{_unitdir} install -pm 644 sensord.service $RPM_BUILD_ROOT%{_unitdir} -# customized modprobe calls -mkdir -p $RPM_BUILD_ROOT%{_libexecdir}/%{name} -install -pm 755 %{SOURCE3} $RPM_BUILD_ROOT%{_libexecdir}/%{name}/lm_sensors-modprobe-wrapper -install -pm 755 %{SOURCE4} $RPM_BUILD_ROOT%{_libexecdir}/%{name}/lm_sensors-modprobe-r-wrapper -install -pm 755 %{SOURCE8} $RPM_BUILD_ROOT%{_libexecdir}/%{name}/lm_sensors-wrapper +mkdir -p $RPM_BUILD_ROOT%{_libexecdir}/lm_sensors +install -pm 755 %{SOURCE3} $RPM_BUILD_ROOT%{_libexecdir}/lm_sensors/lm_sensors-modprobe-wrapper +install -pm 755 %{SOURCE4} $RPM_BUILD_ROOT%{_libexecdir}/lm_sensors/lm_sensors-modprobe-r-wrapper +install -pm 755 %{SOURCE8} $RPM_BUILD_ROOT%{_libexecdir}/lm_sensors/lm_sensors-wrapper -# sensord service wrapper -install -pm 755 %{SOURCE6} $RPM_BUILD_ROOT%{_libexecdir}/%{name}/sensord-service-wrapper +install -pm 755 %{SOURCE6} $RPM_BUILD_ROOT%{_libexecdir}/lm_sensors/sensord-service-wrapper %generate_compatibility_deps -# Note non standard systemd scriptlets, since reload / stop makes no sense -# for lm_sensors %triggerun -- lm_sensors < 3.3.0-2 if [ -L /etc/rc3.d/S26lm_sensors ]; then /bin/systemctl enable lm_sensors.service >/dev/null 2>&1 || : fi /sbin/chkconfig --del lm_sensors -# ===== main ===== %post %systemd_post lm_sensors.service -%preun -%systemd_preun lm_sensors.service - -%postun -%systemd_postun_with_restart lm_sensors.service - -# ==== sensord === - %post sensord %systemd_post sensord.service +%preun +%systemd_preun lm_sensors.service + %preun sensord %systemd_preun sensord.service +%postun +%systemd_postun_with_restart lm_sensors.service + %postun sensord %systemd_postun_with_restart sensord.service -# ===== libs ===== - -%ldconfig_scriptlets libs - - %files -%license COPYING -%doc prog/init/fancontrol.init prog/init/README.initscripts -%config %{_sysconfdir}/sensors3.conf -%config(noreplace) %{_sysconfdir}/sysconfig/lm_sensors -%dir %{_sysconfdir}/sensors.d %{_bindir}/* +%{_sbindir}/* %{_mandir}/man1/* %{_mandir}/man5/* %{_mandir}/man8/* -%{_sbindir}/* -%{abidir}/*-option.list -%{_unitdir}/lm_sensors.service -%{_unitdir}/fancontrol.service -%dir %{_libexecdir}/%{name} -%{_libexecdir}/%{name}/lm_sensors-modprobe*wrapper -%{_libexecdir}/%{name}/lm_sensors-wrapper +%dir %{_libexecdir}/lm_sensors %exclude %{_sbindir}/sensord +%dir %{_sysconfdir}/sensors.d +%{_unitdir}/fancontrol.service +%{_unitdir}/lm_sensors.service %exclude %{_mandir}/man8/sensord.8.gz - -%files doc -%doc CHANGES CONTRIBUTORS doc README* +%config %{_sysconfdir}/sensors3.conf +%{_libexecdir}/lm_sensors/lm_sensors-wrapper +%{_libexecdir}/lm_sensors/lm_sensors-modprobe*wrapper +%config(noreplace) %{_sysconfdir}/sysconfig/lm_sensors +%doc prog/init/fancontrol.init prog/init/README.initscripts +%{abidir}/*-option.list +%license COPYING %files libs %dir %{abidir} @@ -202,20 +194,25 @@ fi %license COPYING.LGPL %files devel -%{_includedir}/sensors -%{_libdir}/lib*.so %{_mandir}/man3/* +%{_libdir}/lib*.so +%{_includedir}/sensors %files sensord -%doc prog/sensord/README %{_sbindir}/sensord -%{_mandir}/man8/sensord.8.gz -%config(noreplace) %{_sysconfdir}/sysconfig/sensord +%doc prog/sensord/README %{_unitdir}/sensord.service -%{_libexecdir}/%{name}/sensord-service-wrapper +%{_libexecdir}/lm_sensors/sensord-service-wrapper +%config(noreplace) %{_sysconfdir}/sysconfig/sensord + +%files doc +%doc CHANGES CONTRIBUTORS doc README* %changelog +* Fri Apr 14 2023 Xuchun Shang - 3.6.0-4 +- Optimize the spec + * Wed Nov 02 2022 mgb01105731 - 3.6.0-3 - optimise spec file -- Gitee