This is my first foray into Linux RPM creation, and I am exploring it as a solution to distribute a package of software that consists mostly of files and some configuration.
I have read through some documentation, but I feel some sections are ambiguous between the build system, and the target installation system.
I have written a SPEC file for rpmbuild, and it builds the RPM, but it seems to not do anything when I install it on the local system. It just says it was installed.
I have removed almost all aspects, and am just trying to get RPM to create a directory. It is not being created.
Anything wrong I am doing here?
%define _topdir /sourcecode/agent/rpm/
%define name agent
%define release 0
%define version 0.1a
%define buildroot %{_topdir}/BUILD
BuildRoot: %{buildroot}
Summary: agent
License: GNU
Name: %{name}
Version: %{version}
Release: %{release}
Source0: hello.sh
Prefix: /opt
Group: PhysicalEdge
%prep
%build
%install
mkdir -p /opt/edgeagent
cp %{SOURCE0} /opt/edgeagent/hello.sh
%files
%defattr(-,root,root)
Another question I had was to include files, I have listed them in Source's (Source0: hello.sh). Do I list them in the %files directive where they started on the source system, or where they end up on the target system?
I am trying to get the file hello.sh into /opt/agent/ on the target system for now.
Thanks!
This is wrong:
cp %{SOURCE0} /opt/edgeagent/hello.sh
You shouldn't ever build RPMs as root! This command should have failed.
What you wanted is:
mkdir -p %{buildroot}/opt/edgeagent/
cp %{SOURCE0} %{buildroot}/opt/edgeagent/hello.sh
Then add /opt/edgeagent/hello.sh
to the %files
section as you speculated.