title: How to get RPM build to set installation path correctly
body: <p>This is my first attempt at building an RPM and I'm finding it a bit confusing, not really getting the different variables at all yet, so would appreciate any advice on the below..</p>
  
  <p>I have the following spec file:</p>
  
  <pre><code>BuildRoot       : /home/dm40477/rpmbuild/BUILD
  
  %description
  Package to deploy PROD Support scripts
  
  
  %prep
  
  zcat ~/rpmbuild/SOURCES/ITRS.tar.gz | tar -xvf -
  
  %install
  RPM_INSTALL_PREFIX=/var/opt
  
  %files
  %defattr(0622,muser,muser)
  /ITRS/bin/SXS
  /ITRS/bin/SXSRT
  /ITRS/etc/SXS
  /ITRS/etc/SXSRT
  
  %changelog
  </code></pre>
  
  <p>It creates the rpm file ok, but when I go to install it on target server, it installs in /bin and /etc</p>
  
  <p>The source file is gziped tar file in the below dir structure which I would like to keep except install it in the folder /var/opt</p>
  
  <pre><code>/ITRS/bin/SXS
  /ITRS/bin/SXSRT
  /ITRS/etc/SXS
  /ITRS/etc/SXSRT
  </code></pre>
  
  <ol>
  <li>How can I set the install path in the spec file?</li>
  <li>Do I need to make the dirs to keep the structure, or will it automatically keep that structure?</li>
  </ol>
  
  <p>Any hel appreciated.</p>
  
  <p>Thanks</p>
  
  <p>D</p>