[Fedora-packaging] rpm pre/post script order

Farkas Levente lfarkas at lfarkas.org
Thu May 2 15:22:20 UTC 2013


hi,
after we carefully examine this wiki:
https://fedoraproject.org/wiki/Packaging:ScriptletSnippets?rd=Packaging/ScriptletSnippets#Scriptlet_Ordering
still don't understand how rpm works (or the wiki is wrong).
suppose we've got a package pkg with this in the spec:

%pre
. /usr/share/pkg/foo
pkg_pre

%post
. /usr/share/pkg/foo
pkg_post

where pkg_pre and pkg_post are shell functions in the /usr/share/pkg/foo
shell script file. pkg-1.0 has this function:
pkg_pre  { echo "pre-1.0"; }
pkg_post { echo "post-1.0"; }
while pkg-2.0:
pkg_pre  { echo "pre-2.0"; }
pkg_post { echo "post-2.0"; }

questions 1:
if i install pkg-1.0 will it echo pre-1.0? if yes how can it be possible
since the file /usr/share/pkg/foo only installed in step 3 which is
after step 2 (%pre of new package)?

questions 2:
when i upgrade from 1.0 to 2.0 according to the above wiki step 2. it
should have to echo pre-2.0 or pre-1.0? since the already installed
/usr/share/pkg/foo is 1.0? but (after we test it) we got pre-2.0. why?

so what is the truth here and how can i run any kind of script or file
installed by 1.0 during the update process to 2.0? the only way seems to
%pre of the new package since step 3 install the new file (ie. overwrite
all old file), so all rpm scripts of the old packages runs after the new
files have been already installed.

thanks.

-- 
  Levente                               "Si vis pacem para bellum!"


More information about the packaging mailing list