Re: Relative Path

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

 



Yermat wrote:
Hi all,

I want to create an rpm for a java program that is not from me because one of my program depend on it.

The problem I have is that I want to create an executable that call java with the right classpath. Bascially I want : java -classpath %{_javadir}/%{jarfile} -DLibrary-Path=\${TLAPATH} tlc.TLC \$@

The problem is that I want my package to be relocatable. I create the executable in the %install section with a cat command. The best way might be to find the relative path from %{_bindir}/tlc to %{_javadir}/%{jarfile} but how can I do this ?

So I found a solution maybe you can comment on...
In the install section I just create empty file in order the package to register it.

%install
[...]
touch $RPM_BUILD_ROOT%{_bindir}/tlc
chmod a+x $RPM_BUILD_ROOT%{_bindir}/tlc

Then in the post section, I really create the content of the file by using the RPM_INSTALL_PREFIX variable.

%post
[...]
cat > ${RPM_INSTALL_PREFIX}/bin/tlc <<EOD
#!/bin/sh
if (! \$?TLAPATH) then
    export TLAPATH= ${RPM_INSTALL_PREFIX}/share/%{name}/StandardModules
endif
java -classpath ${RPM_INSTALL_PREFIX}/share/java/%{jarfile} -DLibrary-Path=\${TLAPATH} tlc.TLC \$@
EOD

I can see two problem with that.
The first one is that I need to rely on the definition of my macro %{bindir} to be %{_exec_prefix}/bin and %_exec_prefix to be %{_prefix}. Or have I an automatic solution to known the relation between %{bindir} and %{_prefix} (same for %{_datadir} and %{_javadir})?

The second one might happen if I want to sign the package. Wouldn't it say that the file has been modified by puting such things in the post section?

--
Yermat

_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux