简体   繁体   中英

Error while installing RPM -%post script of spec-failed dependencies /bin/sh

I am trying to build RPM for my java code.RPM build and install sections works fine.But,later i have added a shell script in %post section to run shell script file that creates some files and starts the java application.The file gets copied fine.But, in %post section I get the failed dependencies bin/sh error.I am building the rpm on linux machine and target machines are centOS.I have also tried AutoReqProv: no in spec file.I am not running the install as a root user.also,target machines are not expected to have ANT(iam using it to build the java code-this might be not related to the problem) on them.I am attaching the code below.Default location of installation is in tmp folder.( for testing).

Summary: test           Summary: test
        Name: test
        Version: 1
        Release: 1
        License: Restricted
        Group: Applications/System
        BuildRoot: ~/rpm/BUILD/helloworld-root 
        URL: http://mycompany.net/helloworld.tar
        Vendor: Mycompany
        Packager: Mycompany  
        Prefix: /tmp
        BuildArchitectures: x86_64 

        %description
         Hello World

        %prep
        pwd
        %build
        pwd
        echo "changing directory"
        echo $RPM_BUILD_ROOT
        cd %{_sourcedir}
        pwd
        ant -f testbuild.xml
        %install
        pwd
        echo "in install"
        echo $RPM_BUILD_ROOT
        rm -rf $RPM_BUILD_ROOT
        mkdir -p $RPM_BUILD_ROOT/tmp/test/
        cd $RPM_BUILD_ROOT/tmp/test/
        tar -xf %{_builddir}/test.tar

        %post
        sh /tmp/test/createdb.sh
        %clean
        %files 
        /tmp/test
        %changelog

i have also searched on google but couldn't find how to run shell script from spec.with oust post section, I have tried to run through command line it executes fine.I appreciate the help if somebody can point where the problem is?

%post -p /bin/bash

这将使您的后脚本有一个终端可以运行bash命令以及您在其中执行的所有操作。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM