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.


    Michael Andres

Key fingerprint = 2DFA 5D73 18B1 E7EF A862  27AC 3FB8 9E3A 27C6 B0E4
Michael Andres   SUSE LINUX Products GmbH, Development,   m...@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+unsubscr...@opensuse.org
To contact the owner, e-mail: zypp-devel+ow...@opensuse.org

Reply via email to