Search code examples
rpmrpmbuildrpm-spec

how to get the installer username in rpm spec file?


I'm trying to create a rpm package and need to put a specific file in the client home directory. I looked up the macro references for rpm spec and couldn't find the desired macro. the closest thing that I find is %{getenv:HOME} macro which is resolved to the rpm builder's home directory, not the user who is installing the package.


Solution

  • the user installing the package is always root. rpm packages are always installed system-wide, not for a single user, so it would be messy putting file in the home directory of a user.

    You'd better provide some sensible defaults (for example something like /etc/bashrc) and then let the user choose to override them manually with an optional file in their home directory (like ~/.bashrc). The user would have to create this file manually then; it should not be provided by the rpm.