# needssslcertforbuild # # spec file for package sysmonitor # # Copyright (c) Huawei Technologies Co., Ltd. 2014-2019. All rights reserved. # %define kmod_name sysmonitor %define version 1.3.2 %define releaseversion 1.8 Summary: System Monitor Daemon Name: %{kmod_name}-kmod Version: %{version} Release: %{releaseversion} License: GPLv2 and Mulan PSL v2 Group: System Environment/Daemons Source0: %{kmod_name}-%{version}.tar.bz2 BuildRequires: libboundscheck Requires: systemd BuildRequires: module-init-tools BuildRequires: kernel-devel BuildRequires: dos2unix BuildRequires: elfutils-libelf-devel BuildRequires: systemd cmake gcc-c++ BuildRequires: libcap-devel BuildRequires: uname-build-checks Requires: bash dhcp gawk kmod logrotate Requires: net-tools which file #for test BuildRequires: CUnit CUnit-devel Requires: libboundscheck Requires: kernel >= 3.10.0-514.44.5.10 Requires: iotop Requires: python3 Provides: sysmonitor %{?systemd_requires} Patch1: bugfix-fix-signal-monitor-err.patch Patch2: bugfix-fix-fd-path-failed-to-open.patch Patch3: update-support-loongarch-fix-compilation-errors.patch Patch4: add-install-section-in-src-CMakeList.txt-and-module-Makefile.patch Patch5: support-monitor-process-function-by-kprobe.patch %description System Monitor Daemon %prep %autosetup -n %{kmod_name}-%{version} -p1 %build %cmake %cmake_build cd module make KDIR=/lib/modules/`uname -r`/build strip -g sysmonitor.ko %install #export BRP_PESIGN_FILES="*.ko" dos2unix %_builddir/%{kmod_name}-%{version}/script/iomonitor_daemon dos2unix %_builddir/%{kmod_name}-%{version}/conf/io_monitor mkdir -p %{buildroot}%{_sbindir} mkdir -p %{buildroot}/etc/sysmonitor.d/ install -d %{buildroot}%{_bindir} install -d %{buildroot}%{_sysconfdir}/sysconfig install -d -m 700 %{buildroot}%{_sysconfdir}/sysmonitor/ install -d -m 700 %{buildroot}%{_sysconfdir}/sysmonitor/process install -d -m 700 %{buildroot}%{_libexecdir}/sysmonitor install -d -m 700 %{buildroot}%{_sysconfdir}/sysmonitor.d/ install -d %{buildroot}/etc/rsyslog.d/ install -d -m 750 %{buildroot}/lib/modules/sysmonitor install -d -m 750 %{buildroot}%{_libexecdir}/sysmonitor/data install -m 600 conf/process/* %{buildroot}%{_sysconfdir}/sysmonitor/process install -m 600 conf/signal %{buildroot}%{_sysconfdir}/sysmonitor install -m 600 conf/network %{buildroot}%{_sysconfdir}/sysmonitor install -m 500 src/sysmonitor %{buildroot}%{_bindir} install -m 600 conf/sysmonitor %{buildroot}%{_sysconfdir}/sysconfig/sysmonitor install -m 640 module/sysmonitor.ko %{buildroot}/lib/modules/sysmonitor install -m 600 conf/disk %{buildroot}%{_sysconfdir}/sysmonitor/disk install -m 600 conf/inode %{buildroot}%{_sysconfdir}/sysmonitor/inode install -m 600 conf/file %{buildroot}%{_sysconfdir}/sysmonitor/file install -m 600 conf/cpu %{buildroot}%{_sysconfdir}/sysmonitor/cpu install -m 600 conf/memory %{buildroot}%{_sysconfdir}/sysmonitor/memory install -m 600 conf/pscnt %{buildroot}%{_sysconfdir}/sysmonitor/pscnt install -m 600 conf/iodelay %{buildroot}%{_sysconfdir}/sysmonitor/iodelay install -m 600 conf/process_fd_conf %{buildroot}%{_sysconfdir}/sysmonitor/process_fd_conf install -m 600 conf/sys_fd_conf %{buildroot}%{_sysconfdir}/sysmonitor/sys_fd_conf install -m 600 conf/w_log_conf %{buildroot}%{_sysconfdir}/sysmonitor/w_log_conf install -m 500 script/get_local_disk.sh %{buildroot}%{_libexecdir}/sysmonitor/ install -m 500 script/check_sshd.sh %{buildroot}%{_libexecdir}/sysmonitor/ install -m 500 script/check_dbus.sh %{buildroot}%{_libexecdir}/sysmonitor/ install -m 600 conf/rsyslog.d/sysmonitor.conf %{buildroot}/etc/rsyslog.d/sysmonitor.conf install -m 500 script/check_syslog.sh %{buildroot}%{_libexecdir}/sysmonitor/ install -m 600 conf/logrotate.d/sysmonitor-logrotate %{buildroot}%{_libexecdir}/sysmonitor/sysmonitor-logrotate install -m 500 script/sysmonitor_log_dump.sh %{buildroot}%{_libexecdir}/sysmonitor/ install -m 500 script/check_cron.sh %{buildroot}%{_libexecdir}/sysmonitor/ install -m 600 conf/clock_transition %{buildroot}%{_sysconfdir}/sysmonitor.d/clock_transition install -m 500 script/clocktransition.py %{buildroot}%{_libexecdir}/sysmonitor/ install -m 500 script/ko.sh %{buildroot}%{_libexecdir}/sysmonitor/ install -m 500 script/rm_duplicat_conf.sh %{buildroot}%{_libexecdir}/sysmonitor/ install -m 500 script/process_clock_data.sh %{buildroot}%{_libexecdir}/sysmonitor/ install -m 500 script/iomonitor_daemon %{buildroot}%{_sbindir} install -m 600 conf/io_monitor %{buildroot}/etc/sysmonitor.d/ install -m 600 conf/zombie %{buildroot}%{_sysconfdir}/sysmonitor/zombie install -m 500 script/getzombieparent.py %{buildroot}%{_libexecdir}/sysmonitor/ install -m 500 script/clean_remain_process.sh %{buildroot}%{_libexecdir}/sysmonitor/ mkdir -p $RPM_BUILD_ROOT%{_unitdir}/multi-user.target.wants mkdir -p $RPM_BUILD_ROOT/etc/systemd/ install -m 600 conf/logind_monitor %{buildroot}%{_sysconfdir}/sysmonitor.d/ install -m 500 script/logind_clear.sh %{buildroot}%{_libexecdir}/sysmonitor/ install -m 0600 service/sysmonitor.service $RPM_BUILD_ROOT%{_unitdir}/sysmonitor.service ln -s ../sysmonitor.service $RPM_BUILD_ROOT%{_unitdir}/multi-user.target.wants/sysmonitor.service %post %systemd_post sysmonitor.service %preun %systemd_preun sysmonitor.service %postun if [ "$1" == "0" ] then rmmod sysmonitor 2>/dev/null 1>/dev/null fi %systemd_postun_with_restart sysmonitor.service depmod -a %posttrans for line in $(ls /lib/modules/) do if [ -L /lib/modules/"$line"/weak-updates/sysmonitor/sysmonitor.ko ];then rm -rf /lib/modules/"$line"/weak-updates/sysmonitor fi done depmod -a $(uname -r) systemctl daemon-reload 2>/dev/null 1>/dev/null %files %defattr(-,root,root) %dir %{_sysconfdir}/sysmonitor %dir %{_sysconfdir}/sysmonitor/process %dir %{_sysconfdir}/sysmonitor.d/ %dir %{_libexecdir}/sysmonitor %dir %attr(0550,root,root) /lib/modules/sysmonitor %config(noreplace) %{_sysconfdir}/sysconfig/sysmonitor %config(noreplace) %{_sysconfdir}/sysmonitor/* %config(noreplace) %{_sysconfdir}/sysmonitor/process/* %{_bindir}/sysmonitor %{_libexecdir}/sysmonitor/* %attr(0500,root,root) %{_libexecdir}/sysmonitor/sysmonitor_log_dump.sh %config(noreplace) %attr(0600,root,root) %{_libexecdir}/sysmonitor/sysmonitor-logrotate %exclude %{_libexecdir}/sysmonitor/*.pyc %exclude %{_libexecdir}/sysmonitor/*.pyo %dir %attr(0700,root,root) %{_libexecdir}/sysmonitor/data %attr(0400,root,root) /lib/modules/sysmonitor/sysmonitor.ko %config(noreplace) /etc/rsyslog.d/sysmonitor.conf %attr(0500,root,root) %{_sbindir}/iomonitor_daemon %attr(0600,root,root) /etc/sysmonitor.d/io_monitor %config(noreplace) %{_sysconfdir}/sysmonitor.d/* %{_unitdir}/sysmonitor.service %{_unitdir}/multi-user.target.wants/sysmonitor.service %changelog * Thu Nov 21 2024 Funda Wang - 1.3.2-1.8 - adopt to new cmake macro * Sun Sep 22 2024 guo-zhicheng666<1678717630@qq.com> - 1.3.2-1.7 - Type:bugfix - CVE:NA - DESC:support monitor process function by kprobe * Thu May 23 2024 wangxiaomeng - 1.3.2-1.6 - Type:bugfix - CVE:NA - DESC:add install section * Mon Jun 03 2024 yueyuankun - 1.3.2-1.5 - Type:update - CVE:NA - SUG:NA - DESC: support loongarch, fix compilation errors * Thu Apr 11 2024 tenglei - 1.3.2-1.4 - Type:bugfix - CVE:NA - DESC:fix bug fd interface failed to open * Sun Feb 04 2024 ChenYanpan - 1.3.2-1.3 - Type:bugfix - CVE:NA - DESC:rename %rpmversion to %version, to fix build failure * Tue Nov 28 2023 xietangxin - 1.3.2-1.2 - Type:bugfix - CVE:NA - SUG:restart - DESC: fix signal monitor err * Mon Jul 24 2023 zhang_chunjing - 1.3.2-1.1 - Type:bugfix - CVE:NA - SUG:restart - DESC: add systemd to BuildRequires to fix install/uninstall errors * Sat May 27 2023 xietangxin - 1.3.2-1.0 - Type:bugfix - CVE:NA - SUG:restart - DESC: init for sysmonitor