Bug 965177 - new version with systemd unit
new version with systemd unit
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: rtirq (Show other bugs)
19
x86_64 Linux
unspecified Severity high
: ---
: ---
Assigned To: Brendan Jones
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-05-20 11:50 EDT by Simon Lewis
Modified: 2013-06-18 02:15 EDT (History)
3 users (show)

See Also:
Fixed In Version: rtirq-20130402-4.fc19
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-06-18 02:15:16 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Simon Lewis 2013-05-20 11:50:27 EDT
Please update to latest version...
 
# Download link: http://www.rncbc.org/jack/rtirq-20130402.tar.gz


I believe the following spec file extract will do the trick, but I am a user not a programmer so you will know a better way


%prep
%setup -q
sed -e "s|etc/sysconfig/rtirq|etc/conf.d/rtirq|" -i rtirq.sh
sed '/ExecStop/ a\
ExecReload=/etc/init.d/rtirq restart\
ExecStatus=/etc/init.d/rtirq status' -i rtirq.service
%patch0 -p0

%build
# Nothing to do

%install
%__rm -rf %{buildroot}
# Install rtirq files
install -vD rtirq.sh   -m 0755 %{buildroot}%{_sysconfdir}/init.d/rtirq.sh
install -vD rtirq.conf -m 0644 %{buildroot}%{_sysconfdir}/conf.d/rtirq.conf
install -vD rtirq.service -m 0644 %{buildroot}%{_sysconfdir}/systemd/system/rtirq.service
# Install udev and power files
install -D %{SOURCE1} -m 0755 %{buildroot}%{_bindir}/rtirq-udev
install -D %{SOURCE2} -m 0644 %{buildroot}%{_prefix}/lib/udev/rules.d/95-rtirq.rules
install -D %{SOURCE3} -m 0755 %{buildroot}%{_sysconfdir}/pm/sleep.d/05-rtirq

%post
if [ -L /etc/rc5.d/S81rtirq ] ; then
   systemctl restart rtirq.service
else
   systemctl enable rtirq.service
fi

%preun
systemctl disable rtirq.service

%clean
%__rm -rf %{buildroot}

%files
%doc LICENSE
# rtirq files
%{_sysconfdir}/init.d/rtirq.sh
%{_sysconfdir}/conf.d/rtirq.conf
%{_sysconfdir}/systemd/system/rtirq.service
# udev and power management
%{_prefix}/lib/udev/rules.d/95-rtirq.rules
%{_sysconfdir}/pm/sleep.d/05-rtirq
%{_bindir}/rtirq-udev
Comment 1 Fedora Update System 2013-05-25 15:25:29 EDT
rtirq-20130402-1.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/rtirq-20130402-1.fc19
Comment 2 Fedora Update System 2013-05-25 15:25:39 EDT
rtirq-20130402-1.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/rtirq-20130402-1.fc18
Comment 3 Fedora Update System 2013-05-26 13:01:30 EDT
Package rtirq-20130402-1.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing rtirq-20130402-1.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-9308/rtirq-20130402-1.fc19
then log in and leave karma (feedback).
Comment 4 T.C. Hollingsworth 2013-06-04 15:28:18 EDT
You didn't do this quite right.

