Hello,

I made a patch to solve this problem.
It does the same thing as what is already done for the 'GMT' binary
it let gmt install things in /usr/lib/gmt/bin, then it moves
everyting in place.
/usr/lib/gmt/bin is then removed
postint and prerm make and remove a symlink /usr/lib/gmt/bin --> /usr/bin
I have to do it in postinst because dpkg won't let a directory
become a symlink on upgrade.
The symlink is left just by caution : With all the files in
/usr/bin and no symlink, I could run the examples of gmt-examples without
any problem.

I made some tests regarding upgrading, reinstalling, purgeing, and installing
again. Every thing worked fine. (I did these tests on an ubuntu dapper drake,
because I never run a debian version other than the stable one. normal gmt
packages is gmt-4.0.2 on this distro)

Lintian is not completely happy with the new package because it now
discovers binary files without manpages, but that's a minor point.
W: gmt: binary-without-manpage gshhs
W: gmt: binary-without-manpage gshhs_dp
W: gmt: binary-without-manpage xgridedit


Christophe.

*** ./rules.orig        Sun Jun 11 10:23:46 2006
--- ./rules     Sun Jun 11 10:24:34 2006
***************
*** 81,86 ****
  
        # GMT wrapper does not help in /usr/lib/gmt/bin (not in path by default)
!       # So: Move it to /usr/bin
!       mv $(DESTDIR)/usr/lib/gmt/bin/GMT $(DESTDIR)/usr/bin/
  
        # Move the manpages directory to the right place...
--- 81,105 ----
  
        # GMT wrapper does not help in /usr/lib/gmt/bin (not in path by default)
!       # Other commands feel better also if installed in /usr/bin, so
!       # while we are at it, we move everything to /usr/bin and provide a
!       # symlink from /usr/lib/gmt/bin to /usr/bin, so that GMT is still happy.
!       # In fact we will create the symlink in postinst because dpkg won't
!       # accept to change a directory to a symlink.
!       # 
!       # We also change the GMT wrapper so that it execs /usr/bin/toto instead
!       # of /usr/lib/gmt/bin/toto. The latter would work since we install a
!       # symlink, but the former is more efficient as it does not read the
!       # symlink that, precisely, goes back to /usr/bin
!       #
!       # We could think, that since we patch the GMT wrapper, the symlink is
!       # not really needed any more.
!       # But I prefer to keep it, just in case some thing somewhere uses
!       # /usr/lib/gmt as a base and assumes that the binary should then be 
!       # at /usr/lib/gmt/bin. Call this fear, uncertainty, or compatibility or
!       # caution.
!       # OK, after all these deep thoughts, let's do it : 
!       sed -e 's,$$/usr/lib/gmt/bin,/usr/bin,' $(DESTDIR)/usr/lib/gmt/bin/GMT 
>$(DESTDIR)/usr/bin/GMT && chmod 755 $(DESTDIR)/usr/bin/GMT && rm 
$(DESTDIR)/usr/lib/gmt/bin/GMT
!       mv $(DESTDIR)/usr/lib/gmt/bin/* $(DESTDIR)/usr/bin/ && \
!       rmdir $(DESTDIR)/usr/lib/gmt/bin
  
        # Move the manpages directory to the right place...
*** ./gmt.install.orig  Sun Jun 11 10:23:46 2006
--- ./gmt.install       Sun Jun 11 10:24:34 2006
***************
*** 1,4 ****
  usr/bin
- usr/lib/gmt/bin
  usr/lib/gmt/lib
  usr/include
--- 1,3 ----
*** ./gmt.postinst.orig Sun Jun 11 10:24:34 2006
--- ./gmt.postinst      Sun Jun 11 10:24:34 2006
***************
*** 0 ****
--- 1,23 ----
+ #! /bin/sh
+ 
+ test configure = "$1" || exit 0
+ test -L /usr/lib/gmt/bin && exit 0
+ rmdir /usr/lib/gmt/bin 2>/dev/null
+ test -d /usr/lib/gmt/bin && {
+       cat >&2 <<-!
+               You did install things of yours in /usr/lib/gmt/bin
+               You have to remove your files from there in order to complete
+               the installation of this gmt upgrade.
+               
+               After you have removed your files, please run
+                       dpkg --pending --configure
+               To complete the upgrade.
+               
+               After the upgrade is complete, you may put your files there
+               back. Be warned that /usr/lib/gmt/bin will be a symlink to
+               /usr/bin .
+       !
+       exit 1
+ }
+ :
+ ln -s ../../bin /usr/lib/gmt/bin
*** ./gmt.prerm.orig    Sun Jun 11 10:24:34 2006
--- ./gmt.prerm Sun Jun 11 10:24:34 2006
***************
*** 0 ****
--- 1,9 ----
+ #! /bin/sh
+ 
+ test remove = "$1" || exit 0
+ test -e /usr/lib/gmt/bin || exit 0
+ test -L /usr/lib/gmt/bin && {
+       rm -f /usr/lib/gmt/bin
+       exit 0
+ }
+ false

Reply via email to