Search code examples
shellredhatrpm

RPM Build, how to get the path where the RPM package been "rpm -ivh" at shell script running by '%post' macro


I'm a newbie in rpm build. and i did my best i can to describe the little complicated question with my amature english...

i have a script(.sh) with some code,what the script do is to setup the code,and it need some user input.

sadly i found out scripts running by rpm can not get user input.

and i know that's not right usage. i'm not trying to get user input anymore.

my question is:

i'm now trying to get those input with a config file along with the rpm package,but i don't know how to get the rpm package path at the SPEC file macros or the script file running by SPEC file macros.


Solution

  • rpm packages are not supposed to "adapt" themselves to user input. I would recommend you to make sure the installation of the package is always the same. Once the package is installed, you can tell users how to configure the program.

    Take git for example: it provides /etc/gitconfig which contains the default packaged configuration. Users can then make their changes to the configuration and save those in ~/.gitconfig. Thus the user configuration is separated from the packaged configuration, so you can keep updating git without losing your configuration.