[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Disappearing symlinks in RPM transaction



On Friday, 08 August 2008, at 19:12:05 (+0200),
Jos Vos wrote:

> I have a interesting RPM problem that I can't explain (yet).
> 
> I have a package, say foo-1-1.  It contains a directory, say /opt/foo
> 
> I want to make an update, say foo-1-2, in which /opt/foo is not a
> directory anymore, but a symlink, say /opt/foo -> bar.
> Just packaging it as such does not seem to work, as the RPM says then:
> 
>   error: unpacking of archive failed on file /opt/foo: cpio: rename
> 
> So, I tried a workaround and included in foo no /opt/foo at all, but
> I included a post-install script:
> 
>   %post
>   ln -snf bar /opt/foo
> 
> Later, I added some tracing (writing output to a file there) and
> found out that after at the end of the post-install script the
> symlink *does* exist.  But it is gone when the RPM transaction
> is finished!
> 
> Can someone shed a light on this?  I'm afraid the actual remove
> actions for foo-1-1 remove my symlink.  The only thing I want to
> do is replacing a directory with a symlink in an update of the
> package.  How should I do this?
> 
> This is using RPM 4.4.2 on a RHEL5 clone.

The solution is %pretrans, which a quick Google search on "rpm upgrade
symlink directory" turns up right away:

https://lists.dulug.duke.edu/pipermail/rpm-devel/2007-April/002257.html

Michael

-- 
Michael Jennings (a.k.a. KainX)  http://www.kainx.org/  <mej kainx org>
Linux Server/Cluster Admin, LBL.gov       Author, Eterm (www.eterm.org)
-----------------------------------------------------------------------
 "I have failed over and over again in my life.  And that is why I
  succeed."                                          -- Michael Jordan


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]