Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   RPM Package Manager (http://www.linux-archive.org/rpm-package-manager/)
-   -   Disappearing symlinks in RPM transaction (http://www.linux-archive.org/rpm-package-manager/139895-disappearing-symlinks-rpm-transaction.html)

Jos Vos 08-08-2008 05:12 PM

Disappearing symlinks in RPM transaction
 
Hi,

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.

Thanks,

--
-- Jos Vos <jos@xos.nl>
-- X/OS Experts in Open Systems BV | Phone: +31 20 6938364
-- Amsterdam, The Netherlands | Fax: +31 20 6948204

_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list

Jos Vos 08-08-2008 05:55 PM

Disappearing symlinks in RPM transaction
 
On Fri, Aug 08, 2008 at 07:12:05PM +0200, Jos Vos wrote:

> 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?

To answer my own question, at least this seems to work:

%triggerpostun -- %{name} < %{version}-%{release}
ln -snf bar /opt/foo

Note that just "%triggerun" does not work, as this is run *before*
the actual files of the old version are removed.

Is this indeed the "recommended way"?

--
-- Jos Vos <jos@xos.nl>
-- X/OS Experts in Open Systems BV | Phone: +31 20 6938364
-- Amsterdam, The Netherlands | Fax: +31 20 6948204

_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list

"Wichmann, Mats D" 08-08-2008 05:56 PM

Disappearing symlinks in RPM transaction
 
Jos Vos wrote:
> Hi,
>
> 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

no light: been there, same problem, no joy.

In our particular case, a toolchain became multi-version capable,
and thus changed from providing /opt/foo/lib to providing
/opt/foo/lib-1.0, /opt/foo/lib-2.0, etc. with /opt/foo/lib
becoming a symlink to the latest version.

What I did find was if there was *anything* that depended on
the old way (and in our case there was), it messed up, so ended
up removing all the packages, installing the base, and building
up from there again. Not exactly a transition-aware upgrade :(


_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list

Michael Jennings 08-08-2008 06:45 PM

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

_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list


All times are GMT. The time now is 06:49 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.