From 0e59f98f20d85302e16a96a9805151dabd1333d9 Mon Sep 17 00:00:00 2001 From: Jon Ciesla Date: Feb 16 2012 16:07:46 +0000 Subject: Migrate to systemd. --- diff --git a/aprsd.service b/aprsd.service new file mode 100644 index 0000000..a678965 --- /dev/null +++ b/aprsd.service @@ -0,0 +1,11 @@ +[Unit] +Description=Amateur Radio And Internet Services Daemon +After=network.target + +[Service] +Type=forking +PIDFile=/run/aprsd.pid +ExecStart=/usr/bin/aprsd -d + +[Install] +WantedBy=multi-user.target diff --git a/aprsd.spec b/aprsd.spec index 1527521..eb1dd53 100644 --- a/aprsd.spec +++ b/aprsd.spec @@ -2,12 +2,12 @@ Name: aprsd Summary: Internet gateway and client access to amateur radio APRS packet data Version: 2.2.5 -Release: %{uprel}.6%{?dist}.2 +Release: %{uprel}.6%{?dist}.3 Group: Applications/Internet License: GPLv2+ Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}-%{uprel}.tar.gz Source1: aprsd.conf -Source2: aprsd.init +Source2: aprsd.service Source3: INIT.TNC Source4: user.deny Source5: welcome.txt @@ -19,9 +19,13 @@ Patch2: aprsd-2.2.5-15-sysconfdir.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) URL: http://sourceforge.net/projects/aprsd/ BuildRequires: libax25-devel -Requires (preun): /sbin/chkconfig -Requires (preun): /sbin/service -Requires (post): /sbin/chkconfig +#Requires (preun): /sbin/chkconfig +#Requires (preun): /sbin/service +#Requires (post): /sbin/chkconfig +Requires(post): systemd-units +Requires(preun): systemd-units +Requires(postun): systemd-units + %description APRSd is an APRS server program that uses amateur radio and internet @@ -43,10 +47,11 @@ make %{?_smp_mflags} rm -rf %{buildroot} make install DESTDIR="%{buildroot}" INSTALL="install -p" mkdir -p %{buildroot}%{_sysconfdir} -mkdir -p %{buildroot}%{_sysconfdir}/{aprsd,rc.d/init.d} +mkdir -p %{buildroot}%{_sysconfdir}/aprsd +mkdir -p %{buildroot}%{_unitdir} mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d install -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/aprsd/aprsd.conf -install -m 755 %{SOURCE2} %{buildroot}%{_sysconfdir}/rc.d/init.d/aprsd +install -m 755 %{SOURCE2} %{buildroot}%{_unitdir}/aprsd.service install -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/aprsd/INIT.TNC install -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/aprsd/user.deny install -m 644 %{SOURCE5} %{buildroot}%{_sysconfdir}/aprsd/welcome.txt @@ -59,19 +64,48 @@ mkdir -p %{buildroot}%{_localstatedir}/log/aprsd rm -rf %{buildroot} %post -/sbin/chkconfig --add aprsd +#/sbin/chkconfig --add aprsd +if [ $1 -eq 1 ] ; then + # Initial installation + /bin/systemctl daemon-reload >/dev/null 2>&1 || : +fi + %preun -if [ $1 = 0 ]; then - /sbin/service aprsd stop > /dev/null 2>&1 - /sbin/chkconfig --del aprsd +#if [ $1 = 0 ]; then +# /sbin/service aprsd stop > /dev/null 2>&1 +# /sbin/chkconfig --del aprsd +#fi +if [ $1 -eq 0 ] ; then + # Package removal, not upgrade + /bin/systemctl --no-reload disable aprsd.service > /dev/null 2>&1 || : + /bin/systemctl stop aprsd.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 aprsd.service >/dev/null 2>&1 || : fi +%triggerun -- aprsd < 2.2.5-15.6.3 +# Save the current service runlevel info +# User must manually run systemd-sysv-convert --apply aprsd +# to migrate them to systemd targets +/usr/bin/systemd-sysv-convert --save aprsd >/dev/null 2>&1 ||: + +# Run these because the SysV package being removed won't do them +/sbin/chkconfig --del aprsd >/dev/null 2>&1 || : +/bin/systemctl try-restart aprsd.service >/dev/null 2>&1 || : + + + %files %defattr(-,root,root,-) %{_bindir}/aprsd %{_bindir}/aprspass -%{_sysconfdir}/rc.d/init.d/aprsd +%{_unitdir}/aprsd.service %dir %{_sysconfdir}/aprsd %dir %{_localstatedir}/log/aprsd %config(noreplace) %{_sysconfdir}/aprsd/* @@ -86,6 +120,9 @@ fi %doc doc/qalgorithm.html %changelog +* Thu Feb 16 2012 Jon Ciesla - 2.2.5-15.6.3 +- Migrate to systemd, BZ 754399. + * Thu Jan 12 2012 Fedora Release Engineering - 2.2.5-15.6.2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild