I have created rpm for one of the package. I want to install that rpm in opt directory but by default it gets installed in root directory. I have tried using Prefix in spec file but it's not working. I have tried rpm -ivh --prefix=/opt as well but rpm always gets installed in root directory. rpm is relocatable.
The output of rpm -qpi abc.rpm
:
Name : abc
Version : 1.4
Release : 0
Architecture: x86_64
Install Date: (not installed)
Group : Applications/Multimedia
Size : 39054113
License : GPL
Signature : (none)
Source RPM : abc.rpm
Build Date : Wednesday 05 August 2020 09:10:51 PM IST
Build Host : localhost
Relocations : /usr
Packager :
Summary : Xiph Streaming media server that supports multiple formats.
Description :
SPEC file for RPM:
Name: abc
Version: 1.4
Release: 0
Summary:
Group:
License:
Source: %{name}.tar.gz
Prefix: %{_prefix}
Packager: xyz
BuildRoot: %{_tmppath}/%{name}-root
%description
rpm
%Prefix /opt
%prep
rm -rf %{_topdir}/BUILD/*
%setup -n abc
%build
%install
mkdir -p -m0755 %{buildroot}/
cp -r %{_builddir}/%{name} %{buildroot}/
%clean
#rm -rf %{buildroot}
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
/abc/daemon
/abc/proxy
/abc/service-files
/abc/pip-selfcheck.json
/abc/requirements.txt
/abc/README.md
/abc/.git
/abc/venv.tar.gz