简体   繁体   中英

RPM build fails on install section

I am trying to build my first rpm package, which is one simple executable (mysh).

My spec file:

Summary: bla <br>
Name: mysh <br>
Version: 1.0 <br>
Release: 1 <br>
Group: Applications <br>
Source: mysh-1.0.tar.gz <br>
URL: http://www.google.com <br>
Vendor: tadas sofware inc. <br>
Packager: tadas <br>
License: GPL 

%description <br>
a very good program!

%prep <br>
rm -rf $RPM_BUILD_DIR/mysh-1.0 <br>
zcat $RPM_SOURCE_DIR/mysh-1.0.tar.gz | tar -xvf -

%build <br>
make 

%install <br>
cp mysh /usr/local/bin/mysh

%files <br>
/usr/local/bin/mysh

It fails with the following error:

cd: 8: can't cd to /home/tadzys/rpm/BUILDROOT/mysh-1.0-1.x86_64

Of course this file doesn't exist there. I've tried copying it there still there same error. Not sure if my install section should put anything to BUILDROOT folder.

I am on Ubuntu 11.04.

When you refer to directories in the target machine within the %install section, you need to reference everything relative to $RPM_BUILD_ROOT (or %{buildroot} ):

%install
cp mysh $RPM_BUILD_ROOT/usr/local/bin/mysh

The %files section does not need to be updated, however.

Also, you should consider using the install command when copying files around. It's similar to cp , but install allows you to set the permission bits for the target file:

%install
install -m 755 mysh $RPM_BUILD_ROOT/usr/local/bin/mysh

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