[sqlgrey] Latest upstream, migrate to systemd.
Jon Ciesla
limb at fedoraproject.org
Tue Apr 17 15:49:32 UTC 2012
commit 0824325c9b5c0c2e365fb288b77f8113a6e1df45
Author: Jon Ciesla <limburgher at gmail.com>
Date: Tue Apr 17 10:49:17 2012 -0500
Latest upstream, migrate to systemd.
sqlgrey.spec | 67 ++++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 51 insertions(+), 16 deletions(-)
---
diff --git a/sqlgrey.spec b/sqlgrey.spec
index 9211c33..eda5f74 100644
--- a/sqlgrey.spec
+++ b/sqlgrey.spec
@@ -1,12 +1,12 @@
Name: sqlgrey
-Version: 1.7.6
-Release: 5%{?dist}
+Version: 1.8.0
+Release: 1%{?dist}
Summary: Postfix grey-listing policy service
Group: System Environment/Daemons
License: GPLv2+
URL: http://sqlgrey.sourceforge.net/
-Source0: http://dl.sourceforge.net/sqlgrey/sqlgrey-%{version}.tar.bz2
-Source1: sqlgrey.init
+Source0: http://dl.sourceforge.net/sqlgrey/sqlgrey-%{version}.tar.gz
+Source1: sqlgrey.service
Patch0: sqlgrey-1.7.4-sqlite.patch
Patch1: sqlgrey-1.7.4-warnings.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -14,11 +14,15 @@ BuildArch: noarch
Requires: postfix
Requires: perl(DBD::SQLite)
-Requires(post): /sbin/chkconfig
-Requires(post): /sbin/service
-Requires(preun): /sbin/chkconfig
-Requires(preun): /sbin/service
-Requires(postun): /sbin/service
+#Requires(post): /sbin/chkconfig
+#Requires(post): /sbin/service
+#Requires(preun): /sbin/chkconfig
+#Requires(preun): /sbin/service
+#Requires(postun): /sbin/service
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+
%description
SQLgrey is a Postfix grey-listing policy service with auto-white-listing
@@ -37,7 +41,8 @@ make
%install
rm -rf $RPM_BUILD_ROOT
make rh-install ROOTDIR=$RPM_BUILD_ROOT
-install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/init.d/sqlgrey
+install -D -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/sqlgrey.service
+rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/init.d/
mkdir -p -m 755 $RPM_BUILD_ROOT%{_var}/lib
mkdir -m 750 $RPM_BUILD_ROOT%{_var}/lib/sqlgrey
touch $RPM_BUILD_ROOT%{_var}/lib/sqlgrey/sqlgrey.db
@@ -48,7 +53,7 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%doc Changelog CONTRIB COPYING FAQ HOWTO README* TODO
-%{_sysconfdir}/init.d/sqlgrey
+%{_unitdir}/sqlgrey.service
%{_sbindir}/sqlgrey
%{_sbindir}/update_sqlgrey_config
%{_bindir}/sqlgrey-logstats.pl
@@ -72,16 +77,46 @@ if ! id sqlgrey &>/dev/null ; then
fi
%post
-/sbin/chkconfig --add sqlgrey || :
-/sbin/service sqlgrey condrestart || :
+#/sbin/chkconfig --add sqlgrey || :
+#/sbin/service sqlgrey condrestart || :
+if [ $1 -eq 1 ] ; then
+ # Initial installation
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
%preun
-if [ "$1" -eq 0 ]; then
- /sbin/service sqlgrey stop || :
- /sbin/chkconfig --del sqlgrey || :
+#if [ "$1" -eq 0 ]; then
+# /sbin/service sqlgrey stop || :
+# /sbin/chkconfig --del sqlgrey || :
+#fi
+if [ $1 -eq 0 ] ; then
+ # Package removal, not upgrade
+ /bin/systemctl --no-reload disable sqlgrey.service > /dev/null 2>&1 || :
+ /bin/systemctl stop sqlgrey.service > /dev/null 2>&1 || :
+fi
+
+%postun
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+ # Package upgrade, not uninstall
+ /bin/systemctl try-restart sqlgrey.service >/dev/null 2>&1 || :
fi
+%triggerun -- sqlgrey < 1.8.0-1
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply sqlgrey
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save sqlgrey >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del sqlgrey >/dev/null 2>&1 || :
+/bin/systemctl try-restart sqlgrey.service >/dev/null 2>&1 || :
+
%changelog
+* Tue Apr 17 2012 Jon Ciesla <limburgher at gmail.com> - 1.8.0-1
+- Latest upstream.
+- Migrate to ssytemd, BZ 722356.
+
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.7.6-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
More information about the scm-commits
mailing list