RPM build error: cannot create regular file |没有这样的文件或目录



Linux发行版:Ubuntu 20
(因此使用rpm包而不是rpmdevtools-package来构建rpm)

rpmbuild目录结构:


rpmbuild
├── BUILD
│   └── alascript-1
│       ├── config.cfg
│       ├── logfile.txt
│       └── script.sh
├── BUILDROOT
│   └── alascript-1-0.x86_64
│       └── etc
│           └── alascript15
├── RPMS
├── SOURCES
│   ├── alascript-1
│   │   ├── config.txt
│   │   ├── logfile.txt
│   │   └── script.sh
│   └── alascript-1.0.tar.gz
├── SPECS
│   └── alascript.spec
└── SRPMS

alascript-1.0.tar.gz是上述文件夹即alascript-1的tar文件。

这是我的规范文件:

Name:           alascript
Version:        1
Release:        0
Summary:        A Bash Script for secure copying from eNodeB to server.
Group:          theogs
BuildArch:      noarch
License:        GPL
URL:            https://github.com/
Source0:        alascript-1.0.tar.gz

%description
The bash script will basically secure copy files
from the eNodeB to server and then those files will be
processed using ML Ananlyser.
%prep
%setup -q
%build
%install
install -m 0755 -d $RPM_BUILD_ROOT/etc/alascript
install -m 0600 config.cfg $RPM_BUILD_ROOT/etc/alascript/config.cfg
install -m 0644 logfile.txt $RPM_BUILD_ROOT/etc/alascript/logfile.txt
install -m 0755 script.sh $RPM_BUILD_ROOT/etc/alascript/script.sh
%files
/etc/alascript
/etc/alascript/config.cfg
/etc/alascript/script.sh
/etc/alascript/logfile.txt
%changelog
* Mon Jun 20 2022 theogs 1.0.0
- Initial rpm release

现在,当我尝试运行命令:rpmbuild -ba SPECS/alascript.spec我得到以下输出:

Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.wSNbxX
+ umask 022
+ cd /home/test/rpmbuild/BUILD
+ cd /home/test/rpmbuild/BUILD
+ rm -rf alascript-1
+ /bin/gzip -dc /home/test/rpmbuild/SOURCES/alascript-1.0.tar.gz
+ /bin/tar -xof -
+ STATUS=0
+ [ 0 -ne 0 ]
+ cd alascript-1
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.CCUFwV
+ umask 022
+ cd /home/test/rpmbuild/BUILD
+ cd alascript-1
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.BT4UXX
+ umask 022
+ cd /home/test/rpmbuild/BUILD
+ cd alascript-1
+ install -m 0755 -d /home/test/rpmbuild/BUILDROOT/alascript-1-0.x86_64/etc/alascript
+ install -m 0600 config.cfg /home/test/rpmbuild/BUILDROOT/alascript-1-0.x86_64/etc/alascript/config.cfg
install: cannot create regular file '/home/test/rpmbuild/BUILDROOT/alascript-1-0.x86_64/etc/alascript/config.cfg'$'r': No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.BT4UXX (%install)

我是bash和shell脚本的新手,从来没有制作过rpm包。我不知道出了什么问题。

也是我所关注的参考博客:如何创建一个RPM包

您希望在SPEC文件

中有一些特殊字符显示目录树

时可见015年└──alascript

015(八进制)是CR(回车)

你是否从某处复制粘贴了一部分代码?

最简单的修复方法是通过格式化工具运行spec文件,如dos2unix

相关内容

  • 没有找到相关文章

最新更新