- drop support for fedora versions without systemd

- incorporate all changes made in rawhide branch
- rename files, delete unnecessary files
- provide native systemd service file
This commit is contained in:
Matthias Runge 2011-04-26 22:37:48 +02:00
parent 1c7c836525
commit fa7c4abc95
10 changed files with 75 additions and 284 deletions

View File

@ -1,7 +0,0 @@
/var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log /var/log/cron {
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
/bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}

View File

@ -1,6 +0,0 @@
/var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log /var/log/cron {
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}

View File

@ -1,3 +0,0 @@
SYSLOGNG_PID="/var/run/syslog-ng.pid"
SYSLOGNG_OPTIONS="-p $SYSLOGNG_PID"
SYSLOGNG_COMPAT_PID="/var/run/syslogd.pid"

View File

@ -1,4 +1,4 @@
@version:3.0 @version:3.2
# syslog-ng configuration file. # syslog-ng configuration file.
# #

View File

@ -1,123 +0,0 @@
#!/bin/sh
#
# syslog-ng starts/stops syslog-ng service
#
# chkconfig: - 12 88
# description: Syslog is the facility by which many daemons use to log \
# messages to various system log files.
#
### BEGIN INIT INFO
# Provides: $syslog
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Short-Description: Next-generation syslog server
# Description: syslog-ng, as the name shows, is a syslogd replacement, but
# with new functionality for the new generation. The original syslogd
# allows messages only to be sorted based on priority/facility pairs;
# syslog-ng adds the possibility to filter based on message contents
# using regular expressions. The new configuration scheme is intuitive
# and powerful. Forwarding logs over TCP and remembering all forwarding
# hops makes it ideal for firewalled environments.
### END INIT INFO
# Source function library.
. /etc/init.d/functions
[ -e /etc/sysconfig/syslog-ng ] && . /etc/sysconfig/syslog-ng
RETVAL=0
check_syntax()
{
[ -x /sbin/syslog-ng ] || exit 5
syslog-ng -s $SYSLOGNG_OPTIONS
RETVAL=$?
return $RETVAL
}
verify_config()
{
check_syntax
RETVAL=$?
[ $RETVAL -eq 0 ] || exit $retval
}
checkconfig()
{
action $"Checking Configuration: " check_syntax
}
start()
{
verify_config
echo -n $"Starting syslog-ng: "
if [ -e $SYSLOGNG_COMPAT_PID ]; then
failure "PID file for existing syslog daemon exists"
fi
daemon syslog-ng $SYSLOGNG_OPTIONS
ln -sf $SYSLOGNG_PID $SYSLOGNG_COMPAT_PID
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/syslog-ng
return $RETVAL
}
stop()
{
echo -n $"Stopping syslog-ng: "
REMOVE_COMPAT_PID=0
if [ -e $SYSLOGNG_PID ]; then
if [ -e $SYSLOGNG_COMPAT_PID -a $(<$SYSLOGNG_PID) == $(<$SYSLOGNG_COMPAT_PID) ]; then
REMOVE_COMPAT_PID=1
fi
fi
killproc syslog-ng
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/syslog-ng
[ $RETVAL -eq 0 -a $REMOVE_COMPAT_PID -eq 1 ] && rm -f $SYSLOGNG_COMPAT_PID
return $RETVAL
}
reload()
{
verify_config
echo -n $"Reloading syslog-ng: "
killproc syslog-ng -HUP
RETVAL=$?
echo
return $RETVAL
}
restart()
{
stop
start
}
case "$1" in
start|stop|reload)
$1
;;
restart|force_reload)
restart
;;
status)
status syslog-ng
;;
checkconfig|configtest|check|test)
checkconfig
;;
condrestart|try-restart)
[ -f /var/lock/subsys/syslog-ng ] && restart || :
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|condrestart|checkconfig}"
exit 1
esac
exit $?
# vim: ft=sh:ts=4:ai:si:

11
syslog-ng.service Normal file
View File

