Hello, On Feb 12 16:30 Sascha Peilicke wrote (excerpt):
On Wednesday 12 February 2014 14:59:02 Johannes Meixner wrote:
https://en.opensuse.org/openSUSE:Systemd_packaging_guidelines only talks about "Register services in install scripts"
Assume an older version of package "foobar" that provided both foo.service and bar.service as described in https://en.opensuse.org/openSUSE:Systemd_packaging_guidelines is already installed.
Now a newer version of "foobar" does no longer provide bar.service (but foo.service is still provided).
I hope this is not related to cups.socket?
Of course it is.
What is the correct way in foobar.spec to deregister bar.service when updating the package "foobar"?
I would like to use something like --------------------------------------------------- %pre %service_add_pre foo.service %service_del_pre bar.service
%post %service_add_post foo.service %service_del_post bar.service ---------------------------------------------------
I found "service_del_post" only mentioned in http://lists.opensuse.org/opensuse-packaging/2011-06/msg00160.html
That is a typo. If you read on, the pasted spec file uses
%service_del_postun (the 'un' was missing')
No typo, see below.
rpm --eval %service_del_preun
Ah! Many thanks for that info. On my openSUSE 13.1 machine I get: ----------------------------------------------------------------- # rpm --eval %service_del_pre %service_del_pre # rpm --eval %service_del_post %service_del_post ----------------------------------------------------------------- which seems to indicate that there is no such macro defined. In the old cups package there is in cups.spec (see "osc cat Printing cups cups.spec"): ------------------------------------------------------------------------ %pre /usr/sbin/groupadd -g 71 -o -r ntadmin 2>/dev/null || : %if 0%{?have_systemd} %service_add_pre cups.service cups.socket cups.path %endif exit 0 %post %{fillup_and_insserv -ny cups cups} %if 0%{?have_systemd} %service_add_post cups.service cups.socket cups.path %endif exit 0 %preun %stop_on_removal cups %if 0%{?have_systemd} %service_del_preun cups.service cups.socket cups.path %endif exit 0 %postun %restart_on_update cups %{insserv_cleanup} %if 0%{?have_systemd} %service_del_postun cups.service cups.socket cups.path %endif exit 0 ------------------------------------------------------------------------ In my current tentative new package there is in cups.spec (see "osc cat home:jsmeix:branches:Printing cups cups.spec") here without comments: ------------------------------------------------------------------------ %pre /usr/sbin/groupadd -g 71 -o -r ntadmin 2>/dev/null || : %if 0%{?have_systemd} %service_add_pre cups.service %endif exit 0 %post %if 0%{?have_systemd} %service_add_post cups.service %else %{fillup_and_insserv -ny cups cups} %endif exit 0 %preun %if 0%{?have_systemd} %service_del_preun cups.service cups.socket cups.path %else %stop_on_removal cups %endif exit 0 %postun %if 0%{?have_systemd} %service_del_postun cups.service cups.socket cups.path %else %restart_on_update cups %{insserv_cleanup} %endif exit 0 ------------------------------------------------------------------------ When I do a RPM update I get those dangling symlinks on my openSUSE 13.1 system: ------------------------------------------------------------------------ # for f in $( find /etc/systemd/system | grep cups ) ; do file $f ; done /etc/systemd/system/multi-user.target.wants/cups.path: broken symbolic link to `/usr/lib/systemd/system/cups.path' /etc/systemd/system/multi-user.target.wants/cups.service: symbolic link to `/usr/lib/systemd/system/cups.service' /etc/systemd/system/sockets.target.wants/cups.socket: broken symbolic link to `/usr/lib/systemd/system/cups.socket' ------------------------------------------------------------------------ Additionally (I had cups.socket and cups.path active but cups.service was inactive before the update) I get after the update on my openSUSE 13.1 system: ------------------------------------------------------------------------ # systemctl list-unit-files | egrep 'print|cups' configure-printer@.service static cups.service enabled printer.target static # systemctl list-units | egrep 'print|cups' cups.path not-found active waiting cups.path cups.socket not-found active listening cups.socket # systemctl status cups.socket cups.socket Loaded: not-found (Reason: No such file or directory) Active: active (listening) since Wed 2014-02-12 13:56:17 CET; 3h 7min ago Feb 12 13:56:17 d180 systemd[1]: Stopping CUPS Printing Service Sockets. Feb 12 13:56:17 d180 systemd[1]: Starting CUPS Printing Service Sockets. Feb 12 13:56:17 d180 systemd[1]: Listening on CUPS Printing Service Sockets. # systemctl status cups.path cups.path Loaded: not-found (Reason: No such file or directory) Active: active (waiting) since Wed 2014-02-12 13:56:17 CET; 3h 7min ago Feb 12 13:56:17 d180 systemd[1]: Stopping CUPS Printer Service Spool. Feb 12 13:56:17 d180 systemd[1]: Starting CUPS Printer Service Spool. Feb 12 13:56:17 d180 systemd[1]: Started CUPS Printer Service Spool. ------------------------------------------------------------------------ What I would like to see is that both cups.socket and cups.path got automatically disabled and stopped after the update. I did "rpm -Uhvv" when updating cups and in its output I can see this ordering of the install/erase and scriptlets on my openSUSE 13.1 system: ----------------------------------------------------------------------- # egrep 'scriptlet|install:|erase:' /tmp/rpm.out D: install: cups-libs-1.5.4-144.1 has 33 files D: %post(cups-libs-1.5.4-144.1.i586): scriptlet start D: install: cups-client-1.5.4-144.1 has 41 files D: install: cups-1.5.4-144.1 has 1078 files D: %pre(cups-1.5.4-144.1.i586): scriptlet start D: %post(cups-1.5.4-144.1.i586): scriptlet start D: erase: cups-1.5.4-12.4.1 has 1072 files D: %preun(cups-1.5.4-12.4.1.i586): scriptlet start D: %postun(cups-1.5.4-12.4.1.i586): scriptlet start D: erase: cups-client-1.5.4-12.4.1 has 41 files D: erase: cups-libs-1.5.4-12.4.1 has 33 files D: %postun(cups-libs-1.5.4-12.4.1.i586): scriptlet start -----------------------------------------------------------------------
From that I thought I need to do something in %pre(cups-1.5.4-144.1.i586) scriptlet and/or %post(cups-1.5.4-144.1.i586): scriptlet of the new package to get things right.
But from what Marcus Meissner wrote here it seems this is perhaps not an issue in how I package cups but an issue in systemd? Shouldn't %service_del_preun cups.service cups.socket cups.path and %service_del_postun cups.service cups.socket cups.path in the old package do "the right thing"? Kind Regards Johannes Meixner -- SUSE LINUX Products GmbH -- Maxfeldstrasse 5 -- 90409 Nuernberg -- Germany HRB 16746 (AG Nuernberg) GF: Jeff Hawn, Jennifer Guild, Felix Imendoerffer -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org