I have an rpm that is built with libfoo1.so library. However, if I install the same rpm on a machine that has libfoo2.so library, it fails to install the package due to missing library dependency as it expects libfoo1.so to be present on the system, and not libfoo2.so.
Within the build source code, I have two directories. One is package_old_library which contains executable1 that is built with libfoo1.so library, and the other is package_new_library which contains executable2 that is built with libfoo2.so library. Is there a way for me to have a wrapper script that installs the right executable (executable1 or executable2) on the target system, by looking at the availability of libfoo1.so or libfoo2.so libraries? ./package_old_library/executable1 on build system is built with libfoo1.so and./package_new_library/executable2 is built with libfoo2.so.
I am looking for ways to install package rpm that installs./package_old_library/executable1 in /usr/sbin/ directory if libfoo1.so is present on system. Else it should install./package_new_library/executable2 if libfoo2.so is present on the system.
Please let me know if there is a way to do this. Thank you.
With native RPMs, there is no easy way to do what you wanted.
The short and recommended answer: Just build two different versions of the RPMs. Then tell the user to install the right one or create a script wrapper that calls yum
/ dnf
with the correct one.
A ( not recommended ) workaround would be:
AutoReqProv
since you need to manually put back everything that isn't libfoo
!/usr/libexec/executable_foo[1|2]
/usr/bin/executable
declared as a "ghost" file%post
stanza, figure out the library versions and then write a symlink /usr/bin/executable
pointing to the proper executable. Anything else will be even more hackish and cause things like rpm -V
to fail or removal of your RPM leaving behind invalid files.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.