[zypp-devel] How to detect installation via libzypp vs plain RPM in %post?
Hi all, Right now I'm improving Webyast packaging, the problem is that installing or updating a webyast package requires updating assets files, updating Gemfile and then restarting Webyast to use the new/updated files. Until now this was done in %post section, but this is very inefficient and slows down the Webyast installation a lot. There are almost 20 webyast modules and even if the update and restart takes about 3 seconds doing it 20 times results in extra 1 minute installation time. That's quite a lot IMO. Therefore I switched to using libzypp update scripts (/var/adm/update-scripts/%name-%version-%release-update) and restart is done only once at the end. So far so good. The problem now is how to make this backward compatible with plain RPM update? If you use rpm command for manual update then you need to run the update script manually. If you miss it you'll be still running the old Webyast which will be confusing for users. So the question is: Is it possible to detect installation via libzypp or via plain rpm in %post script? Ideally I'd like to use update-scripts in libzypp installation and as a fallback in plain rpm installation I'd run the restart in each %post. Or is it somehow possible to mix update-scripts and rpm %posttrans to support transactions in both libzypp and plain rpm? Any examples? Thank you a lot! -- Ladislav Slezák Appliance department / YaST Developer Lihovarská 1060/12 190 00 Prague 9 / Czech Republic tel: +420 284 028 960 lslezak@suse.com SUSE -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org To contact the owner, e-mail: zypp-devel+owner@opensuse.org
On Wednesday 05 December 2012 10:56:00 Ladislav Slezak wrote:
The problem now is how to make this backward compatible with plain RPM update?
If you use rpm command for manual update then you need to run the update script manually. If you miss it you'll be still running the old Webyast which will be confusing for users.
So the question is: Is it possible to detect installation via libzypp or via plain rpm in %post script? Ideally I'd like to use update-scripts in libzypp installation and as a fallback in plain rpm installation I'd run the restart in each %post.
Or is it somehow possible to mix update-scripts and rpm %posttrans to support transactions in both libzypp and plain rpm? Any examples?
Since libzypp-12.0.0 (openSUSE-12.2) we set 'ZYPP_IS_RUNNING=<PID>' during commit. (libzypp-9.31.1 for SLE-SP3 will do the same) So if you already support zypp update-scripts, your %posttrans could test for ZYPP_IS_RUNNING, and if not set (plain rpm) execute the update-script. If set, zypp will execute it for you. Unfortunately update-scripts are not very handy for this task. We never expected them to replace suseconfig. As the scripts need to be named after the package containing them (%name-%version-%release-*), you need some kind of synchronization to make sure the action is not executed in each script, but only once. One approach could be to define a dedicated script directory (e.g. /var/adm/posttrans). At the end of commit we could run all scripts in there, and move them to /var/adm/posttrans/done after execution. Or we simply remove the x-bit, so "rpm -V" won't show it as 'missing'. In case of an error the remaining x-bits would indicate which scripts were not executed. They had to be cleaned when the next commit starts. -- cu, Michael Andres +------------------------------------------------------------------+ Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4 +------------------------------------------------------------------+ Michael Andres SUSE LINUX Products GmbH, Development, ma@suse.de GF:Jeff Hawn,Jennifer Guild,Felix Imendörffer, HRB16746(AG Nürnberg) Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 740 53-0 +------------------------------------------------------------------+ -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org To contact the owner, e-mail: zypp-devel+owner@opensuse.org
participants (2)
-
Ladislav Slezak
-
Michael Andres