How to run own shell script from spec

devzero2000 pinto.elia at gmail.com
Mon Sep 7 10:24:50 UTC 2009


On Sun, Sep 6, 2009 at 11:31 AM, ram s <ramforummail at gmail.com> wrote:

> Hi,
>
> I am creating on example.sh in my source folder and tar it and put it in
> /home/user/rpmbuild/SOURCES directory.
>
>
> In that example.sh, I am creating one directory in my tmp folder.
>
> But, when I run the spec file, it not execute the shell script and run the
> command.
>
> I am using %pre section to run that shell script.
>
> My spec file is,
>
> ******************************************************************
>
> Summary: This Package install example daemon application
> Name: example
> Version:1
> Release:5
> License: CC-GNU GPL version 2.0
> Group: Applications/System
> Source:example-1.tar.gz
> BuildRoot:%{_tmppath}/%{name}-root
> Requires: python = 2.2.3
> Requires: gcc
> Requires(post): /bin/sh
> BuildRequires:  libpcap
> BuildRequires: gawk
>
> BuildArch:x86_64
> Packager:S.Jayaram
>
> %description
> This Package install CDaemon application
> %prep
>
> %setup -q
> %build
> %{__make}
> %pre
> sh example.sh
> sh javacheck.sh
> %install
> rm -rf $RPM_BUILD_ROOT
> mkdir -p $RPM_BUILD_ROOT/%{_tmppath}
> install -m755 example   $RPM_BUILD_ROOT%{_tmppath}/example
> %makeinstall
>
> %files
> %defattr(-,root,root,-)
> #%dir /home/nco_user/rpmbuild/SOURCES/example-1
> %{_bindir}/*
>
>
> %clean
> %{__rm} -rf %{buildroot}
>
>
>
>
> ***************************************************************
>
> My script is,
> #!/bin/sh
> mkdir /home/nco_user/rpmbuild/tmp/CDaemon
>
> I am not able to run the script and create the folder.
>
> When I run rpmbuild , it run properly and create the binary.
>
> But when I installed it shows following error,
>
> [error]
> Preparing...                ###########################################
> [100%]
> sh: example.sh: No such file or directory
> sh: javacheck.sh: No such file or directory
> error: %pre(example-1-5.x86_64) scriptlet failed, exit status 127
> error:   install: %pre scriptlet failed (2), skipping example-1-5
> ////////////////////////////////////////////////////
>
>
> what is my problem.
> I put my shell scripts in /home/user/rpmbuild/SOURCES/example-1/ directory
> and finally tar it.
>
> where can i call my own custom shell scripts.
>
>  You have to install in %install and update the %files section with these
scripts. %pre is for preinstall - e.g. before install on the final system
when you install the rpm at execution time, not at build time.

> thank you.
>
>
>
> And, SIA, but it is not bad at all to read some docu before to doing a rpm
(or other thing)
(http://docs.fedoraproject.org/drafts/rpm-guide-en/) and before asking
http://catb.org/~esr/faqs/smart-questions.html#rtfm<http://catb.org/%7Eesr/faqs/smart-questions.html#rtfm>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-list/attachments/20090907/ef8ad753/attachment.htm>


More information about the Rpm-list mailing list