Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm just trying to figure out how to know in an rpm package that calls sudo, and put some files in the non-root home folder for the users who call sudo or are root.

I tried with something like this:

%define whoami %(eval who am i | awk '{print $1}')

then I try to copy some files to /home/%{whoami}/target after that (and some more instructions) I build the package, without problems, actually can run pretty well the package in my machine, the problem is when I try to run the same package in other machine with a different user name, it doesn't copy the files because it looks for my original home user folder instead of the other user.

share|improve this question
Shouldn't this question be asked on Stack Overflow? – BenjiWiebe Feb 12 '13 at 18:50

RPM packages are installed by root, there is no need to fool around with sudo or anything else. Check Fedora's RPM guidelines for a detailed explanation of how to create spec files. The guidelines are (mostly) applicable to all RPM-based distributions, and as RHEL (and thus CentOS) are downstream from Fedora, they should apply with only minor fudging for recent updates.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .