summaryrefslogtreecommitdiffstats
path: root/rpm/SPECS/logactio.spec
blob: f22413f96cd5324c128306adf09d4c5dd753c2a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
Summary: A simple log tracker which acts on certain events
Name: logactio
Version: 1.2
Release: 1
License: GPLv2
Group: System Environment/Daemons
URL: http://fedorapeople.org/cgit/dsommers/public_git/logactio.git/
Source0: https://fedorapeople.org/cgit/dsommers/public_git/%{name}.git/snapshot/%{name}-%{version}.tar.xz
Source1: logactio.sysconf
Source2: logactio.service
Source3: logactio.sysv
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildArch: noarch

%define systemd_avail 0
%if 0%{?rhel} >= 7
%define systemd_avail 1
%endif
%if 0%{?fedora} >= 15
%define systemd_avail 1
%endif

Requires:       python(abi) >= 3.6

%if 0%{systemd_avail} == 1
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
BuildRequires: systemd
%else
Requires(post): chkconfig
Requires(preun): chkconfig
Requires(preun): initscripts
%endif

%if 0%{?rhel} <= 6
BuildRequires: python-sphinx10
%else
BuildRequires: python3-sphinx
%endif


%description
LogActio is a modular log tracker, which observes changes and acts
through different modules based on the event.  It is purely written
in Python and can easily be extended with specific actions.

%prep
%setup -q

%build
%py3_build
pushd docs
%if 0%{?rhel} > 6
make text man
%else
make text man SPHINXBUILD=sphinx-1.0-build
%endif
popd


%install
rm -rf %{buildroot}

# Install logactio code
%py3_install

# Install man pages
mkdir -p %{buildroot}/%{_mandir}/man7
install -m644 docs/build/man/%{name}.7 %{buildroot}/%{_mandir}/man7/

# Install sysv-initd/systemd related stuff
mkdir -p %{buildroot}/%{_sysconfdir}/sysconfig
install -m644 %{SOURCE1} %{buildroot}/%{_sysconfdir}/sysconfig/%{name}
%if 0%{systemd_avail} == 1
mkdir -p %{buildroot}/%{_unitdir}/
install -m644 %{SOURCE2} %{buildroot}/%{_unitdir}/
%else
mkdir -p %{buildroot}/%{_initddir}/
install -m755 %{SOURCE3} %{buildroot}/%{_initddir}/%{name}
%endif

%clean
rm -rf %{buildroot}

%post
%if 0%{systemd_avail} == 1
%systemd_post logactio.service
%else
/sbin/chkconfig --add %{name}
%endif

%preun
%if 0%{systemd_avail} == 1
%systemd_preun logactio.service
%else
if [ $1 -eq 0 ] ; then
    /sbin/service %{name} stop >/dev/null 2>&1
    /sbin/chkconfig --del %{name}
fi
%endif

%postun
%if 0%{systemd_avail} == 1
%systemd_postun_with_restart logactio.service
%else
if [ "$1" -ge "1" ] ; then
    /sbin/service %{name} condrestart >/dev/null 2>&1 || :
fi
%endif


%files
%defattr(-,root,root,-)
%doc COPYING docs/build/text/configuration.txt docs/build/text/starting.txt
%{_mandir}/man7/*.gz
%{_bindir}/logactio
%{python3_sitelib}/LogActio
%{python3_sitelib}/*.egg-info
%config(noreplace) /etc/sysconfig/%{name}
%if 0%{systemd_avail} == 1
%{_unitdir}/%{name}.service
%else
%{_initddir}/%{name}
%endif


%changelog
* Thu Jul 30 2020 David Sommerseth <dazo@eurephia.org> - 1.2.1
- Migrate to Python 3
- Improve log messages for SMTPreporter and IPTipset
- Use a simpler systemd service unit file
* Thu Nov 12 2015 David Sommerseth <dazo@eurephia.org> - 1.1-1
- Reworked regexp match values sent to the reporter modules
- Ensure that IPTipset only uses the first regexp match as an IP address
* Fri Oct 23 2015 David Sommerseth <dazo@eurephia.org> - 1.0-1
- Updated for final v1.0 with support for both systemd and sysv distros
* Wed Dec 25 2013 David Sommerseth <dazo@eurephia.org> - 0.01-1
- Initial RPM packaging