* Added the build requirement systemd-units (macro %%_unitdir)

https://fedoraproject.org/wiki/Packaging:Guidelines:Systemd
 * Dropped the redefinition of the %%_localstatedir macro
 * Use %%global instead of %%define
 * Minor modifications of the %%post, %%preun and %%postun scripts
   https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd
 * Expanded tabs to spaces (also added a vim modeline)
This commit is contained in:
Jose Pedro Oliveira 2011-05-09 05:27:51 +01:00
parent c09f0f395d
commit 9d4f221523
1 changed files with 61 additions and 46 deletions

View File

@ -1,13 +1,11 @@
%define evtlog_ver 0.2.12
%global evtlog_ver 0.2.12
%define _sbindir /sbin
%define _localstatedir /var/lib/syslog-ng
%define _libdir /%{_lib}
%define system_service /lib/systemd/system
%global _sbindir /sbin
%global _libdir /%{_lib}
Name: syslog-ng
Version: 3.2.3
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Next-generation syslog server
Group: System Environment/Daemons
@ -21,6 +19,7 @@ Source4: syslog-ng.logrotate
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: systemd-units
BuildRequires: pkgconfig
BuildRequires: libtool
BuildRequires: bison
@ -75,21 +74,21 @@ developing applications that use %{name}.
%build
%configure \
--prefix=/ \
--libdir=/%{_lib} \
--includedir=%{_includedir} \
--enable-ipv6 \
--sysconfdir=%{_sysconfdir}/%{name} \
--enable-tcp-wrapper \
--enable-pcre \
--enable-shared \
--disable-static \
--disable-sql \
--disable-ssl \
--with-module-dir=/%{_lib}/%{name} \
--enable-spoof-source \
--enable-dynamic-linking \
--enable-systemd
--prefix=/ \
--libdir=/%{_lib} \
--includedir=%{_includedir} \
--sysconfdir=%{_sysconfdir}/%{name} \
--with-module-dir=/%{_lib}/%{name} \
--enable-ipv6 \
--enable-tcp-wrapper \
--enable-pcre \
--enable-spoof-source \
--disable-sql \
--disable-ssl \
--enable-shared \
--disable-static \
--enable-dynamic-linking \
--enable-systemd
# remove rpath
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
@ -106,7 +105,7 @@ make DESTDIR=%{buildroot} install
%{__install} -p -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/%{name}/syslog-ng.conf
# install the service script
%{__install} -p -D -m 644 %{SOURCE2} %{buildroot}/%{system_service}/%{name}.service
%{__install} -p -D -m 644 %{SOURCE2} %{buildroot}/%{_unitdir}/%{name}.service
%{__install} -d -m 755 %{buildroot}%{_sysconfdir}/sysconfig
%{__install} -p -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
@ -115,59 +114,65 @@ make DESTDIR=%{buildroot} install
%{__install} -p -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/logrotate.d/syslog
# make local state dir
%{__install} -d -m 755 %{buildroot}/%{_localstatedir}
%{__install} -d -m 755 %{buildroot}/%{_sharedstatedir}/%{name}
# fix authors file
/usr/bin/iconv -f iso8859-1 -t utf-8 AUTHORS > AUTHORS.conv && \
%{__mv} -f AUTHORS.conv AUTHORS
%{__mv} -f AUTHORS.conv AUTHORS
# install vim files
%{__install} -d -m 755 %{buildroot}%{_datadir}/%{name}
%{__install} -p -m 644 contrib/syslog-ng.vim %{buildroot}%{_datadir}/%{name}
for vimver in 70 71 72 73 ; do
%{__install} -d -m 755 %{buildroot}%{_datadir}/vim/vim$vimver/syntax
cd %{buildroot}%{_datadir}/vim/vim$vimver/syntax
ln -s ../../../%{name}/syslog-ng.vim .
cd -
%{__install} -d -m 755 %{buildroot}%{_datadir}/vim/vim$vimver/syntax
cd %{buildroot}%{_datadir}/vim/vim$vimver/syntax
ln -s ../../../%{name}/syslog-ng.vim .
cd -
done
ldconfig -N -n %{buildroot}/%{_lib}
find %{buildroot} -name *.la -exec rm -f '{}' \;
%clean
rm -rf %{buildroot}
%post
/sbin/ldconfig
/bin/systemctl daemon-reload || :
%preun
if [ "$1" = 0 ]; then
/bin/systemctl stop %{name}.service >/dev/null 2>&1 || :
/bin/systemctl disable %{name}.service >/dev/null 2>&1 || :
if [ $1 -eq 1 ] ; then
# Initial installation
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
%preun
if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
/bin/systemctl disable %{name}.service >/dev/null 2>&1 || :
/bin/systemctl stop %{name}.service >/dev/null 2>&1 || :
fi
%postun
/sbin/ldconfig
if [ "$1" -ge 1 ]; then
/bin/systemctl condrestart %{name}.service >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
/bin/systemctl condrestart %{name}.service >/dev/null 2>&1 || :
fi
%triggerun -- syslog-ng < 3.2.3
if /sbin/chkconfig --level 3 %{name} ; then
/bin/systemctl enable %{name}.service >/dev/null 2>&1 || :
/bin/systemctl enable %{name}.service >/dev/null 2>&1 || :
fi
%triggerin -- vim-common
VIMVERNEW=`rpm -q --qf='%%{epoch}:%%{version}\n' vim-common | sort | tail -n 1 | sed -e 's/[0-9]*://' | sed -e 's/\.[0-9]*$//' | sed -e 's/\.//'`
[ -d %{_datadir}/vim/vim${VIMVERNEW}/syntax ] && \
cd %{_datadir}/vim/vim${VIMVERNEW}/syntax && \
ln -sf ../../../%{name}/syslog-ng.vim . || :
cd %{_datadir}/vim/vim${VIMVERNEW}/syntax && \
ln -sf ../../../%{name}/syslog-ng.vim . || :
%triggerun -- vim-common
VIMVEROLD=`rpm -q --qf='%%{epoch}:%%{version}\n' vim-common | sort | head -n 1 | sed -e 's/[0-9]*://' | sed -e 's/\.[0-9]*$//' | sed -e 's/\.//'`
@ -177,10 +182,10 @@ VIMVEROLD=`rpm -q --qf='%%{epoch}:%%{version}\n' vim-common | sort | head -n 1 |
VIMVEROLD=`rpm -q --qf='%%{epoch}:%%{version}\n' vim-common | sort | head -n 1 | sed -e 's/[0-9]*://' | sed -e 's/\.[0-9]*$//' | sed -e 's/\.//'`
VIMVERNEW=`rpm -q --qf='%%{epoch}:%%{version}\n' vim-common | sort | tail -n 1 | sed -e 's/[0-9]*://' | sed -e 's/\.[0-9]*$//' | sed -e 's/\.//'`
if [ $1 = 1 ]; then
rm -f %{_datadir}/vim/vim${VIMVEROLD}/syntax/syslog-ng.vim || :
[ -d %{_datadir}/vim/vim${VIMVERNEW}/syntax ] && \
cd %{_datadir}/vim/vim${VIMVERNEW}/syntax && \
ln -sf ../../../%{name}/syslog-ng.vim . || :
rm -f %{_datadir}/vim/vim${VIMVEROLD}/syntax/syslog-ng.vim || :
[ -d %{_datadir}/vim/vim${VIMVERNEW}/syntax ] && \
cd %{_datadir}/vim/vim${VIMVERNEW}/syntax && \
ln -sf ../../../%{name}/syslog-ng.vim . || :
fi
@ -196,9 +201,9 @@ fi
%config(noreplace) %{_sysconfdir}/%{name}/scl.conf
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%config(noreplace) %{_sysconfdir}/logrotate.d/syslog
%{system_service}/%{name}.service
%{_unitdir}/%{name}.service
%dir %{_localstatedir}
%dir %{_sharedstatedir}/%{name}
%{_sbindir}/%{name}
%{_sbindir}/syslog-ng-ctl
%{_bindir}/loggen
@ -225,6 +230,15 @@ fi
%changelog
* Mon May 9 2011 Jose Pedro Oliveira <jpo at di.uminho.pt> - 3.2.3-3
- Added the build requirement systemd-units (macro %%_unitdir)
https://fedoraproject.org/wiki/Packaging:Guidelines:Systemd
- Dropped the redefinition of the %%_localstatedir macro
- Use %%global instead of %%define
- Minor modifications of the %%post, %%preun and %%postun scripts
https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd
- Expanded tabs to spaces (also added a vim modeline)
* Fri May 6 2011 Jose Pedro Oliveira <jpo at di.uminho.pt> - 3.2.3-2
- Fix systemd-related scriptlets (Bill Nottingham)
- Explicitly add --enable-systemd to configure's command line
@ -578,3 +592,4 @@ fi
* Sun Dec 08 2002 Richard E. Perlotto II <richard@perlotto.com> 1.5.23-1
- Updated file with notes and PGP signatures
# vim:set ai ts=4 sw=4 sts=4 et: