I need to add one path to the PATH variable after installing the RPM package.

To do this, I build this RPM with a postinstall script that runs after installation.

The part of the RPM spec file that contains this script is as follows:

 %postPATH=$PATH:/usr/app/mdg/binexport PATH 

However, after the successful installation of the package $ PATH does not change.

Please tell me how to solve this problem.

    1 answer 1

    The fact is that when you run the script, the $ PATH variable changes in the child shell, so you don’t see the changes. You need to include a shell script in the package, in which:

    #! / bin / bash

    PATH = $ PATH: / usr / app / mdg / bin

    then register in the post-installation section:

    . / path / to / script

    So you make com. the interpreter does not run the script, but read its contents. You can check by running manually.

    • @pyatak, I checked. Indeed, now the code in the script is executed in the same shell, however, for some reason, after RPM is installed completely in the main shell, there are still no changes. I then tried to use export PATH in the post-installation section, but this did not work. Probably This is due to the fact that the PATH variable is now changing for the SHALL in which the RPM package is installed, and I need to change the parent SHALL variable (that is, the SHALL in which I started the installation) - SIGSEGV