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

Re: dpkg, symlinks, directories



 ❦ 29 septembre 2012 13:01 CEST, Andreas Beckmann <debian@abeckmann.de> :

>> Thanks for the pointers! I now understand why this does not
>> work. Fixing in postinst is quite difficult since I have swapped
>> symlinks and, from the bug reports, successive installs make the
>> situation worst (things got installed in the wrong place).
>> 
>> Well, I need to work a bit on this.
>
> I think a working approach is:
>
> * directory to symlink
>   fix it up in the postinst (at postinst, the directory should have
> become "empty"):
>   if [ -d $X ] && [ ! -L $X ]; then
>     rmdir $X  # bombs if not empty
>     ln -s $target $X
>   fi

In fact, because I have swapped symlinks in the past, the initial
directory does not become empty. In a version, I have:

 /usr/share/roundcube/plugins -> /var/lib/roundcube/plugins
 /var/lib/roundcube/plugins/plugin1

And in the new version, I have:
 /var/lib/roundcube/plugins/plugin1 -> /usr/share/roundcube/plugins/plugin1
 /var/lib/roundcube/plugins/plugin2 -> /usr/share/roundcube/plugins/plugin2

Unfortunately, when the user has upgraded from 1 to 2, he has:

 /usr/share/roundcube/plugins -> /var/lib/roundcube/plugins
 /var/lib/roundcube/plugins/plugin1
 /var/lib/roundcube/plugins/plugin2

Of course, there is still a solution, but it becomes a bit complex and I
may create new bugs from it...

> * symlink to directory
>   remove symlinks in the preinst to avoid installing stuff at the wrong
> place
>   test ! -L $X || rm $X

This is too late since the culprit package is already in stable.
-- 
 /*
  * For moronic filesystems that do not allow holes in file.
  * We may have to extend the file.
  */
	2.4.0-test2 /usr/src/linux/fs/buffer.c

Attachment: pgpujX66QOVPo.pgp
Description: PGP signature


Reply to: