Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I build a simple rpm based on spec file but my target is after I installed the rpm by rpm -Uvh , is to put the test.sh file under /home directory, please advice what I need to change in the spec file in order to put the test.sh after I installed the rpm ?

remark: test.sh defined under /usr/src/redhat/SOURCES

 [root@linux /usr/src/redhat]# ls
   BUILD  RPMS  SOURCES  SPECS  SRPMS
 [root@linux /usr/src/redhat]# ls SOURCES 
   test.sh

 [root@linux /usr/src/redhat/SPECS]# more my_spec.spec

  Summary: An example tool. To show a simple rpm build of the tool.
  Name: test.sh
  Version: 6.2
  Release: 2
  Source: /root/test.sh 
  URL: http://www.gnomovision.com/cdplayer/cdplayer.html
  Group: Development/Debuggers
  BuildRoot:/var/test.sh
  License: OtherLicense
  %description
  %files

  [root@linux /usr/src/redhat/SPECS]# rpm -ba   /usr/src/redhat/SPECS/my_spec.spec 

  Processing files: test.sh-6.2-2
  Checking for unpackaged file(s): /usr/lib/rpm/check-files /var/test.sh
  Wrote: /root/rpmbuild/SRPMS/test.sh-6.2-2.src.rpm
  Wrote: /root/rpmbuild/RPMS/i386/test.sh-6.2-2.i386.rpm

  [root@linux /usr/src/redhat/SPECS]# rpm -Uvh  /root/rpmbuild/RPMS/i386/test.sh-6.2- 2.i386.rpm
  Preparing...                ########################################### [100%]
  1:test.sh                ########################################### [100%]



      [root@linux /usr/src/redhat]# rpm2cpio  /root/rpmbuild/RPMS/i386/test.sh-6.2-2.i386.rpm | cpio -idmv
      1 block    ( I dont get the test.sh file?)
share|improve this question

1 Answer 1

up vote 2 down vote accepted

Well, you need an install step where you copy the script to the home directory something like that, not tested !

%install
rm -rf %{buildroot}

mkdir -p %{buildroot}/home

cp %SOURCE0 %{buildroot}/home

%file
/home/test.sh
share|improve this answer
    
is correct here. Be aware in some distros the rpm macros and available variables might be different, for example I use the variable $RPM_BUILD_ROOT instead of the macro above on PLD-Linux, but otherwise the I would do exactly that procedure. –  Caleb Apr 14 '11 at 19:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.