[lsb-discuss] Problems with packages installed in /opt

Till Kamppeter till.kamppeter at gmail.com
Wed Mar 28 07:05:55 PDT 2007


Hi,

I am currently working on the LSB DDK (Driver Development Kit). The 
packages needed for it are CUPS, GhostScript (currently ESP), and 
foomatic-filters. This packages should be distro-independent LSB 
packages as any other LSB package and also the printer drivers which are 
supposed to be made with the DDK.

To make them not interfering too much with the system, I made them 
installing into /opt: /opt/cups, /opt/ghostscript. To make these 
programs easily accessible to the user I decided to add the subdirectory 
with the executable programs of each package to be added to the 
beginning of the $PATH by a script in /etc/profile.d or by adding the 
command to /etc/profile if /etc/profile.d is not supported 
(/etc/profile.d should be supported in LSB-conforming distros but 
unfortunately is not the case in reality, see my earlier posting here). 
This way any user logging in after the installation of the LSB package 
can use the programs of the package.

Now to the problem: I have done this way with CUPS and if I install CUPS 
and log in as a user after that, the commands of the new package get 
used. Also if I run "sh -l" as root in the chroot build environment (the 
shell started by the "chroot" command seems not to be a login shell, at 
least under Ubuntu Feisty) I get the CUPS commands of my new package 
used. But if I install the ghostscript-cups RPM with "rpm -ba" out of 
the login shell the call of "cups-config" in the post-install script 
does not work. "cups-config" is not found. This means that in the shell 
in which the post-install script is executed the PATH additions of 
/etc/profile or /etc/profile.d are not there. They seem not to get 
inherited from the shell out of which "rpm" was called.

I would need to call "sh -l -c 'cups-config ...'" instead of 
"cups-config ..." in the post-install script, but the "-l" option for sh 
is not available in all distros (for example not in Ubuntu). The only 
way to run a shell as login shell is to run it with "-sh" as ARGV[0], 
but this is not feasable without ugly hacks like

perl -e 'system {"/bin/sh"} ("-sh")'

but this does not help, as

-sh -c "cups-config ..."

executed with

perl -e 'system {"/bin/sh"} ("-sh", "-c", "cups-config --version")'

lets the shell being executed as non-login shell again. So an even more 
ugly hack of the post-install script manually sourcing all /etc/profile 
and all files in /etc/profile.d would have to be done.

So the maintainer scripts for distribution-independent packages get 
arbitrarily complicated.

Does someone know an easy solution for this?

    Till




More information about the lsb-discuss mailing list