Mercurial > syslog2iptables
changeset 77:c6ba792f1a9a
systemd only
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Wed, 15 Jul 2020 13:58:42 -0700 |
parents | c6c8a2102a3e |
children | fadead7c9142 |
files | Makefile.am syslog2iptables.rc.in syslog2iptables.spec.in |
diffstat | 3 files changed, 9 insertions(+), 111 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile.am Wed Jul 15 13:38:43 2020 -0700 +++ b/Makefile.am Wed Jul 15 13:58:42 2020 -0700 @@ -6,21 +6,11 @@ hack_DATA = syslog2iptables.conf.make syslog2iptables.conf.top syslog2iptables.conf.bottom syslog2iptables.conf.httpd htmldir = ${datadir}/doc/@PACKAGE@-@VERSION@ html_DATA = AUTHORS COPYING ChangeLog NEWS README -CLEANFILES = syslog2iptables syslog2iptables.service xml/syslog2iptables xml/Makefile -EXTRA_DIST = syslog2iptables.rc syslog2iptables.service.rc $(hack_DATA) syslog2iptables.spec xml/header.sgml xml/header.xml xml/Makefile.am xml/Makefile.in xml/syslog2iptables.in - -syslog2iptables: syslog2iptables.rc - cat syslog2iptables.rc | \ - sed -e "s,SBINDIR,$(sbindir),g" | \ - sed -e "s,SYSCONFDIR,$(sysconfdir),g" >>syslog2iptables +CLEANFILES = syslog2iptables.service xml/syslog2iptables xml/Makefile +EXTRA_DIST = syslog2iptables.service.rc $(hack_DATA) syslog2iptables.spec xml/header.sgml xml/header.xml xml/Makefile.am xml/Makefile.in xml/syslog2iptables.in syslog2iptables.service: syslog2iptables.service.rc cat syslog2iptables.service.rc | \ sed -e "s,SBINDIR,$(sbindir),g" | \ sed -e "s,SYSCONFDIR,$(sysconfdir),g" >>syslog2iptables.service -chkconfig: syslog2iptables - mv -f $(sysconfdir)/syslog2iptables /etc/rc.d/init.d - /sbin/chkconfig --del syslog2iptables - /sbin/chkconfig --add syslog2iptables -
--- a/syslog2iptables.rc.in Wed Jul 15 13:38:43 2020 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -#!@BASH@ -# -# syslog2iptables This script controls the syslog2iptables daemon. -# -# -# chkconfig: 2345 60 40 -# description: syslog2iptables monitors syslog files, parses them, and update the iptables filters -# processname: syslog2iptables -# pidfile: /var/run/syslog2iptables.pid -# Source function library. -# -. /etc/rc.d/init.d/functions - -# Source networking configuration. -. /etc/sysconfig/network - -RETVAL=0 -# See how we were called. -case "$1" in - start) - # Start daemons. - echo -n "Starting syslog2iptables: " - if [ ! -f /var/lock/subsys/syslog2iptables ]; then - cd SYSCONFDIR # conf file is here - SBINDIR/syslog2iptables -d 3 - RETVAL=$? - pid=`pidof -s SBINDIR/syslog2iptables` - if [ $pid ] - then - success "Starting syslog2iptables :" - touch /var/lock/subsys/syslog2iptables - echo - else - failure "Starting syslog2iptables:" - echo - fi - else - echo -n "already running! " - failure "syslog2iptables already running!" - echo - fi - - ;; - stop) - # Stop daemons. - echo -n "Shutting down syslog2iptables: " - killproc syslog2iptables - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/syslog2iptables - ;; - restart|reload) - $0 stop - $0 start - RETVAL=$? - ;; - status) - status syslog2iptables - RETVAL=$? - ;; - *) - echo "Usage: syslog2iptables {start|stop|restart|reload|status}" - exit 1 -esac -exit $RETVAL
--- a/syslog2iptables.spec.in Wed Jul 15 13:38:43 2020 -0700 +++ b/syslog2iptables.spec.in Wed Jul 15 13:58:42 2020 -0700 @@ -10,18 +10,14 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) URL: http://www.five-ten-sg.com/%{name}/ -Requires(post,preun): /sbin/chkconfig -Requires(post,preun): /sbin/service Requires: iptables, coreutils BuildRequires: gcc gcc-c++ -%if "%{?dist}" == ".el7" Requires(pre): systemd-sysv, shadow-utils Requires(post): systemd-units Requires(preun): systemd-units Requires(postun): systemd-units Requires: rsyslog, systemd-units BuildRequires: systemd-units -%endif %description @@ -38,13 +34,7 @@ %install rm -rf %{buildroot} make DESTDIR=%{buildroot} install -%if "%{?dist}" == ".el7" -install -m 644 -D %{buildroot}%{_sysconfdir}/%{name}.service \ - %{buildroot}%{_unitdir}/%{name}.service -%else -install -m 755 -D %{buildroot}%{_sysconfdir}/%{name} \ - %{buildroot}%{_initrddir}/%{name} -%endif +install -m 644 -D %{buildroot}%{_sysconfdir}/%{name}.service %{buildroot}%{_unitdir}/%{name}.service rm -f %{buildroot}%{_sysconfdir}/%{name} rm -f %{buildroot}%{_sysconfdir}/%{name}.service @@ -59,24 +49,15 @@ %post if [ $1 = 1 ]; then # initial install -%if "%{?dist}" == ".el7" /bin/systemctl daemon-reload &>/dev/null || : -%else - /sbin/chkconfig --add %{name} -%endif (cd %{_sysconfdir}; ./%{name}.conf.make) fi %preun if [ $1 = 0 ]; then # package removal, not upgrade -%if "%{?dist}" == ".el7" /bin/systemctl --no-reload disable %{name}.service &>/dev/null || : /bin/systemctl stop %{name}.service &>/dev/null || : -%else - /sbin/service %{name} stop || : - /sbin/chkconfig --del %{name} -%endif fi @@ -84,11 +65,7 @@ if [ $1 -ge 1 ]; then # package upgrade, not uninstall (cd %{_sysconfdir}; ./%{name}.conf.make) -%if "%{?dist}" == ".el7" /bin/systemctl try-restart %{name}.service &>/dev/null || : -%else - /sbin/service %{name} restart || : -%endif fi @@ -103,11 +80,7 @@ %config(noreplace) %{_sysconfdir}/%{name}.conf.httpd %config(noreplace) %{_sysconfdir}/%{name}.conf.bottom %attr(750,root,root) %{_sysconfdir}/%{name}.conf.make -%if "%{?dist}" == ".el7" %{_unitdir}/%{name}.service -%else -%{_initrddir}/%{name} -%endif %changelog