Description of problem: Let's get the ball rolling on this one... http://fedoraproject.org/wiki/Features/SysVtoSystemd https://fedoraproject.org/wiki/Packaging:Guidelines:Systemd https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info:
Created attachment 546721 [details] Native systemd service file for foghorn
I've added the service file to the upstream git repo and made several changes to the spec file. I believe I have followed the instructions on the web page(s) provided in comment #1, but I'm hitting a problem the the preun scriptlet failing. [root@rocket-03 ~]# rpm -q foghorn foghorn-0.1.2-5.fc16.x86_64 [root@rocket-03 ~]# rpm -Uhv foghorn-0.1.5-2.fc16.x86_64.rpm Preparing... ########################################### [100%] 1:foghorn ########################################### [100%] /var/tmp/rpm-tmp.4QXbKA: line 3: syntax error near unexpected token `fi' /var/tmp/rpm-tmp.4QXbKA: line 3: `fi' error: %preun(foghorn-0.1.2-5.fc16.x86_64) scriptlet failed, exit status 2 error: foghorn-0.1.2-5.fc16.x86_64: erase failed [root@rocket-03 ~]# rpm -qa|grep foghorn foghorn-0.1.5-2.fc16.x86_64 foghorn-0.1.2-5.fc16.x86_64 This does not look good. I attempt to remove both packages: [root@rocket-03 ~]# rpm -e foghorn-0.1.5-2.fc16.x86_64 [root@rocket-03 ~]# rpm -e foghorn-0.1.2-5.fc16.x86_64 /var/tmp/rpm-tmp.2htt0A: line 3: syntax error near unexpected token `fi' /var/tmp/rpm-tmp.2htt0A: line 3: `fi' error: %preun(foghorn-0.1.2-5.fc16.x86_64) scriptlet failed, exit status 2 error: foghorn-0.1.2-5.fc16.x86_64: erase failed The preun scriptlet in foghorn-0.1.2-5 is as follows: %preun if [ "$1" == 0 ] then; /sbin/chkconfig --del foghorn fi This seems fine to me. The real issue appears to be that the 'rpm -Uhv' command to update foghorn left two instances of foghorn. I'll attach the spec file I'm using for 0.1.5-2 since I've yet to spot the problem.
Created attachment 556639 [details] foghorn.spec file for version 0.1.5-2 (with scriptlets for SySV to systemd migration)
This is definitely a problem in the existing spec file for the latest build (0.1.2-5.fc16). On a clean F16 system with: [root@rocket-04 ~]# rpm -q foghorn foghorn-0.1.2-5.fc16.x86_64 [root@rocket-04 ~]# rpm -e foghorn /var/tmp/rpm-tmp.oa8Ubc: line 3: syntax error near unexpected token `fi' /var/tmp/rpm-tmp.oa8Ubc: line 3: `fi' error: %preun(foghorn-0.1.2-5.fc16.x86_64) scriptlet failed, exit status 2 error: foghorn-0.1.2-5.fc16.x86_64: erase failed
(In reply to comment #4) > This is definitely a problem in the existing spec file for the latest build > (0.1.2-5.fc16). On a clean F16 system with: > > [root@rocket-04 ~]# rpm -q foghorn > foghorn-0.1.2-5.fc16.x86_64 > [root@rocket-04 ~]# rpm -e foghorn > /var/tmp/rpm-tmp.oa8Ubc: line 3: syntax error near unexpected token `fi' > /var/tmp/rpm-tmp.oa8Ubc: line 3: `fi' > error: %preun(foghorn-0.1.2-5.fc16.x86_64) scriptlet failed, exit status 2 > error: foghorn-0.1.2-5.fc16.x86_64: erase failed The current build (0.1.2-5) definitely has a but in the preun script. The current preun script is: %preun if [ "$1" == 0 ] then; /sbin/chkconfig --del foghorn fi There is a misplaced semicolon. It should be: %preun if [ "$1" == 0 ] ; then /sbin/chkconfig --del foghorn fi The old foghorn can be removed with --noscripts options, and then the new version can be installed cleanly. This probably results in the scriptlets not being fully tested. I'm not sure how to proceed. Can you review the spec file I attached? At least we can get the package fixed in F17. Thanks.
I got nothing up my sleeve to fix that preun error. I even went ahead and asked on the package list if there was some official way to deal with this but got no replies which indicates there is none other than forcing the user to the terminal and having him manually remove the old package.
Note that it might be doable to use a trigger or posttrans to fix it.
(In reply to comment #6) > I got nothing up my sleeve to fix that preun error. > > I even went ahead and asked on the package list if there was some official way > to deal with this but got no replies which indicates there is none other than > forcing the user to the terminal and having him manually remove the old > package. OK. My concern is that the error that exists in the preun scriptlet will cause a package update to fail and the extra scriptlet work being done to convert sysv to systemd will not occur. Have a look at the spec file attached to this BZ. If it looks ok, I'll push the new spec file and get a new build started.