RPM 复制多个文件

RPM 复制多个文件

我正在尝试构建一个 RPM,它将复制一些目录及其中的文件,但是,我收到一条错误消息,指出该目录不存在。

我的代码如下:

Version: 1
Release: 0
Summary: Copy user dirs / files rpm
Source0: user-files-1.0.tar.gz
License: GPL
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-buildroot
%description
Write some descripton about your package.
%prep
%setup -q
%build
%install
install -m 0755 -d $RPM_BUILD_ROOT/tmp/user-files
#install -m 0755 -d $RPM_BUILD_ROOT/tmp/user-files/bin/
#install -m 0755 -d $RPM_BUILD_ROOT/tmp/user-files/config/
#install -m 0755 -d $RPM_BUILD_ROOT/tmp/user-files/lib64/
#install -m 0755 -d $RPM_BUILD_ROOT/tmp/user-files/var/
#install -m 0755 -d $RPM_BUILD_ROOT/tmp/user-files/usr/

cp $RPM_BUILD_ROOT/user_files-1/ $RPM_BUILD_ROOT/tmp/user-files

%clean
rm -rf $RPM_BUILD_ROOT
%post
echo . .
echo .I've finished copying the files!.
%files
%dir /tmp/user-files/*
#%dir /tmp/user-files/bin/
#%dir /tmp/user-files/config/
#%dir /tmp/user-files/lib64/
#%dir /tmp/user-files/var/
#%dir /tmp/user-files/usr/

确切的错误如下:

[sergiu@buildrpm rpmbuild]$ rpmbuild -ba SPECS/user-files.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.yL8Vqa
+ umask 022
+ cd /home/sergiu/rpmbuild/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /home/sergiu/rpmbuild/BUILD
+ rm -rf user-files-1
+ /bin/tar -xf -
+ /usr/bin/gzip -dc /home/sergiu/rpmbuild/SOURCES/user-files-1.0.tar.gz
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd user-files-1
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.6XiDeh
+ umask 022
+ cd /home/sergiu/rpmbuild/BUILD
+ cd user-files-1
+ LANG=C
+ export LANG
+ unset DISPLAY
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.pox03n
+ umask 022
+ cd /home/sergiu/rpmbuild/BUILD
+ '[' /home/sergiu/rpmbuild/BUILDROOT/user-files-1-0.x86_64 '!=' / ']'
+ rm -rf /home/sergiu/rpmbuild/BUILDROOT/user-files-1-0.x86_64
++ dirname /home/sergiu/rpmbuild/BUILDROOT/user-files-1-0.x86_64
+ mkdir -p /home/sergiu/rpmbuild/BUILDROOT
+ mkdir /home/sergiu/rpmbuild/BUILDROOT/user-files-1-0.x86_64
+ cd user-files-1
+ LANG=C
+ export LANG
+ unset DISPLAY
+ install -m 0755 -d /home/sergiu/rpmbuild/BUILDROOT/user-files-1-0.x86_64/tmp/user-files
+ /usr/bin /usr/etc /usr/games /usr/include /usr/lib /usr/lib64 /usr/libexec /usr/local /usr/sbin /usr/share /usr/src /usr/tmp
/var/tmp/rpm-tmp.pox03n: line 37: /usr/bin: is a directory
error: Bad exit status from /var/tmp/rpm-tmp.pox03n (%install)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.pox03n (%install)
[sergiu@buildrpm rpmbuild]$ nano SPECS/user-files.spec
[sergiu@buildrpm rpmbuild]$ cp SPECS/user-files.spec SPECS/user-files.spec.old
[sergiu@buildrpm rpmbuild]$ nano SPECS/user-files.spec
[sergiu@buildrpm rpmbuild]$ ls
BUILD  BUILDROOT  RPMS  SOURCES  SPECS  SRPMS
[sergiu@buildrpm rpmbuild]$ ls SPECS/
dbbackup.spec  user-files.spec  user-files.spec.old
[sergiu@buildrpm rpmbuild]$ nano SPECS/user-files.spec
[sergiu@buildrpm rpmbuild]$ rpmbuild -ba SPECS/user-files.spec
error: Name field must be present in package: (main package)
[sergiu@buildrpm rpmbuild]$ nano SPECS/user-files.spec
[sergiu@buildrpm rpmbuild]$ rpmbuild -ba SPECS/user-files.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.YvFPtC
+ umask 022
+ cd /home/sergiu/rpmbuild/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /home/sergiu/rpmbuild/BUILD
+ rm -rf user-files-1
+ /bin/tar -xf -
+ /usr/bin/gzip -dc /home/sergiu/rpmbuild/SOURCES/user-files-1.0.tar.gz
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd user-files-1
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.2esSel
+ umask 022
+ cd /home/sergiu/rpmbuild/BUILD
+ cd user-files-1
+ LANG=C
+ export LANG
+ unset DISPLAY
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.4Ccy13
+ umask 022
+ cd /home/sergiu/rpmbuild/BUILD
+ '[' /home/sergiu/rpmbuild/BUILDROOT/user-files-1-0.x86_64 '!=' / ']'
+ rm -rf /home/sergiu/rpmbuild/BUILDROOT/user-files-1-0.x86_64
++ dirname /home/sergiu/rpmbuild/BUILDROOT/user-files-1-0.x86_64
+ mkdir -p /home/sergiu/rpmbuild/BUILDROOT
+ mkdir /home/sergiu/rpmbuild/BUILDROOT/user-files-1-0.x86_64
+ cd user-files-1
+ LANG=C
+ export LANG
+ unset DISPLAY
+ install -m 0755 -d /home/sergiu/rpmbuild/BUILDROOT/user-files-1-0.x86_64/tmp/user-files
+ cp /home/sergiu/rpmbuild/BUILDROOT/user-files-1-0.x86_64/user_files-1/ /home/sergiu/rpmbuild/BUILDROOT/user-files-1-0.x86_64/tmp/user-files
cp: cannot stat `/home/sergiu/rpmbuild/BUILDROOT/user-files-1-0.x86_64/user_files-1/': No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.4Ccy13 (%install)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.4Ccy13 (%install)

有人能告诉我我做错了什么以及我该如何解决这个问题吗?

相关内容