I have to build a rpm package for some drivers. I need to build the rpm from a .tar.gz archive. The tar ball also contains the .spec file. I have set up my rpmbuild environment as described here: http://wiki.centos.org/HowTos/SetupRpmBuildEnvironment
My directory structure is thus:
/home/rpmbuild
/home/rpmbuild/BUILD
/home/rpmbuild/RPMS
/home/rpmbuild/SOURCES
/home/rpmbuild/SPECS
/home/rpmbuild/SRPMS
The .tar.gz file contains the specfile and is placed in /home/rpmbuild/SOURCES
If I then navigate to that directory and run the following, the rpm package is built correctly, but is placed in /root/rpmbuild/RPMS instead of /home/rpmbuild/RPMS (where I expected it to be).
sudo rpmbuild -ta driver.tar.gz
I assume this is because I ran rpmbuild with sudo. Am I thinking of this correctly? Is there a way to direct it to build in /home/rpmbuild instead?
I know it is bad practice to use rpmbuild as root, but if I don't run it as root I run into many errors (not having permissions to access directories owned by root - like /tmp/orbit-root). It seems like it would be much more difficult to change the permissions of each of these directories then to change them back.
Is this the correct way to go about this? I greatly appreciate the help.
rpmbuild
asroot
. You can very easily ruin your entire system. – Entero