1. You need to get rid of the old sysv initscript competely (or ship it in a "-sysv" subpackage, but please don't do this).  You also need to enable the sysv->systemd conversion logic:

https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Packages_migrating_to_a_systemd_unit_file_from_a_SysV_initscript

2. In Fedora 19, services should not enable themselves automatically, but instead use the new preset logic:
https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Macroized_scriptlets_.28Fedora_18.2B.29

You may or may not need FESCo approval to start your service automatically:
https://fedoraproject.org/wiki/Starting_services_by_default

If you are permitted to start your service automatically, file a bug against systemd to have it added to the distribution default preset file.
Comment 5 Brendan Jones 2013-06-08 01:48:22 EDT
Thanks for picking this up. I have just followed upstream in this case but I will modify as you've recommended. Updates have been unpushed
Comment 6 Brendan Jones 2013-06-13 00:57:29 EDT
Here's what I've got. We can enable by default in the audio spin kickstart - not required here

@@ -39,14 +39,11 @@ done
 
 %install
 rm -rf %{buildroot}
-install -D rtirq.sh   -m 0755 %{buildroot}%{_sysconfdir}/rc.d/init.d/rtirq
+install -D rtirq.sh   -m 0755 %{buildroot}%{_bindir}/rtirq
 install -D rtirq.conf -m 0644 %{buildroot}%{_sysconfdir}/sysconfig/rtirq
 
 # fix order of interrupts, tac was reversing the priority of the soundcards
-perl -p -i -e "s/\| tac//g" %{buildroot}%{_sysconfdir}/rc.d/init.d/rtirq
-
-# start rtirq after the alsasound startup script (starts at 87)
-perl -p -i -e "s|35 81 19|35 88 19|g" %{buildroot}%{_sysconfdir}/rc.d/init.d/rtirq
+perl -p -i -e "s/\| tac//g" %{buildroot}%{_bindir}/rtirq
 
 # high priority is 70 instead of 90 (in Fedora 17+)
 perl -p -i -e "s|RTIRQ_PRIO_HIGH=90|RTIRQ_PRIO_HIGH=70|g" %{buildroot}%{_sysconfdir}/sysconfig/rtirq
@@ -58,6 +55,8 @@ perl -p -i -e "s|RTIRQ_PRIO_DECR=5|RTIRQ
 perl -p -i -e "s|rtc snd usb i8042|rtc snd i8042|g" %{buildroot}%{_sysconfdir}/sysconfig/rtirq
 # adjust priority for udev changes, same as highest priority
 perl -p -i -e "s|RTIRQ_PRIO_UDEV=85|RTIRQ_PRIO_UDEV=70|g" %{buildroot}%{_sysconfdir}/sysconfig/rtirq
+# moved out of init.d/
+perl -p -i -e "s|/etc/init.d/|%{_bindir}/|g" rtirq.service
 
 # install udev and power files
 install -D %{SOURCE2} -m 0644 %{buildroot}%{_prefix}/lib/udev/rules.d/95-rtirq.rules
@@ -65,25 +64,7 @@ install -D %{SOURCE1} -m 0755 %{buildroo
 install -D %{SOURCE3} -m 0755 %{buildroot}%{_sysconfdir}/pm/sleep.d/05-rtirq
 install -vD rtirq.service -m 0644 %{buildroot}%{_prefix}/lib/systemd/system/rtirq.service
 
-%post
-# only run on install, not upgrade
-if [ "$1" = "1" ]; then
-    /sbin/chkconfig --add rtirq
-#   /sbin/chkconfig rtirq on
-fi
-if [ -L /etc/rc.d/rc5.d/S81rtirq ] ; then
-    # update startup to new priority
-    /sbin/chkconfig --del rtirq
-    /sbin/chkconfig --add rtirq
-fi
-systemctl enable rtirq.service
-
 %preun
-# only run if this is the last instance to be removed
-if [ "$1" = "0" ]; then
-    /sbin/chkconfig rtirq off
-    /sbin/chkconfig --del rtirq
-fi
 systemctl disable rtirq.service
 
 %clean
@@ -92,17 +73,23 @@ rm -rf %{buildroot}
 %files
 %doc LICENSE
 %config(noreplace) %{_sysconfdir}/sysconfig/rtirq
-%{_sysconfdir}/rc.d/init.d/rtirq
 # udev and power management
 %{_prefix}/lib/udev/rules.d/95-rtirq.rules
 %{_sysconfdir}/pm/sleep.d/05-rtirq
 %{_bindir}/rtirq-udev
+%{_bindir}/rtirq
 %{_prefix}/lib/systemd/system/rtirq.service
Comment 7 T.C. Hollingsworth 2013-06-13 03:38:47 EDT
That part looks good, you just need the new systemd scriptlets:
--
# This is actually needed for the %triggerun script but Requires(triggerun)
# is not valid.  We can use %post because this particular %triggerun script
# should fire just after this package is installed.
Requires(post): systemd-sysv

...

%post
%systemd_post rtirq.service

%preun
%systemd_preun rtirq.service

%postun
%systemd_postun_with_restart rtirq.service 

%triggerun -- rtirq < 20130402
# Save the current service runlevel info
# User must manually run systemd-sysv-convert --apply rtirq
# to migrate them to systemd targets
/usr/bin/systemd-sysv-convert --save rtirq >/dev/null 2>&1 ||:

# Run these because the SysV package being removed won't do them
/sbin/chkconfig --del rtirq >/dev/null 2>&1 || :
/bin/systemctl try-restart rtirq.service >/dev/null 2>&1 || :

--

Then, if the Fedora Jam folks have moved over to the new preset logic [1] making rtirq start by default on that spin is as easy as adding a line to a file.

[1] http://www.freedesktop.org/wiki/Software/systemd/Preset/
Comment 8 Fedora Update System 2013-06-14 11:23:46 EDT
rtirq-20130402-4.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/rtirq-20130402-4.fc19
Comment 9 Fedora Update System 2013-06-18 02:15:16 EDT
rtirq-20130402-4.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.