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

Re: Replacing directory with symbolic link



"Matthias Klose <Matthias Klose" <doko@cs.tu-berlin.de> writes:

> I have the following problem. Version 1 of package X has a directory
> /usr/lib/xy with files in it. The next version 2 puts these files in
> another directory and wants to replace /usr/lib/xy with a symbolic
> link to the new directory. This works, when I uninstall version 1 and
> then install version 2. However when upgrading, the directory is left
> alone. How do I get the symbolic link in a safe way with the install
> scripts?

Is the problem that when you are upgrading the dir is stil lthere and
therefore you can't create the link?  If so, you might try 'rmdir' if
the dir is empty or 'mv <olddir>/* <newdir>/' if not (not safe if
there are subdirs).

Truth is it's very hard to do this in maintainer scripts sometimes.
If you're very sure that there's nothing meaningful in the directory
you want to keep around I suggest doing 'rm -f' in 'preinst upgrade
*'.  Whatever you do in the scripts, though, be sure you check what
the 'error rollback' maintainer call is and deal with undoing what you
did there (in this case, 'postrm failed-upgrade' and 'postrm
abort-upgrade').

I dunno, maybe someone here can give better advice or you could more
clearly express the issue?

-- 
.....A. P. Harris...apharris@onShore.com...<URL:http://www.onShore.com/>


--
To UNSUBSCRIBE, email to debian-mentors-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: