[arm4] convert to systemd

Tom Callaway spot at fedoraproject.org
Thu Sep 8 19:49:13 UTC 2011


commit 55da90e0465f82298b3935180a0c7fea831651ca
Author: Tom "spot" Callaway <tcallawa at redhat.com>
Date:   Thu Sep 8 15:49:02 2011 -0400

    convert to systemd

 arm4-0.8.2-fix-ant-version-check.patch |   28 ++++++++++++++++++
 arm4-arm4.service                      |   11 +++++++
 arm4.spec                              |   49 +++++++++++++++----------------
 3 files changed, 63 insertions(+), 25 deletions(-)
---
diff --git a/arm4-0.8.2-fix-ant-version-check.patch b/arm4-0.8.2-fix-ant-version-check.patch
new file mode 100644
index 0000000..6b3b1a1
--- /dev/null
+++ b/arm4-0.8.2-fix-ant-version-check.patch
@@ -0,0 +1,28 @@
+diff -up arm4-0.8.2/configure.BAD arm4-0.8.2/configure
+--- arm4-0.8.2/configure.BAD	2011-09-08 15:39:43.205841133 -0400
++++ arm4-0.8.2/configure	2011-09-08 15:40:57.070908338 -0400
+@@ -23341,21 +23341,21 @@ echo $ECHO_N "checking for ant - version
+     else
+       ant_major_version=`$ANT -version | \
+            grep Ant | \
+-           sed 's/^[A-Za-z :]*\([0-9]*\)\.\{0,1\}\([0-9]*\)\.\{0,1\}\([0-9]*\).*/\1/'`
++           awk '{print $4}' | cut -d . -f 1`
+       if test "x${ant_major_version}" = "x" ; then
+          ant_major_version=0
+       fi
+ 
+       ant_minor_version=`$ANT -version | \
+            grep Ant | \
+-           sed 's/^[A-Za-z :]*\([0-9]*\)\.\{0,1\}\([0-9]*\)\.\{0,1\}\([0-9]*\).*/\2/'`
++           awk '{print $4}' | cut -d . -f 2`
+       if test "x${ant_minor_version}" = "x" ; then
+          ant_minor_version=0
+       fi
+ 
+       ant_micro_version=`$ANT -version | \
+            grep Ant | \
+-           sed 's/^[A-Za-z :]*\([0-9]*\)\.\{0,1\}\([0-9]*\)\.\{0,1\}\([0-9]*\).*/\3/'`
++           awk '{print $4}' | cut -d . -f 3`
+       if test "x${ant_micro_version}" = "x" ; then
+          ant_micro_version=0
+       fi
diff --git a/arm4-arm4.service b/arm4-arm4.service
new file mode 100644
index 0000000..6b8bdb9
--- /dev/null
+++ b/arm4-arm4.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=ARM4 daemon
+After=syslog.target
+
+[Service]
+Type=forking
+PIDFile=/var/run/arm4.pid
+ExecStart=/usr/bin/arm4_daemon
+
+[Install]
+WantedBy=multi-user.target
diff --git a/arm4.spec b/arm4.spec
index 079660a..8eac0f3 100644
--- a/arm4.spec
+++ b/arm4.spec
@@ -2,21 +2,23 @@
 
 Name:		arm4
 Version:	0.8.2
-Release:	6%{?dist}
+Release:	7%{?dist}
 Summary:	Application Response Measurement V4.0
 
 Group:		Development/System
 License:	EPL
 URL:		http://www.arm4.org/
-Source0:	http://downloads.sourceforge.net/arm4/arm4-0.8.2.tar.gz
+Patch0:		arm4-0.8.2-fix-ant-version-check.patch
+Source0:	http://downloads.sourceforge.net/arm4/arm4-%{version}.tar.gz
 Source2:	arm4-README.fedora
 Source3:	arm4-arm4.cron
-Source4:	arm4-arm4.init
-BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+Source4:	arm4-arm4.service
 
 BuildRequires:	libuuid-devel openssl-devel db4-utils db4-devel libxml2-devel sqlite-devel xerces-c-devel ant ant-javadoc
+BuildRequires:	systemd-units
 Requires:	openssl db4 db4-cxx sqlite
 Requires(pre): shadow-utils	
+Requires(post): systemd-sysv
 
 %description
 An Open Source implementation of the Open Group's
@@ -52,6 +54,7 @@ Measurement (ARM) V4.0 standard.
 
 %prep
 %setup -q -n arm4-%{version}
+%patch0 -p1 -b .antcheckfix
 cp -a %{SOURCE2} README.fedora
 
 %build
@@ -59,7 +62,6 @@ cp -a %{SOURCE2} README.fedora
 make %{?_smp_mflags}
 
 %install
-rm -rf %{buildroot}
 make install DESTDIR=%{buildroot}
 
 # These aren't really required in the final system
@@ -83,9 +85,11 @@ rm %{buildroot}%{_libdir}/libArmNative.so
 rm %{buildroot}%{_libdir}/*.la
 
 # Make our configuration dir if it doesn't exist
-mkdir -p %{buildroot}%{_sysconfdir}/rc.d/init.d
+mkdir -p %{buildroot}%{_unitdir}
+mkdir -p %{buildroot}%{_sysconfdir}
 install -m 644 -p %{_builddir}/%{name}-%{version}/config/arm4.conf %{buildroot}%{_sysconfdir}
-install -m 755 -p %{SOURCE4} %{buildroot}%{_sysconfdir}/rc.d/init.d/arm4
+
+install -m 755 -p %{SOURCE4} %{buildroot}%{_unitdir}/arm4.service
 mkdir -p %{buildroot}%{contentdir}
 mkdir -p %{buildroot}%{rundir}
 
@@ -101,35 +105,29 @@ getent passwd arm4 >/dev/null || \
 	-c "ARM 4 Daemon" arm4
 exit 0
 
-%post
-/sbin/ldconfig
-
-# Register the arm4 service
-/sbin/chkconfig --add arm4
+%post -p /sbin/ldconfig
 
 %post devel -p /sbin/ldconfig
 
 %post java -p /sbin/ldconfig
 
-%preun
-if [ $1 = 0 ]; then
-	/sbin/service arm4 stop > /dev/null 2>&1
-	/usr/bin/arm4_control remove > /dev/null 2>&1
-	/sbin/chkconfig --del arm4
-fi
-
 %postun -p /sbin/ldconfig
 
 %postun devel -p /sbin/ldconfig
 
 %postun java -p /sbin/ldconfig
 
-%clean
-rm -rf %{buildroot}
+%triggerun -- arm4 < 0.8.2-7
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply arm4
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save arm4 >/dev/null 2>&1 ||:
 
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del arm4 >/dev/null 2>&1 || :
+/bin/systemctl try-restart arm4.service >/dev/null 2>&1 || :
 
 %files
-%defattr(-,root,root,-)
 %doc README README.fedora COPYING
 %{_bindir}/arm4_control
 %{_bindir}/arm4_daemon
@@ -148,7 +146,7 @@ rm -rf %{buildroot}
 %{_libdir}/libarm4.so*
 %{_libdir}/libarm4_null.so*
 %config(noreplace) %{_sysconfdir}/arm4.conf
-%{_sysconfdir}/rc.d/init.d/arm4
+%{_unitdir}/arm4.service
 %{_sysconfdir}/cron.daily/arm4.cron
 %attr(755,arm4,arm4) %dir %{contentdir}
 #%attr(755,arm4,arm4) %dir %{contentdir}/data
@@ -157,17 +155,18 @@ rm -rf %{buildroot}
 %{_datadir}/%{name}-%{version}/arm4db.xsd
 
 %files devel
-%defattr(-,root,root,-)
 %{_includedir}/*
 %{_mandir}/man3/*
 
 %files java
-%defattr(-,root,root,-)
 %{_datadir}/doc/%{name}-java-%{version}/apidocs
 %{_libdir}/arm4*
 %{_libdir}/libArmNative.*
 
 %changelog
+* Thu Sep  8 2011 Tom Callaway <spot at fedoraproject.org> - 0.8.2-7
+- convert to systemd
+
 * Mon Feb 07 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.8.2-6
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
 


More information about the scm-commits mailing list