开发者

RPM + rpm installation (not create directory according to SPEC)

I need advice about the following

I build simple spec file and build rpm

I transfer the new rpm to other Linux machine in order to install the new rpm

according to the spec file the new rpm -> test.sh-6.2-2.i386.rpm should create the /tmp/MY_RPM_TESTS directory , but this rpm not create the MY_RPM_TESTS and sub directories please advice why , what I need to fix in the spec file?

RPM installation:

   [root@linux1 rpm -Uvh  /root/rpmbuild/RPMS/i386/test.sh-6.2-2.i386.rpm
   Preparing...                ########################################### [100%]
   This is preinstall script
   Linux linux 2.6.18-164.2.1.el5PAE #1 SMP Mon Sep 21 04:45:05 EDT 2009 i686 i686 i386 GNU/Linux
   1:test.sh                ########################################### [100%]
   Linux linux 2.6.18-164.2.1.el5PAE #1 SMP Mon Sep 21 04:45:05 EDT 2009 i686 i686 i386 GNU/Linux
   Now we wait for sleep
   100

   [root@linux1 ls /tmp

   preinstall_dir

my SPEC file:

  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
  Source0: /root/test.sh 
  Source1: /root/urim.sh
  Group: Development/Debuggers
  BuildRoot:/tmp/MY_RPM_TESTS
  License: OtherLicense
  %description


  %pre -p /bin/ksh
  print "This is preinstall script"
  uname -a
  rm -rf /tmp/preinstall_dir
  mkdir /tmp/preinstall_dir

  %install
  rm -rf %{buildroot}

  mkdir -p %{buildroot}
  mkdir -p %{buildroot}/home
  mkdir -p %{buildroot}/home/home1

  cp %SOURCE0 %{buildroot}/home
  cp %SOURCE0 %{buildroot}/home/home1

  cp %SOURCE1  %{buildroot}/home

  %files
  /home/test.sh
  /home/home1/test.sh
  /home/urim.sh



  %post -p /bin/ksh

  uname -a
  print "Now we wait for sleep" ; sleep  1
  NUM=100
  print $NUM

Build the rpm:

  [root@linux /usr/src/redhat/SPECS]# rpm -ba   /usr/src/redhat/SPECS/my_spec.spec
  Executing(%install): /bin/sh -e /root/rpmbuild/tmp/rpm-tmp.83360
  + umask 022
  + cd /root/rpmbuild/BU开发者_高级运维ILD
  + rm -rf /tmp/MY_RPM_TESTS
  + mkdir -p /tmp/MY_RPM_TESTS
  + mkdir -p /tmp/MY_RPM_TESTS/home
  + mkdir -p /tmp/MY_RPM_TESTS/home/home1
  + cp /root/rpmbuild/SOURCES/test.sh /tmp/MY_RPM_TESTS/home
  + cp /root/rpmbuild/SOURCES/test.sh /tmp/MY_RPM_TESTS/home/home1
  + cp /root/rpmbuild/SOURCES/urim.sh /tmp/MY_RPM_TESTS/home
  + /usr/lib/rpm/brp-compress
  + /usr/lib/rpm/brp-strip
  + /usr/lib/rpm/brp-strip-static-archive
  + /usr/lib/rpm/brp-strip-comment-note
  Processing files: test.sh-6.2-2
  Requires(interp): /bin/ksh /bin/ksh
  Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib    (PayloadFilesHavePrefix) <= 4.0-1
  Requires(pre): /bin/ksh
  Requires(post): /bin/ksh
  Checking for unpackaged file(s): /usr/lib/rpm/check-files /tmp/MY_RPM_TESTS
  Wrote: /root/rpmbuild/SRPMS/test.sh-6.2-2.src.rpm
  Wrote: /root/rpmbuild/RPMS/i386/test.sh-6.2-2.i386.rpm


You misunderstand. /tmp/MY_RPM_TESTS is the build root, which is created, but is only used temporarily and internally by rpmbuild. It is not meant to be part of the rpm file, and you should never try to install anything in /tmp anyway! /tmp is for temporary files only.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