Accepting request 141068 from home:mtomaschewski:syslog

- Removed handling of the -c <compat version> option which is
  obsolete in rsyslog-7.x.
- Fixed build requires / deps to work on 12.x and SLE-11-SP2.
- Initialized RSYSLOG_PARAMS env variable in service file.
- Marked additional log socket config as ghost.

OBS-URL: https://build.opensuse.org/request/show/141068
OBS-URL: https://build.opensuse.org/package/show/Base:System/rsyslog?expand=0&rev=112
This commit is contained in:
Marius Tomaschewski 2012-11-13 08:13:03 +00:00 committed by Git OBS Bridge
parent 3cff378c59
commit b8fcf9826c
5 changed files with 116 additions and 65 deletions

View File

@ -5,7 +5,6 @@ test -s "/etc/sysconfig/syslog" && \
run_dir="RUN_DIR"
cfg_file="ADDITIONAL_SOCKETS"
env_file="SERVICE_ENV_PARAMS"
umask 0022
/bin/mkdir -p -m 0755 "${run_dir}"
@ -32,12 +31,5 @@ if test ! -e /dev/xconsole ; then
/bin/chown root:tty /dev/xconsole
fi
#
# Construct rsyslog.service start parameters
#
compat="${RSYSLOGD_COMPAT_VERSION:-${RSYSLOGD_NATIVE_VERSION}}"
params="${compat:+-c ${compat}}${RSYSLOGD_PARAMS:+ ${RSYSLOGD_PARAMS}}"
echo "RSYSLOGD_PARAMS=\"${params}\"" > "${env_file}"
exit 0

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Mon Nov 12 17:21:43 UTC 2012 - mt@suse.com
- Removed handling of the -c <compat version> option which is
obsolete in rsyslog-7.x.
- Fixed build requires / deps to work on 12.x and SLE-11-SP2.
- Initialized RSYSLOG_PARAMS env variable in service file.
- Marked additional log socket config as ghost.
-------------------------------------------------------------------
Fri Nov 9 13:38:35 UTC 2012 - mt@suse.com

View File

@ -6,8 +6,9 @@ Before=syslog.target
Conflicts=syslog-ng.service syslogd.service
[Service]
Environment=RSYSLOGD_PARAMS=
ExecStartPre=@sbindir@/rsyslog-service-prepare
EnvironmentFile=-SERVICE_ENV_PARAMS
EnvironmentFile=-/etc/sysconfig/syslog
ExecStart=@sbindir@/rsyslogd -n ${RSYSLOGD_PARAMS}
Sockets=syslog.socket
StandardOutput=null

View File

