Name: cwdaemon
Version: 0.9.4
Release: 15%{?dist}
Summary: Morse daemon for the parallel or serial port
Group: System Environment/Daemons
License: GPLv2+
URL: http://www.qsl.net/pg4i/linux/%{name}.html
Source0: http://www.qsl.net/pg4i/download/%{name}-%{version}.tar.gz
Source1: cwdaemon.sysconfig
Source2: cwdaemon.service
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: unixcw-devel pkgconfig
#Requires (preun): chkconfig
#Requires (preun): initscripts
#Requires (post): chkconfig
#Requires(postun): initscripts
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
%description
Cwdaemon is a small daemon which uses the pc parallel or serial port
and a simple transistor switch to output morse code to a transmitter
from a text message sent to it via the udp internet protocol.
%prep
%setup -q
%build
%configure
make %{?_smp_mflags}
%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
#remove the test.c we don't know why it is here, if we figure it out we will fix it
rm -f $RPM_BUILD_ROOT%{_datadir}/%{name}/cwtest.*
#prevent this files to be packed twice
rm -f $RPM_BUILD_ROOT%{_datadir}/%{name}/*_circuit.*
rm -f $RPM_BUILD_ROOT%{_datadir}/%{name}/cwdaemon.png
rm -f $RPM_BUILD_ROOT%{_datadir}/%{name}/cwsetup.sh
rm -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/README
sed -i -e "s/schematics directory/documentation directory/g" %{_builddir}/%{name}-%{version}/README
mkdir -p %{buildroot}%{_sysconfdir}
mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
mkdir -p %{buildroot}%{_unitdir}
install -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/sysconfig/cwdaemon
#install -m 755 %%{SOURCE2} %%{buildroot}%%{_sysconfdir}/rc.d/init.d/cwdaemon
install -m 755 %{SOURCE2} %{buildroot}%{_unitdir}/cwdaemon.service
%clean
rm -rf $RPM_BUILD_ROOT
%post
#/sbin/chkconfig --add cwdaemon
if [ $1 -eq 1 ] ; then
# Initial installation
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
%preun
#if [ $1 = 0 ]; then
# /sbin/service cwdaemon stop > /dev/null 2>&1
# /sbin/chkconfig --del cwdaemon
#fi
if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
/bin/systemctl --no-reload disable cwdaemon.service > /dev/null 2>&1 || :
/bin/systemctl stop cwdaemon.service > /dev/null 2>&1 || :
fi
%postun
#if [ "$1" -ge "1" ] ; then
# /sbin/service cwdaemon condrestart >/dev/null 2>&1 || :
#fi
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
/bin/systemctl try-restart cwdaemon.service >/dev/null 2>&1 || :
fi
%triggerun -- cwdaemon < 0.9.4-14
# Save the current service runlevel info
# User must manually run systemd-sysv-convert --apply httpd
# to migrate them to systemd targets
/usr/bin/systemd-sysv-convert --save cwdaemon >/dev/null 2>&1 ||:
# Run these because the SysV package being removed won't do them
/sbin/chkconfig --del cwdaemon >/dev/null 2>&1 || :
/bin/systemctl try-restart cwdaemon.service >/dev/null 2>&1 || :
%files
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING README TODO cwdaemon.png schematics/parallelport_circuit.ps schematics/serialport_circuit.ps schematics/parallelport_circuit.jpg schematics/serialport_circuit.jpg cwsetup.sh
%{_sbindir}/%{name}
#%%{_sysconfdir}/rc.d/init.d/cwdaemon
%{_unitdir}/cwdaemon.service
%config(noreplace) %{_sysconfdir}/sysconfig/cwdaemon
%{_mandir}/man8/%{name}.8.gz
%changelog
* Wed Jul 18 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.4-15
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Tue Feb 14 2012 Jon Ciesla <limburgher@gmail.com> - 0.9.4-14
- Migrate to systemd, BZ 771724.
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.4-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.4-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.4-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.4-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Wed Sep 03 2008 Lucian Langa <cooly@gnome.eu.org> - 0.9.4-9
- fix sysvinit script
* Wed Aug 20 2008 Lucian Langa <cooly@gnome.eu.org> - 0.9.4-8
- added postun scriptlet
* Sun Aug 10 2008 Lucian Langa <cooly@gnome.eu.org> - 0.9.4-7
- Add sysinit script and default configuration file
- Misc cleanups
* Mon Feb 18 2008 Robert 'Bob' Jensen <bob@bobjensen.com> 0.9.4-6
- fix manpage macro
- remove -devel package section and files including test.c
* Mon Feb 18 2008 Robert 'Bob' Jensen <bob@bobjensen.com> 0.9.4-5
- remove symlink from files section
* Mon Feb 18 2008 Robert 'Bob' Jensen <bob@bobjensen.com> 0.9.4-4
- Fix a few things from initial review
- Use sbin macro
- add simlink for second README location
* Sat Feb 16 2008 Robert 'Bob' Jensen <bob@bobjensen.com> 0.9.4-3
- Submit for review
* Mon Nov 19 2007 Sindre Pedersen Bjørdal <foolish@guezz.net> 0.9.4-2
- Update License tag
- Add missing doc files
- Don't package README twice
- Fix permissions for scripts
* Sun Apr 29 2007 Robert 'Bob' Jensen <bob@bobjensen.com> 0.9.4-0
- Initial spec file