Bruce Banner
Bruce Banner

Reputation: 331

Build a RedHat RPM from a tar file

I have a tar file myapp.tar.gz, that contains binaries. When untared, the directory structure created is something like this:

myapp/
-bin/myapp
-lib/mylib
<more directories and subdirectories and file>

I want to create a RedHat RPM for myapp, when installed the RPM should simply untar my application binaries in /usr/local/myapp. I am struggling with the RPM spec file, it seems overly complicated. All I want it to do is untar my app in /usr/local/myapp.

This is what I have tried so far:

Name:           myapp
Version:        0.1
Release:        1%{?dist}
Summary:        myapp

License:        apache
URL:            myapp
Source0:        myapp.tar.gz

BuildArch:      noarch

%description
MyApp does fun things.

%prep
%setup -q

%build

%install

mkdir -p %{buildroot}/%{_bindir}

install -m 0755 %{name} %{buildroot}/%{_bindir}/%{name}

%files
%license LICENSE
%{_bindir}/%{name}

This is not working for me, not sure why.

Upvotes: 1

Views: 886

Answers (1)

Aaron D. Marasco
Aaron D. Marasco

Reputation: 6748

RPMs are not supposed to install into /usr/local/. Ignoring that, assuming you are doing this for like a small company internal distribution or something, you are using %{_bindir} which is going to be something like /bin/ or /usr/bin/. Change every occurrence of that to /usr/local/ and then post the actual errors you're seeing.

Note: This assumes your tarball has files in it under the myapp directory within the tarball. If not, see https://docs.fedoraproject.org/en-US/package-maintainers/Packaging_Tutorial_GNU_Hello/ for more help.

Upvotes: 0

Related Questions