@ -22,36 +22,55 @@ License: (GPL-3.0+ and Apache-2.0)
Group: System/Daemons
Version: 7.2.1
Release: 0
%if 0%{?suse_version} >= 1210
%bcond_without systemd
%bcond_without udpspoof
%bcond_without dbi
%else
%bcond_with systemd
%bcond_with udpspoof
%bcond_with dbi
%endif
%if 0%{?suse_version} >= 1230
%bcond_with systemv
%else
%bcond_without systemv
%endif
%bcond_without gssapi
%bcond_without gnutls
%bcond_without dbi
%bcond_without mysql
%bcond_without pgsql
%bcond_without relp
%bcond_without snmp
%bcond_without udpspoof
%bcond_without diagtools
%bcond_without mmnormalize
%define upstream_version %{version}
%define rsyslogdocdir %{_docdir}/%{name}
%define rsyslog_rundir %{_localstatedir}/run/rsyslog
%define rsyslog_service_env %{rsyslog_rundir}/rsyslogd.env
%define rsyslog_sockets_cfg %{rsyslog_rundir}/additional-log-sockets.conf
%define rsyslog_module_dir_nodeps %{_libdir}/rsyslog/
%define rsyslog_module_dir_withdeps %{_libdir}/rsyslog/
Url: http://www.rsyslog.com/
%if %{with systemd}
Provides: syslog
Provides: sysvinit(syslog)
Conflicts: otherproviders(syslog)
Requires(prereq): syslog-service
BuildConflicts: klogd
Requires(pre): syslog-service
Requires(pre): %fillup_prereq
%if %{with systemv}
Requires(pre): %insserv_prereq
%endif
%{?systemd_requires}
BuildRequires: pkgconfig(systemd)
%else
Requires(pre): %insserv_prereq %fillup_prereq /etc/init.d/syslog
BuildRequires: klogd
%endif
BuildRequires: dos2unix
BuildRequires: openssl-devel
BuildRequires: pcre-devel
BuildRequires: pkgconfig
BuildRequires: syslog-service
BuildRequires: zlib-devel
%{?systemd_requires}
%if %{with gssapi}
BuildRequires: krb5-devel
%endif
@ -85,11 +104,24 @@ BuildRequires: liblognorm-devel
%endif
# mmjsonparse needs liblognorm,
# but json check is unconditional
%if 0%{?suse_version} >= 1210
BuildRequires: pkgconfig(json) >= 0.9
BuildRequires: pkgconfig(libee) >= 0.4.0
BuildRequires: pkgconfig(libestr) >= 0.1.2
BuildRequires: pkgconfig(systemd)
%else
BuildRequires: libee-devel
BuildRequires: libestr-devel
BuildRequires: libjson-devel
%endif
%if 0%{?suse_version} >= 1220
BuildRequires: pkgconfig(uuid) >= 2.21.0
%else
BuildRequires: libuuid-devel
%endif
%if %{with systemd}
%{?systemd_requires}
BuildRequires: pkgconfig(systemd)
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source0: http://www.rsyslog.com/files/download/%{name}/%{name}-%{upstream_version}.tar.gz
Source1: rsyslog.sysconfig
@ -275,13 +307,14 @@ This module provides a UDP forwarder that allows changing the sender address.
%prep
%setup -q -n %{name}-%{upstream_version}
%if %{with systemd}
for file in rsyslog-service-prepare rsyslog.service.in ; do
sed \
-e 's;RUN_DIR;%{rsyslog_rundir};g' \
-e 's;ADDITIONAL_SOCKETS;%{rsyslog_sockets_cfg};g' \
-e 's;SERVICE_ENV_PARAMS;%{rsyslog_service_env};g' \
"%{_sourcedir}/${file}.in" > "${file}"
done
%endif
dos2unix doc/*.html
%build
@ -397,7 +430,13 @@ if test "%{_sbindir}" != "/sbin" ; then
ln -sf %{_sbindir}/rsyslogd $RPM_BUILD_ROOT/sbin/rsyslogd
fi
#
%if %{with systemd} && ! %{with systemv}
install -m755 rsyslog-service-prepare %{buildroot}%{_sbindir}/
%else
if test -e %{buildroot}%{_unitdir}/rsyslog.service ; then
rm -f %{buildroot}%{_unitdir}/rsyslog.service
fi
%endif
#
install -d -m0755 %{buildroot}%{_sysconfdir}/rsyslog.d
install -d -m0755 %{buildroot}%{_localstatedir}/run/rsyslog
@ -420,12 +459,7 @@ install -m0600 rsyslog.d.remote.conf.$$ \
%{buildroot}%{_sysconfdir}/rsyslog.d/remote.conf
#
install -d -m0755 %{buildroot}/var/adm/fillup-templates
# native version for the '-c <compat version>' parameter
rsyslogd_version=%{version}
rsyslogd_version=${rsyslogd_version//.*/}
sed -e "s/@RSYSLOGD_VERSION@/${rsyslogd_version}/g" \
< %{_sourcedir}/rsyslog.sysconfig > rsyslog.sysconfig
install -m0600 rsyslog.sysconfig \
install -m0600 %{_sourcedir}/rsyslog.sysconfig \
%{buildroot}/var/adm/fillup-templates/sysconfig.syslog-rsyslog
#
rm -f doc/Makefile*
@ -442,14 +476,22 @@ install -m644 plugins/ommysql/createDB.sql \
install -m644 plugins/ompgsql/createDB.sql \
%{buildroot}%{rsyslogdocdir}/pgsql-createDB.sql
%endif
# create ghosts
install -d -m0755 %{buildroot}%{rsyslog_rundir}
touch %{buildroot}%{rsyslog_sockets_cfg}
chmod 644 %{buildroot}%{rsyslog_sockets_cfg}
%clean
if [ -n "%{buildroot}" ] && [ "%{buildroot}" != "/" ] ; then
rm -rf "%{buildroot}"
fi
%if %{with systemd} && ! %{with systemv}
%pre
%service_add_pre rsyslog.service
%{service_add_pre rsyslog.service}
%endif
%post
#
@ -459,13 +501,25 @@ fi
#
# remove obsolete variables
#
%{remove_and_set -n syslog SYSLOG_DAEMON}
%{remove_and_set -n syslog SYSLOG_REQUIRES_NETWORK}
%{remove_and_set -n syslog RSYSLOGD_NATIVE_VERSION}
%{remove_and_set -n syslog SYSLOG_DAEMON SYSLOG_REQUIRES_NETWORK}
%{remove_and_set -n syslog RSYSLOGD_COMPAT_VERSION RSYSLOGD_NATIVE_VERSION}
%if %{with systemv}
%{fillup_and_insserv -ny syslog syslog}
%endif
#
# add RSYSLOGD_* variables
#
%{fillup_only -ns syslog rsyslog}
%if %{with systemv}
#
# switch SYSLOG_DAEMON to outself
#
if test -f etc/sysconfig/syslog ; then
sed -i \
-e 's/^SYSLOG_DAEMON=.*/SYSLOG_DAEMON="rsyslogd"/g' \
etc/sysconfig/syslog
fi
%endif
#
# Do not use multiple facilities with the same priority pattern.
# It causes start failure since rsyslog-6.4.x (bnc#780607).
@ -505,28 +559,51 @@ touch var/log/NetworkManager; chmod 640 var/log/NetworkManager
mkdir -p -m750 ".%{rsyslog_rundir}"
touch ".%{rsyslog_sockets_cfg}"
chmod 640 ".%{rsyslog_sockets_cfg}"
touch ".%{rsyslog_service_env}"
chmod 640 ".%{rsyslog_service_env}"
#
# Enable the rsyslogservice to be started by systemd
#
%service_add_post rsyslog.service
%if %{with systemd} && ! %{with systemv}
%{service_add_post rsyslog.service}
%endif
%preun
#
# stop the rsyslogd daemon when it is running
#
%service_del_preun rsyslog.service
%if %{with systemd} && ! %{with systemv}
%{service_del_preun rsyslog.service}
%else
%{stop_on_removal syslog}
#
# reset SYSLOG_DAEMON variable on removal
#
if test "$1" = "0" -a -f etc/sysconfig/syslog ; then
sed -i \
-e 's/^SYSLOG_DAEMON=.*/SYSLOG_DAEMON=""/g' \
etc/sysconfig/syslog
fi
%endif
%postun
#
# update linker caches
#
/sbin/ldconfig
%if %{with systemd} && ! %{with systemv}
#
# cleanup init scripts
#
%service_del_postun rsyslog.service
%{service_del_postun rsyslog.service}
%else
#
# stop the rsyslogd daemon when it is running
#
%{restart_on_update syslog}
#
# cleanup init scripts
#
%{insserv_cleanup}
%endif
%files
%defattr(-,root,root)
@ -578,8 +655,12 @@ chmod 640 ".%{rsyslog_service_env}"
%doc %{rsyslogdocdir}/COPYING.LESSER
%dir %{_localstatedir}/spool/rsyslog
/var/adm/fillup-templates/sysconfig.syslog-rsyslog
%attr(0755,root,root) %dir %ghost %{rsyslog_rundir}
%attr(0644,root,root) %ghost %{rsyslog_sockets_cfg}
%if %{with systemd} && ! %{with systemv}
%{_sbindir}/rsyslog-service-prepare
%{_unitdir}/rsyslog.service
%endif
%files doc
%defattr(-,root,root)

View File

@ -1,35 +1,3 @@
## Type: list(@RSYSLOGD_VERSION@)
## Default: "@RSYSLOGD_VERSION@"
## Config: ""
## ServiceRestart: syslog
#
# The native version compatibility level of the current rsyslogd.
#
# Note, that this variable is read-only -- please do not change it!
# Instead, please adopt the RSYSLOGD_COMPAT_VERSION variable.
#
# This variable will be updated while every installation/upgrade of
# the rsyslog daemon package.
#
RSYSLOGD_NATIVE_VERSION="@RSYSLOGD_VERSION@"
## Type: integer(0:@RSYSLOGD_VERSION@)
## Default: ""
## Config: ""
## ServiceRestart: syslog
#
# Version compatibility level to run rsyslogd with (-c parameter).
# Set to the desired version number rsyslogd shall be compatible with.
#
# Default is to run in native mode if the currently installed rsyslog
# daemon version.
#
# Note: Changes to this variable may need adoption of the config file
# or break features used in the /etc/init.d/syslog script by default.
#
RSYSLOGD_COMPAT_VERSION=""
## Type: string
## Default: ""
## Config: ""