Joachim Breitner writes ("Merging three direcories in postinst"): > But before doing so, I?d like to get comments as to what can go wrong. > Especially, does dpkg mind if I replace something that dpkg thinks is a > proper directory by a symbolic link?
Thanks for asking. No, dpkg will not mind. It will follow the link. > Will it still cleanly remove files that were installed by > libghc-foo-doc into /usr/lib/ghc-7.0.3/haddock/ when libghc-foo-doc > is removed? Yes, it will. It will also (try to) remove the symlink when it thinks /usr/lib/ghc-7.0.3 becomes empty. However, dpkg will not know that /usr/lib/ghc-7.0.2/haddock/foo.haddock (in old libghc-foo-doc) and /usr/lib/haddock/foo.haddock (in old libghc-foo-doc) are the same file. This will not normally be a problem as dpkg will ihappily "overwrite" the "unexpected" other file, but you should be aware of it. > for dir in /usr/lib/ghc-7.0.2/haddock /usr/lib/ghc-7.0.3/haddock > do > if test -d $dir > then > mv $dir/* /usr/lib/haddock > rmdir $dir > ln -s ../haddock $dir > fi > done This code is buggy because it will always trigger since test -d will be true for a symlink to a directory. Also you might want to think about what you want to happen if the same file is found in two or more of /usr/lib/haddock /usr/lib/ghc-7.0.2/haddock /usr/lib/ghc-7.0.3/haddock In general I think you have a tenable approach here. But you should do thorough testing; particularly, you should do testing with "dpkg -i" and "dpkg --remove" in arbitrary orders, and you should do testing of what happens if your fixup script falls over halfway through (eg, put a sleep in it and ^Z then kill -9 the whole dpkg process stack). It is important that the sh code you write is idempotent and the dependencies are all correct. I suggest you come back here (or to debian-dpkg) and ask for another review when you have a more concrete implementation. Regards, Ian. -- To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/19959.39647.971076.700...@chiark.greenend.org.uk