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

Creating and removing symlinks in postinst/postrm



Hi there,

I'm packaging rxtx. It's a native library to be able to access the
serial ports from Java. It provides this support for Linux - it works
on i386 and I don't see any problems why it shouldn't work on other
architectures. How can I verify my opinion?

My problem mentioned in the subject is that I need different parts of
the package at different locations for the different Sun JDKs (1.1 and
1.2). Therefor I put the files into separate directories and create
symlinks into the *existing* JDKs. And this is the first problem. The
package is not usable if the JDK is installed afterwards or
reinstalled/upgraded and so on.

So far this is my postinst:

<---------------
#!/bin/sh

set -e

RXTXJDK11PATH=/usr/lib/jdk1.1/lib
RXTXJDK12PATH=/usr/lib/jdk1.2/jre/lib/ext

case "$1" in
    configure*)
        ldconfig
	# JDK 1.1
	if [ -f $RXTXJDK11PATH/classes.zip ]; then
	    if [ -L $RXTXJDK11PATH/jcl.jar -o -e  $RXTXJDK11PATH/jcl.jar ]; then
		echo " "
	    else
		echo "creating symlinks for JDK 1.1"
		cd $RXTXJDK11PATH; ln -s ../../../share/java/jcl.jar .
	    fi
	fi
	# JDK 1.2
	if [ -d $RXTXJDK12PATH ]; then
	    if [ -L $RXTXJDK12PATH/jcl.jar -o -e  $RXTXJDK12PATH/jcl.jar ]; then
		echo " "
	    else
		echo "creating symlinks for JDK 1.2"
		ARCH=`dpkg --print-architecture`
		echo "Arch: $ARCH"
		cd $RXTXJDK12PATH; ln -s ../../../../../share/java/jcl.jar .
		#jdk1.2/jre/lib/i386:
		cd $RXTXJDK12PATH/../../$ARCH/; ln -s /usr/lib/libSerial.so .
	    fi
	fi
	echo "This serial driver has to be enabled through modifying javax.comm.properties"
	echo "provided by the javax.comm package from sun. You may copy a file with the "
	echo "right content named /etc/javax.comm.properties."
	echo
	echo "The javax.comm package from sun has to be installed, too."
        ;;
    *)
        ;;
esac
<-------------

Now running lintian...
W: lib-rxtx-java: dpkg-print-architecture-in-maintainer-script postinst:26

Why is lintian complaining about the print-architecture?? The compiled
library is architecture dependent - of course.


My main problem now is: How can I remove safely the with postinst
created symlinks in postrm?


javax.comm.properties is file that is provided through the CommAPI
package from Sun. But it has to be modified to use the right library
or better the right interface driver. Is it okay to put the modified
file into /etc?

<-------------- /etc/javax.comm.properties 
Driver=gnu.io.RXTXCommDriver
<--------------

Here is the package layout:

$ dpkg -c lib-rxtx-java_1.3.3-3_i386.deb 
drwxr-xr-x root/root         0 1999-07-01 09:15 ./
drwxr-xr-x root/root         0 1999-07-01 09:15 usr/
drwxr-xr-x root/root         0 1999-07-01 09:15 usr/lib/
-rw-r--r-- root/root     12568 1999-07-01 09:15 usr/lib/libSerial.so.0.1.0
lrwxrwxrwx root/root         0 1999-07-01 09:15 usr/lib/libSerial.so.0 -> libSerial.so.0.1.0
lrwxrwxrwx root/root         0 1999-07-01 09:15 usr/lib/libSerial.so -> libSerial.so.0.1.0
-rw-r--r-- root/root       565 1999-07-01 09:15 usr/lib/libSerial.la
-rw-r--r-- root/root     10304 1999-07-01 09:15 usr/lib/libSerial.a
drwxr-xr-x root/root         0 1999-07-01 09:14 usr/share/
drwxr-xr-x root/root         0 1999-07-01 09:15 usr/share/java/
-rw-r--r-- root/root      9833 1999-07-01 09:15 usr/share/java/jcl.jar
drwxr-xr-x root/root         0 1999-07-01 09:15 usr/doc/
drwxr-xr-x root/root         0 1999-07-01 09:15 usr/doc/lib-rxtx-java/
-rw-r--r-- root/root      1625 1999-05-01 23:50 usr/doc/lib-rxtx-java/AUTHORS
-rw-r--r-- root/root      3056 1999-05-01 23:50 usr/doc/lib-rxtx-java/BUGS
-rw-r--r-- root/root      3844 1999-05-01 23:50 usr/doc/lib-rxtx-java/CommAPI
-rw-r--r-- root/root      1123 1999-05-01 23:50 usr/doc/lib-rxtx-java/PORTING
-rw-r--r-- root/root      3104 1999-05-01 23:50 usr/doc/lib-rxtx-java/README
-rw-r--r-- root/root      1614 1999-05-01 23:50 usr/doc/lib-rxtx-java/TODO
-rw-r--r-- root/root       402 1999-06-28 12:17 usr/doc/lib-rxtx-java/README.Debian
-rw-r--r-- root/root       955 1999-06-28 12:14 usr/doc/lib-rxtx-java/copyright
-rw-r--r-- root/root      2832 1999-05-02 01:02 usr/doc/lib-rxtx-java/changelog.gz
-rw-r--r-- root/root      2810 1999-05-01 23:50 usr/doc/lib-rxtx-java/INSTALL.gz
-rw-r--r-- root/root       295 1999-06-30 23:26 usr/doc/lib-rxtx-java/changelog.Debian.gz
drwxr-xr-x root/root         0 1999-07-01 09:15 etc/
-rw-r--r-- root/root        29 1999-07-01 09:15 etc/javax.comm.properties

$ dpkg -I lib-rxtx-java_1.3.3-3_i386.deb 
 new debian package, version 2.0.
 size 33576 bytes: control archive= 1468 bytes.
      27 bytes,     1 lines      conffiles            
     474 bytes,    15 lines      control              
     952 bytes,    15 lines      md5sums              
    1127 bytes,    42 lines   *  postinst             #!/bin/sh
      26 bytes,     1 lines      shlibs               
 Package: lib-rxtx-java
 Version: 1.3.3-3
 Section: contrib/devel
 Priority: optional
 Architecture: i386
 Depends: jdk1.1 | jdk1.2 | jdk1.1-native | jdk1.2-native
 Suggests: jdk-common
 Installed-Size: 76
 Maintainer: Christian Leutloff <leutloff@debian.org>
 Source: rxtx
 Description: native interface to serial ports in java
  This is a native library for jdk 1.1.*/1.2.*.
  .
  The CommAPI (javax.comm.*) from Sun is additionally needed to be able
  to program the serial interfaces.


Due to the problem with the removal of symlinks the package is only
available from http://www.oche.de/~leutloff/debian/packages/.

Thanks in advance
                Christian

-- 
Dipl.-Ing. Christian Leutloff, Aachen, Germany  leutloff@sundancer.oche.de
      http://www.oche.de/~leutloff/             leutloff@debian.org

              Debian GNU/Linux - http://www.de.debian.org/

Attachment: pgprhsT5Rb0Qh.pgp
Description: PGP signature


Reply to: