【发布时间】:2016-03-17 11:43:08
【问题描述】:
这里有个问题:
- 我需要从我自己的 rpm 包中安装 CentOS 7 中的包(我们称之为“testpack”)。感谢 Stackoverflow 的人,我知道我需要从 .spec 文件的“Requires”部分安装此测试包,但需要从非默认存储库安装测试包。
这是一个问题:
- 如何在具有字符串“Requires: testpack”的 .spec 文件中添加非默认存储库?添加新存储库和安装 testpack 需要从同一个包中进行。有可能吗?
这是我奇怪的预解决方案:
- 尝试在.spec 文件的
%pre和%prep部分中添加类似curl http://domain.com/testpack_repo.sh | bash /dev/stdin arg1的字符串,但该部分仅在rpm 使用rpmbuild --bb test.spec生成时启动。如果我尝试使用yum install test.rpm在其他系统中安装此软件包,此部分将被忽略; - 尝试在
%post部分中添加curl http://domain.com/testpack_repo.sh | bash /dev/stdin arg1而不抱任何希望。这部分在yum install test.rpm期间被忽略,因为从“Requires”安装的测试包失败; - 尝试使用带有 curl 的 bash 脚本而不是裸 curl - 得到相同的结果;
- 尝试在 .spec 文件的不同部分使用
echo repo_info > repo_file- 再次失败。
这是我的 .spec 文件:
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 <test@test.com>
- test_script_changelog!
希望得到帮助。谢谢。
【问题讨论】: