Accepting request 140744 from home:mtomaschewski:branches:Base:System

fixes / cleanups

OBS-URL: https://build.opensuse.org/request/show/140744
OBS-URL: https://build.opensuse.org/package/show/Base:System/rsyslog?expand=0&rev=109
This commit is contained in:
2012-11-09 13:40:18 +00:00
committed by Git OBS Bridge
parent 2a68653f12
commit 1bc12963fa
5 changed files with 195 additions and 156 deletions

View File

@@ -1,12 +0,0 @@
--- rsyslog-7.2.1/rsyslog.service.in 2012-10-22 12:44:43.000000000 +0200
+++ new/rsyslog.service.in 2012-11-06 13:59:17.065706770 +0100
@@ -2,7 +2,8 @@
Description=System Logging Service
[Service]
-ExecStart=@sbindir@/rsyslogd -n
+EnvironmentFile=-/etc/sysconfig/rsyslog
+ExecStart=@sbindir@/rsyslogd -n $SYSLOGD_OPTIONS
Sockets=syslog.socket
StandardOutput=null

View File

@@ -0,0 +1,46 @@
#!/bin/sh
test -s "/etc/sysconfig/syslog" && \
. "/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}"
#
# Prepare include with sockets in chroot's
#
> "${cfg_file}"
for variable in ${!SYSLOGD_ADDITIONAL_SOCKET*}; do
eval value=\$$variable
test -z "$value" && continue
test -d "${value%/*}" || continue
echo "\$AddUnixListenSocket $value"
done >> "${cfg_file}"
#
# make sure xconsole exists and is a pipe
#
if test -e /dev/xconsole -a ! -p /dev/xconsole ; then
/bin/rm -f /dev/xconsole
fi
if test ! -e /dev/xconsole ; then
/bin/mknod -m 0600 /dev/xconsole p
/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}\""
echo "SYSLOG_DAEMON=\"rsyslogd\""
} > "${env_file}"
exit 0

View File

@@ -1,3 +1,14 @@
-------------------------------------------------------------------
Fri Nov 9 13:38:35 UTC 2012 - mt@suse.com
- Readded things removed in previous change, that is compat version
and params variable use, generation of additional (chroot) log
sockets include file, xconsole handling in rsyslog.service.
- Fixed liblognorm conditional build flag dependencies, removed all
suse version dependencies.
- Changed to install in /usr/sbin, compatibility link in /sbin.
- Added klogd to build conflicts to resolve build service deps
-------------------------------------------------------------------
Tue Nov 6 12:36:54 UTC 2012 - tittiatcoke@gmail.com

17
rsyslog.service.in.in Normal file
View File

@@ -0,0 +1,17 @@
[Unit]
Description=System Logging Service
Requires=var-run.mount syslog.target
After=var-run.mount
Before=syslog.target
Conflicts=syslog-ng.service syslogd.service
[Service]
ExecStartPre=@sbindir@/rsyslog-service-prepare
EnvironmentFile=-SERVICE_ENV_PARAMS
ExecStart=@sbindir@/rsyslogd -n ${RSYSLOGD_PARAMS}
Sockets=syslog.socket
StandardOutput=null
[Install]
WantedBy=multi-user.target
Alias=syslog.service

View File

@@ -22,57 +22,45 @@ License: (GPL-3.0+ and Apache-2.0)
Group: System/Daemons
Version: 7.2.1
Release: 0
# for setting those bcond_with* configs see
# http://lizards.opensuse.org/2008/09/12/conditional-features-aka-use-flags/
%if 0%{?suse_version} >= 1140
%bcond_without dbi
%else
%bcond_with dbi
%endif
%if 0%{?suse_version} >= 1140
%bcond_without systemd
%else
%bcond_with systemd
%endif
%if 0%{?suse_version} >= 1210
%bcond_without syslogservice
%else
%bcond_with syslogservice
%endif
%if 0%{?suse_version} >= 1130
%bcond_without relp
%else
%bcond_with relp
%endif
%if 0%{?suse_version} >= 1130
%bcond_without mmnormalize
%else
%bcond_with mmnormalize
%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 _sbindir /sbin
%define rsyslogdocdir %{_docdir}/%{name}
%define additional_sockets %{_localstatedir}/run/rsyslog/additional-log-sockets.conf
%define _libdir /%_lib
%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 %{_prefix}/%{_lib}/rsyslog/
%define rsyslog_module_dir_withdeps %{_libdir}/rsyslog/
Url: http://www.rsyslog.com/
Provides: syslog
Provides: sysvinit(syslog)
Conflicts: otherproviders(syslog)
BuildConflicts: klogd
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
%if %{with gnutls}
BuildRequires: libgcrypt-devel
BuildRequires: libgnutls-devel
%endif
%if %{with dbi}
BuildRequires: libdbi-devel
%endif
%if %{with mysql}
BuildRequires: mysql-devel
%endif
@@ -82,54 +70,32 @@ BuildRequires: net-snmp-devel
%if %{with pgsql}
BuildRequires: postgresql-devel
%endif
%if %{with gnutls}
BuildRequires: libgcrypt-devel
BuildRequires: libgnutls-devel
%endif
%if %{with dbi}
BuildRequires: libdbi-devel
%endif
%if %{with relp}
# RELP support
BuildRequires: librelp-devel
%endif
%if %{with udpspoof}
# UDP spoof support
BuildRequires: libnet-devel
%endif
%if %{with mmnormalize}
# mmnormalize support
BuildRequires: liblognorm-devel
%endif
# UDP spoof support
%if 0%{?suse_version} >= 1140
BuildRequires: libnet-devel
%else
BuildRequires: libnet
%endif
%if %{with systemd}
# The systemd package provides
# /usr/share/doc/packages/systemd/sd-daemon.[ch]
# files instead of a lib ... See also bug 656259.
%if 0%{?suse_version} > 1140
BuildRequires: systemd-devel
%else
BuildRequires: systemd
%endif
%endif
# mmjsonparse needs liblognorm,
# but json check is unconditional
BuildRequires: pkgconfig(json) >= 0.9
BuildRequires: pkgconfig(libee) >= 0.4.0
BuildRequires: pkgconfig(libestr) >= 0.1.2
BuildRequires: pkgconfig(systemd)
BuildRequires: pkgconfig(uuid) >= 2.21.0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source0: http://www.rsyslog.com/files/download/%{name}/%{name}-%{upstream_version}.tar.gz
Source1: rsyslog.sysconfig
Source2: rsyslog.conf.in
Source4: rsyslog.d.remote.conf.in
# FIX-OPENSUSE Adjust service file to work correctly. Based on a fedora patch - tittiatcoke@gmail.com
Patch1: rsyslog-5.8.11-systemd.patch
%if 0%{?suse_version} >= 1220
# This provide is purely to be used for the 12.3 Milestones.
Obsoletes: syslog-service
Provides: sysvinit(syslog)
%endif
%{?systemd_requires}
Source5: rsyslog-service-prepare.in
Source6: rsyslog.service.in.in
%description
Rsyslog is an enhanced multi-threaded syslogd supporting, among others,
@@ -151,6 +117,8 @@ package.
This package provides additional documentation for rsyslog.
%if %{with diagtools}
%package diag-tools
Requires: %{name} = %{version}
Summary: Diagnostic tools
@@ -163,6 +131,8 @@ package.
This package provides additional diagnostic tools (small helpers,
usually not needed).
%endif
%if %{with gssapi}
%package module-gssapi
@@ -176,6 +146,7 @@ package.
This module provides the support to receive syslog messages from the
network protected via Kerberos 5 encryption and authentication.
%endif
%if %{with mysql}
@@ -191,6 +162,7 @@ package.
This package provides a module with the support for logging into MySQL
databases.
%endif
%if %{with pgsql}
@@ -205,6 +177,7 @@ Rsyslog is an enhanced multi-threaded syslog daemon. See rsyslog
package.
This module provides the support for logging into PostgreSQL databases.
%endif
%if %{with dbi}
@@ -220,6 +193,7 @@ package.
This package provides a module with the support for logging into DBI
supported databases.
%endif
%if %{with snmp}
@@ -235,6 +209,7 @@ package.
This module provides the ability to send syslog messages as an SNMPv1 &
v2c traps.
%endif
%if %{with gnutls}
@@ -282,6 +257,8 @@ This module provides log normalizing support.
%endif
%if %{with udpspoof}
%package module-udpspoof
Requires: %{name} = %{version}
Summary: UDP spoof support module for syslog
@@ -293,24 +270,21 @@ package.
This module provides a UDP forwarder that allows changing the sender address.
%endif
%prep
%setup -q -n %{name}-%{upstream_version}
%patch1 -p1
%if %{with systemd}
%if 0%{?suse_version} <= 1140
# Bug: https://bugzilla.novell.com/show_bug.cgi?id=656259
# install the files systemd provides rather than what we provide.
# On newer systems, systemd-devel provides them.
cp -a /usr/share/doc/packages/systemd/sd-daemon.[ch] runtime/
%endif
%endif
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
dos2unix doc/*.html
%build
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -W -Wall -I../grammar -I../../grammar"
%if 0%{?suse_version} > 1000 && 0%{?suse_version} < 1030
export CFLAGS="$CFLAGS -fstack-protector"
%endif
# needs liblogging
# --enable-rfc3195 \
# needs java
@@ -325,30 +299,28 @@ export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -W -Wall -I../grammar -I../..
--enable-klog \
--enable-kmsg \
--enable-inet \
--enable-rsyslogd \
%if %{with gnutls}
--enable-gnutls \
%endif
--enable-rsyslogd \
%if %{with gssapi}
--enable-gssapi-krb5 \
%endif
%if %{with dbi}
--enable-libdbi \
%endif
%if %{with mysql}
--enable-mysql \
%endif
%if %{with pgsql}
--enable-pgsql \
%endif
%if %{with dbi}
--enable-libdbi \
%endif
%if %{with relp}
--enable-relp \
%endif
%if %{with mmnormalize}
--enable-mmnormalize \
%endif
%if %{with snmp}
--enable-snmp \
--enable-mmsnmptrapd \
%endif
--enable-mail \
--enable-imfile \
@@ -356,18 +328,24 @@ export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -W -Wall -I../grammar -I../..
--enable-impstats \
--enable-omprog \
--enable-omuxsock \
%if %{with udpspoof}
--enable-omudpspoof \
%endif
--enable-omstdout \
--enable-pmlastmsg \
--enable-diagtools \
--enable-pmcisconames \
--enable-pmaixforwardedfrom \
--enable-pmsnare \
--enable-pmrfc3164sd \
--enable-omruleset \
--enable-mmsnmptrapd \
%if %{with mmnormalize}
--enable-mmnormalize \
--enable-mmjsonparse \
--enable-mmaudit \
%endif
%if %{with diagtools}
--enable-diagtools \
%endif
--disable-static
make %{?_smp_mflags:%{_smp_mflags}} V=1
@@ -380,35 +358,45 @@ rm -f %{buildroot}%{rsyslog_module_dir_nodeps}/*.la
# move all modules linking libraries in /usr to /usr/lib[64]
# the user has to specify them with full path then...
install -d -m0755 %{buildroot}%{rsyslog_module_dir_withdeps}
for mod in \
if test "%{rsyslog_module_dir_nodeps}" != "%{rsyslog_module_dir_withdeps}" ; then
for mod in \
%if %{with gnutls}
lmnsd_gtls.so \
%endif
%if %{with gssapi}
omgssapi.so imgssapi.so lmgssutil.so \
%endif
%if %{with mysql}
ommysql.so \
%endif
%if %{with pgsql}
ompgsql.so \
%endif
%if %{with snmp}
omsnmp.so \
omgssapi.so imgssapi.so lmgssutil.so \
%endif
%if %{with dbi}
omlibdbi.so \
omlibdbi.so \
%endif
%if %{with mysql}
ommysql.so \
%endif
%if %{with pgsql}
ompgsql.so \
%endif
%if %{with relp}
imrelp.so omrelp.so \
imrelp.so omrelp.so \
%endif
%if %{with snmp}
omsnmp.so \
%endif
%if %{with mmnormalize}
mmnormalize.so \
mmnormalize.so \
mmjsonparse.so \
mmaudit.so \
%endif
%if %{with gnutls}
lmnsd_gtls.so \
%endif
; do
mv -f %{buildroot}%{rsyslog_module_dir_nodeps}/$mod \
%{buildroot}%{rsyslog_module_dir_withdeps}
done
; do
mv -f %{buildroot}%{rsyslog_module_dir_nodeps}/$mod \
%{buildroot}%{rsyslog_module_dir_withdeps}
done
fi
if test "%{_sbindir}" != "/sbin" ; then
install -d -m0755 %{buildroot}/sbin
ln -sf %{_sbindir}/rsyslogd $RPM_BUILD_ROOT/sbin/rsyslogd
fi
#
install -m755 rsyslog-service-prepare %{buildroot}%{_sbindir}/
#
install -d -m0755 %{buildroot}%{_sysconfdir}/rsyslog.d
install -d -m0755 %{buildroot}%{_localstatedir}/run/rsyslog
@@ -418,7 +406,7 @@ for file in rsyslog.conf rsyslog.d.remote.conf ; do
%ifarch s390 s390x
-e 's;tty10;console;g' \
%endif
-e 's;ADDITIONAL_SOCKETS;%{additional_sockets};g' \
-e 's;ADDITIONAL_SOCKETS;%{rsyslog_sockets_cfg};g' \
-e 's;ETC_RSYSLOG_CONF;%{_sysconfdir}/rsyslog.conf;g' \
-e 's;ETC_RSYSLOG_D_DIR;%{_sysconfdir}/rsyslog.d;g' \
-e 's;ETC_RSYSLOG_D_GLOB;%{_sysconfdir}/rsyslog.d/*.conf;g' \
@@ -444,6 +432,7 @@ install -d -m0755 %{buildroot}%{rsyslogdocdir}/
find ChangeLog README AUTHORS COPYING COPYING.LESSER rsyslog.conf doc \
\( -type d -exec install -m755 -d %{buildroot}%{rsyslogdocdir}/\{\} \; \) \
-o \( -type f -exec install -m644 \{\} %{buildroot}%{rsyslogdocdir}/\{\} \; \)
#
%if %{with mysql}
install -m644 plugins/ommysql/createDB.sql \
%{buildroot}%{rsyslogdocdir}/mysql-createDB.sql
@@ -466,26 +455,17 @@ fi
# update linker caches
#
/sbin/ldconfig
#
# 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}
#
# add RSYSLOGD_* variables
#
%{fillup_only -ns syslog rsyslog}
#
#
# check if daemon configured in SYSLOG_DAEMON is installed
# and switch to ourself if it's missed
#
source etc/sysconfig/syslog
replace_syslog=no
if test "$SYSLOG_DAEMON" != "rsyslogd" ; then
if test -z "$SYSLOG_DAEMON" || \
test ! -x sbin/${SYSLOG_DAEMON} ; then
replace_syslog=yes
fi
fi
if test "$replace_syslog" = "yes" ; then
sed -i -e 's/^SYSLOG_DAEMON=.*/SYSLOG_DAEMON="rsyslogd"/g' \
etc/sysconfig/syslog
fi
#
# Do not use multiple facilities with the same priority pattern.
# It causes start failure since rsyslog-6.4.x (bnc#780607).
#
@@ -521,10 +501,11 @@ touch var/log/NetworkManager; chmod 640 var/log/NetworkManager
#
# touch the additional log sockets config file
#
additional_sockets="%{additional_sockets}"
mkdir -p -m750 ${additional_sockets%/*}
touch "${additional_sockets#/}"
chmod 640 "${additional_sockets#/}"
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
#
@@ -542,20 +523,6 @@ chmod 640 "${additional_sockets#/}"
#
/sbin/ldconfig
#
# reset SYSLOG_DAEMON variable
#
if test -f etc/sysconfig/syslog ; then
source etc/sysconfig/syslog
if test "$SYSLOG_DAEMON" == "rsyslogd" ; then
sed -i -e 's/^SYSLOG_DAEMON=.*/SYSLOG_DAEMON=""/g' \
etc/sysconfig/syslog
fi
fi
#
# stop the rsyslogd daemon when it is running
#
%{restart_on_update syslog}
#
# cleanup init scripts
#
%service_del_postun rsyslog.service
@@ -566,6 +533,9 @@ fi
%config(noreplace) %attr(600,root,root) %{_sysconfdir}/rsyslog.conf
%config(noreplace) %attr(600,root,root) %{_sysconfdir}/rsyslog.d/remote.conf
%{_sbindir}/rsyslogd
%if "%{_sbindir}" != "/sbin"
/sbin/rsyslogd
%endif
%dir %{rsyslog_module_dir_nodeps}
%{rsyslog_module_dir_nodeps}/imfile.so
%{rsyslog_module_dir_nodeps}/imklog.so
@@ -591,9 +561,6 @@ fi
%{rsyslog_module_dir_nodeps}/omuxsock.so
%{rsyslog_module_dir_nodeps}/pmlastmsg.so
%{rsyslog_module_dir_nodeps}/impstats.so
%{rsyslog_module_dir_nodeps}/mmaudit.so
%{rsyslog_module_dir_nodeps}/mmjsonparse.so
%{rsyslog_module_dir_nodeps}/mmsnmptrapd.so
%{rsyslog_module_dir_nodeps}/pmaixforwardedfrom.so
%{rsyslog_module_dir_nodeps}/pmcisconames.so
%{rsyslog_module_dir_nodeps}/pmrfc3164sd.so
@@ -610,6 +577,7 @@ fi
%doc %{rsyslogdocdir}/COPYING.LESSER
%dir %{_localstatedir}/spool/rsyslog
/var/adm/fillup-templates/sysconfig.syslog-rsyslog
%{_sbindir}/rsyslog-service-prepare
%{_unitdir}/rsyslog.service
%files doc
@@ -617,11 +585,14 @@ fi
%dir %{rsyslogdocdir}
%doc %{rsyslogdocdir}/doc
%if %{with diagtools}
%files diag-tools
%defattr(-,root,root)
%{_sbindir}/msggen
%{_sbindir}/rsyslog_diag_hostname
%{_sbindir}/zpipe
%endif
%if %{with gssapi}
@@ -660,6 +631,7 @@ fi
%files module-snmp
%defattr(-,root,root)
%{rsyslog_module_dir_withdeps}/omsnmp.so
%{rsyslog_module_dir_nodeps}/mmsnmptrapd.so
%endif
%if %{with gnutls}
@@ -682,10 +654,15 @@ fi
%files module-mmnormalize
%defattr(-,root,root)
%{rsyslog_module_dir_withdeps}/mmnormalize.so
%{rsyslog_module_dir_withdeps}/mmjsonparse.so
%{rsyslog_module_dir_withdeps}/mmaudit.so
%endif
%if %{with udpspoof}
%files module-udpspoof
%defattr(-,root,root)
%{rsyslog_module_dir_nodeps}/omudpspoof.so
%endif
%changelog