我想使用此spec文件创建RPM包:
Name: some-agent
Version: 1.0
Release: 1%{?dist}
Summary: Linux Agent installation script
Group: Utilities
License: license
Source0: some-agent-1.0.tar.gz
BuildArch: x86_64
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%description
%prep
%build
%install
mkdir -p %{buildroot}/opt/agent
#install -m 0755 -d $RPM_BUILD_ROOT/opt/agent
cp -a * %{buildroot}
%clean
rm -rf $RPM_BUILD_ROOT
%files
%dir
/opt/agent
%defattr(-,root,root,-)
%doc
%changelog
我运行此命令:
user@laptop ~]$
[user@laptop ~]$ rpmbuild -bb -v ~/rpm/SPECS/kernel.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.f1O2AV
+ umask 022
+ cd /home/rcbandit/rpm/BUILD
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.ozgVAb
+ umask 022
+ cd /home/rcbandit/rpm/BUILD
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.SrwYCr
+ umask 022
+ cd /home/rcbandit/rpm/BUILD
+ mkdir -p /home/rcbandit/rpm/BUILDROOT/some-agent-1.0-1.el6.x86_64/opt/agent
+ cp -a some-agent-1.0.tar.gz /home/rcbandit/rpm/BUILDROOT/some-agent-1.0-1.el6.x86_64
+ /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/brp-compress
+ /usr/lib/rpm/brp-strip
+ /usr/lib/rpm/brp-strip-static-archive
+ /usr/lib/rpm/brp-strip-comment-note
Processing files: some-agent-1.0-1.el6.x86_64
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/rcbandit/rpm/BUILDROOT/some-agent-1.0-1.el6.x86_64
error: Installed (but unpackaged) file(s) found:
/some-agent-1.0.tar.gz
RPM build errors:
Installed (but unpackaged) file(s) found:
/some-agent-1.0.tar.gz
[user@laptop ~]$ ^C
[user@laptop ~]$
我在tar.gz包中有一个Java文件,因此我不需要任何编译,只需将文件解压缩到目标目录。
你能帮我解决这个问题吗?
答案 0 :(得分:0)
您需要在(当前为空)%build
部分中提取这些文件,然后将其%install
部分复制到%{buildroot}
下的目标位置。网上有很多引物。