@ -0,0 +1,11 @@
[Unit]
Description=Syslog-ng System Logging Service
[Service]
EnvironmentFile=-/etc/sysconfig/syslog-ng
ExecStartPre=/bin/systemctl stop systemd-kmsg-syslogd.service
ExecStart=/sbin/syslog-ng $SYSLOGNG_OPTIONS
Sockets=syslog-ng.socket
[Install]
WantedBy=multi-user.target

View File

@ -1,5 +1,5 @@
%{?_with_spoofsource:%define spoofsource 1}
%define evtlog_ver 0.2.12 %define evtlog_ver 0.2.12
%define gitsnapshot 20110424
%define _sbindir /sbin %define _sbindir /sbin
%define _localstatedir /var/lib/syslog-ng %define _localstatedir /var/lib/syslog-ng
@ -7,8 +7,8 @@
%define system_service /lib/systemd/system %define system_service /lib/systemd/system
Name: syslog-ng Name: syslog-ng
Version: 3.2.2 Version: 3.2.3
Release: 3%{?dist} Release: 0.%{gitsnapshot}.2%{?dist}
Summary: Next-generation syslog server Summary: Next-generation syslog server
Group: System Environment/Daemons Group: System Environment/Daemons
@ -17,53 +17,49 @@ Url: http://www.balabit.com/products/syslog_ng/
# git clone git://git.balabit.hu/bazsi/syslog-ng-3.2.git/ # git clone git://git.balabit.hu/bazsi/syslog-ng-3.2.git/
# cd syslog-ng-3.2/ # cd syslog-ng-3.2/
# git archive --format=tar --prefix="syslog-ng-3.2.2/" HEAD . | bzip2 > ../syslog-ng-3.2.2.tar.bz2 # git archive --format=tar --prefix="syslog-ng-3.2.3/" HEAD . | bzip2 > ../syslog-ng-3.2.3-20110424.tar.bz2
#Source0: http://www.balabit.com/downloads/files/%{name}/open-source-edition/%{version}/source/%{name}_%{version}.tar.gz #Source0: http://www.balabit.com/downloads/files/%{name}/open-source-edition/%{version}/source/%{name}_%{version}.tar.gz
Source0: %{name}-%{version}.tar.bz2 Source0: %{name}-%{version}-%{gitsnapshot}.tar.bz2
Source1: syslog-ng.conf Source1: syslog-ng.conf
Source2: syslog-ng.init.d Source2: syslog-ng.service
Source3: syslog-ng.service Source3: syslog-ng.sysconfig
Source10: sysklogd-syslog-ng.sysconfig Source4: syslog-ng.logrotate
Source12: sysklogd-1.4.1-44-logrotate.d-syslog.log
Source30: rsyslog-syslog-ng-fc10.sysconfig
Source31: rsyslog-3.21.9-logrotate.d-rsyslog.log
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: eventlog-devel >= %{evtlog_ver}
BuildRequires: pkgconfig BuildRequires: pkgconfig
BuildRequires: glib2-devel >= 2.10.1
BuildRequires: pcre-devel >= 7.3
BuildRequires: openssl-devel
BuildRequires: libdbi-devel
BuildRequires: libtool BuildRequires: libtool
BuildRequires: automake BuildRequires: automake
BuildRequires: autoconf BuildRequires: autoconf
BuildRequires: bison BuildRequires: bison
BuildRequires: flex BuildRequires: flex
BuildRequires: eventlog-devel BuildRequires: eventlog-devel >= %{evtlog_ver}
BuildRequires: tcp_wrappers-devel BuildRequires: glib2-devel >= 2.10.1
BuildRequires: libdbi-devel
BuildRequires: libnet-devel BuildRequires: libnet-devel
Requires: logrotate BuildRequires: openssl-devel
Requires(post): /sbin/chkconfig BuildRequires: pcre-devel >= 7.3
Requires(preun): /sbin/chkconfig BuildRequires: tcp_wrappers-devel
Requires(preun): /sbin/service
Requires(postun): /sbin/service
Requires: logrotate
Requires(post): /bin/systemctl
Requires(preun): /bin/systemctl
Requires(preun): /bin/systemctl
Requires(postun): /bin/systemctl
Provides: syslog
# merge separate syslog-vim package into one # merge separate syslog-vim package into one
Provides: syslog-ng-vim = %{version}-%{release} Provides: syslog-ng-vim = %{version}-%{release}
Obsoletes: syslog-ng-vim < 2.0.8-1 Obsoletes: syslog-ng-vim < 2.0.8-1
%description %description
syslog-ng, as the name shows, is a syslogd replacement, but with new syslog-ng, as the name shows, is a syslogd replacement, but with new
functionality for the new generation. The original syslogd allows functionality for the new generation. The original syslogd allows
messages only to be sorted based on priority/facility pairs; syslog-ng messages only to be sorted based on priority/facility pairs; syslog-ng
adds the possibility to filter based on message contents using regular adds the possibility to filter based on message contents using regular
expressions. The new configuration scheme is intuitive and powerful. expressions. The new configuration scheme is intuitive and powerful.
Forwarding logs over TCP and remembering all forwarding hops makes it Forwarding logs over TCP and remembering all forwarding hops makes it
ideal for firewalled environments. ideal for firewalled environments.
%package devel %package devel
@ -71,7 +67,7 @@ Summary: Development files for %{name}
Group: Development/Libraries Group: Development/Libraries
Requires: %{name} = %{version}-%{release} Requires: %{name} = %{version}-%{release}
%description devel %description devel
The %{name}-devel package contains libraries and header files for The %{name}-devel package contains libraries and header files for
developing applications that use %{name}. developing applications that use %{name}.
@ -79,30 +75,17 @@ developing applications that use %{name}.
%prep %prep
%setup -q %setup -q
./autogen.sh
# fix perl path # fix perl path
%{__sed} -i 's|^#!/usr/local/bin/perl|#!%{__perl}|' contrib/relogger.pl %{__sed} -i 's|^#!/usr/local/bin/perl|#!%{__perl}|' contrib/relogger.pl
# fix executable perms on contrib files
%define logrotated_dst syslog-ng %{__chmod} -c a-x contrib/syslog2ng
%if 0%{?rhel}
%if 0%{?rhel} >= 5
%define sysconfig_src %{SOURCE10}
%define logrotated_src %{SOURCE12}
%endif
%endif
%if 0%{?fedora}
%if 0%{?fedora} < 15
%define sysconfig_src %{SOURCE10}
%else
%define sysconfig_src %{SOURCE30}
%endif
%define logrotated_src %{SOURCE31}
%endif
%build %build
./autogen.sh
%configure \ %configure \
--prefix=/ \ --prefix=/ \
--libdir=/%{_lib} \ --libdir=/%{_lib} \
@ -133,21 +116,14 @@ make DESTDIR=%{buildroot} install
%{__install} -d -m 755 %{buildroot}%{_sysconfdir}/%{name} %{__install} -d -m 755 %{buildroot}%{_sysconfdir}/%{name}
%{__install} -p -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/%{name}/syslog-ng.conf %{__install} -p -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/%{name}/syslog-ng.conf
# install init script for fedora <=14 # install init script
%if 0%{?fedora} < 15 %{__install} -p -D -m 644 %{SOURCE2} %{buildroot}/%{system_service}/%{name}.service
%{__install} -d -m 755 %{buildroot}%{_sysconfdir}/init.d
%{__install} -p -m 755 %{SOURCE2} %{buildroot}%{_sysconfdir}/init.d/%{name}
%else
# install systemd native file
%{__install} -p -D -m 644 %{SOURCE3} %{buildroot}/%{system_service}/%{name}.service
%endif
%{__install} -d -m 755 %{buildroot}%{_sysconfdir}/sysconfig %{__install} -d -m 755 %{buildroot}%{_sysconfdir}/sysconfig
%{__install} -p -m 644 %{sysconfig_src} %{buildroot}%{_sysconfdir}/sysconfig/%{name} %{__install} -p -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
%{__install} -d -m 755 %{buildroot}%{_sysconfdir}/logrotate.d %{__install} -d -m 755 %{buildroot}%{_sysconfdir}/logrotate.d
%{__install} -p -m 644 %{logrotated_src} \ %{__install} -p -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/logrotate.d/syslog
%{buildroot}%{_sysconfdir}/logrotate.d/%{logrotated_dst}
# make local state dir # make local state dir
%{__install} -d -m 755 %{buildroot}/%{_localstatedir} %{__install} -d -m 755 %{buildroot}/%{_localstatedir}
@ -156,9 +132,6 @@ make DESTDIR=%{buildroot} install
/usr/bin/iconv -f iso8859-1 -t utf-8 AUTHORS > AUTHORS.conv && \ /usr/bin/iconv -f iso8859-1 -t utf-8 AUTHORS > AUTHORS.conv && \
%{__mv} -f AUTHORS.conv AUTHORS %{__mv} -f AUTHORS.conv AUTHORS
# fix executable perms on contrib files
%{__chmod} -x contrib/relogger.pl
%{__chmod} -x contrib/syslog2ng
# install vim files # install vim files
@ -181,33 +154,19 @@ rm -rf %{buildroot}
%post %post
/sbin/ldconfig /sbin/ldconfig
%if 0%{?fedora} < 15 /bin/systemctl enable %{name}.service
/sbin/chkconfig --add %{name}
%else
/bin/systemctl enable %{name}.service
%endif
%preun %preun
if [ "$1" = 0 ]; then if [ "$1" = 0 ]; then
%if 0%{?fedora} < 15 /bin/systemctl stop %{name}.service
/sbin/service %{name} stop > /dev/null 2>&1 /bin/systemctl disable %{name}.service
/sbin/chkconfig --del %{name}
%else
/bin/systemctl stop %{name}.service
/bin/systemctl disable %{name}.service
%endif
fi fi
%postun %postun
/sbin/ldconfig /sbin/ldconfig
if [ "$1" -ge 1 ]; then if [ "$1" -ge 1 ]; then
%if 0%{?fedora} < 15 /bin/systemctl condrestart %{name}.service
/sbin/service %{name} condrestart >/dev/null 2>&1
%else
/bin/systemctl condrestart %{name}.service
%endif
fi fi
@ -233,7 +192,7 @@ fi
%files %files
%defattr(-,root,root) %defattr(-,root,root,-)
%doc AUTHORS COPYING README ChangeLog NEWS %doc AUTHORS COPYING README ChangeLog NEWS
%doc doc/security/*.txt %doc doc/security/*.txt
%doc doc/examples/syslog-ng.conf.sample %doc doc/examples/syslog-ng.conf.sample
@ -243,12 +202,8 @@ fi
%config(noreplace) %{_sysconfdir}/%{name}/modules.conf %config(noreplace) %{_sysconfdir}/%{name}/modules.conf
%config(noreplace) %{_sysconfdir}/%{name}/scl.conf %config(noreplace) %{_sysconfdir}/%{name}/scl.conf
%config(noreplace) %{_sysconfdir}/sysconfig/%{name} %config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%config(noreplace) %{_sysconfdir}/logrotate.d/%{logrotated_dst} %config(noreplace) %{_sysconfdir}/logrotate.d/syslog
%if 0%{?fedora} < 15
%{_sysconfdir}/init.d/%{name}
%else
%{system_service}/%{name}.service %{system_service}/%{name}.service
%endif
%dir %{_localstatedir} %dir %{_localstatedir}
%{_sbindir}/%{name} %{_sbindir}/%{name}
@ -263,9 +218,11 @@ fi
# uhm, some better places for those? # uhm, some better places for those?
%{_datadir}/xsd %{_datadir}/xsd
%{_mandir}/man1/* %{_mandir}/man1/loggen.1*
%{_mandir}/man5/* %{_mandir}/man1/pdbtool.1*
%{_mandir}/man8/* %{_mandir}/man1/syslog-ng-ctl.1*
%{_mandir}/man5/syslog-ng.conf.5*
%{_mandir}/man8/syslog-ng.8*
%ghost %{_datadir}/vim/ %ghost %{_datadir}/vim/
%files devel %files devel
@ -275,10 +232,24 @@ fi
%changelog %changelog
* Tue Apr 26 2011 Matthias Runge <mrunge@matthias-runge.de> - 3.2.3-0.20110424.2
- drop support for fedora without systemd
* Mon Apr 25 2011 Jose Pedro Oliveira <jpo at di.uminho.pt> - 3.2.3-0.20110424.1
- change NVR to alert users that we have been using a syslog-ng v3.2 git snapshot
(for systemd support)
* Mon Apr 25 2011 Jose Pedro Oliveira <jpo at di.uminho.pt> - 3.2.2-4
- re-introduces the "Provides: syslog" (#651823 comments 13, 15 and 21)
- rename the logrotate.d file back to syslog (#651823 comments 12, 15, 16 and 21)
- cleans the sysconfig and logrotate file mess (#651823 comments 17, 20 and 21)
- spec code cleanup (#651823 comments 10 and 11)
- dropped duplicated eventlog-devel BR
* Thu Apr 21 2011 Matthias Runge <mrunge@matthias-runge.de> - 3.2.2-3 * Thu Apr 21 2011 Matthias Runge <mrunge@matthias-runge.de> - 3.2.2-3
- systemd fixup - systemd fixup
- more spec file cleanup, - more spec file cleanup,
- incorporate fixes from Jose Pedro Oliveira - incorporate fixes from Jose Pedro Oliveira (#651823 comments 7 and 8)
* Wed Apr 20 2011 Matthias Runge <mrunge@matthias-runge.de> - 3.2.2-2 * Wed Apr 20 2011 Matthias Runge <mrunge@matthias-runge.de> - 3.2.2-2
- spec cleanup - spec cleanup

View File

@ -1,52 +0,0 @@
" Vim syntax file
" Language: syslog-ng: syslog-ng main configuration file (1.5.5a)
" Maintainer: --
" Last change: 2001 Apr 13
" URL: --
" syslog-ng's home: http://www.balabit.hu
" Something like this in filetype.vim would be helpful
" au BufNewFile,BufRead syslog-ng.conf setf syslog-ng
" Remove any old syntax stuff hanging around
syn clear
syn case match
set iskeyword=a-z,A-Z,48-57,_,-,.
syn keyword sysngStatement source destination filter log options
syn match sysngComment "#.*$"
syn match sysngString +"[^"]*"+
syn match sysngOctNumber "\<0\o\+\>"
syn match sysngDecNumber "\<\d\+\>"
syn match sysngHexNumber "\<0x\x\+\>"
syn keyword sysngBool yes no on off
syn match sysngIdentifier "\<[sdf]_\+\>"
syn keyword sysngDriver internal remote_control
syn keyword sysngDriver file fifo pipe door
syn keyword sysngDriver udp tcp udp6 tcp6
syn keyword sysngDriver sun_stream sun_streams sun-stream sun-streams
syn keyword sysngDriver unix_dgram unix_stream unix-dgram unix-stream
syn keyword sysngDriver usertty program
syn keyword sysngFilter not and or .. level priority facility
syn keyword sysngFilter program host match DEFAULT
if !exists("did_sysng_syntax_inits")
let did_sysng_syntax_inits = 1
hi link sysngStatement Statement
hi link sysngComment Comment
hi link sysngString String
hi link sysngOctNumber Number
hi link sysngDecNumber Number
hi link sysngHexNumber Number
hi link sysngBool Constant
hi link sysngIdentifier Identifier
hi link sysngDriver Type
hi link sysngFilter Operator
endif
let b:current_syntax = "syslog-ng"