replacing folders with symlinks (pre vs pretrans)

Stanislav Ochotnicky sochotnicky at
Tue May 28 15:50:41 UTC 2013

Quoting Panu Matilainen (2012-09-21 10:17:27)
> A directory (empty or not) can't be automatically replaced by anything 
> else (symlink or otherwise) in the existing rpm versions. If absolutely 
> necessary, it can be accomplished by doing the necessary renames and 
> symlinks in "%pretrans -p <lua>" scriptlet, but that should be only seen 
> as the last resort as its not exactly a safe operation.

This used to work in %pre scriptlet as well. It seems like RPM is now doing some
additional checks and it will not even get to the point of %pre scriptlet. As
far as I can see for F17/F18 %pre scriptlet will work, but F19+ %pretrans has to
be used, correct?

Since I *knew* we used %pre for this exact problem before, I have used it and
it broke upgrade paths[1]. I assume just rewriting %pre[2] into following
%pretrans will work:

    for key, dir in pairs({"boot", "conf"}) do
        path = "%{_datadir}/%{name}/" .. dir
        if posix.readlink(path) then

It certainly seemed to work now, but I wonder if I am just missing something else.


Stanislav Ochotnicky <sochotnicky at>
Software Engineer - Developer Experience

PGP: 7B087241
Red Hat Inc.                     

More information about the devel mailing list