0
votes

Here is a problem:

  • I need to install package in CentOS 7 (let's call it "testpack") from my own rpm-package. Thanks to guys from Stackoverflow, I know that I need to install this testpack from "Requires" section of .spec file, but the testpack need to be installed from non-default repository.

Here is a question:

  • How can I add non-default repository within .spec file which has a string "Requires: testpack"? Adding new repository and installing testpack need to do from the same package. Is it possible?

Here is my strange pre-solutions:

  • try to add string like that curl http://domain.com/testpack_repo.sh | bash /dev/stdin arg1 in %pre and %prep section of .spec file, but that section is launch only while rpm is making with rpmbuild --bb test.spec. If I try to install this package in other system with yum install test.rpm this section is ignored;
  • try to add curl http://domain.com/testpack_repo.sh | bash /dev/stdin arg1 in %post section without hope. This section is ignored during yum install test.rpm because of testpack installing from "Requires" were failed;
  • try to use bash script with curl instead naked curl - got the same result;
  • try to use echo repo_info > repo_file in different section of .spec file - failed again.

Here is my .spec file:

Name: test_script_name
Summary: It's just a test_script_summary
Version: 0.1 
Release: 1
Group: Applications/Internet
License: GPL 
Requires: testpack
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-root

%description
A test_script_description.

%pre
curl http://domain.com/test.sh | bash /dev/stdin arg1

%prep 
%build
%install
%clean
%post
#bash test.sh
%files
%defattr(-,root,root)

%changelog
* Tue Dec 08 2015 test test <[email protected]>
- test_script_changelog!

I hope for help. Thank you.

1

1 Answers

0
votes

No, you can't.

You can make a single RPM that the user downloads that then drops your GPG key and repo location files in the appropriate locations.

Take a look at something like https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm to see how they do it for EPEL.