4.5.3. Bash 程序示例的 spec 文件示例


对于使用 bash 编写的 bello 程序,您可以使用以下示例 spec 文件作为参考。

使用 bash 编写的 bello 程序的 spec 文件示例

Name:           bello
Version:        0.1
Release:        1%{?dist}
Summary:        Hello World example implemented in bash script

License:        GPLv3+
URL:            https://www.example.com/%{name}
Source0:        https://www.example.com/%{name}/releases/%{name}-%{version}.tar.gz

Requires:       bash

BuildArch:      noarch

%description
The long-tail description for our Hello World Example implemented in
bash script.

%prep
%setup -q

%build

%install

mkdir -p %{buildroot}/%{_bindir}

install -m 0755 %{name} %{buildroot}/%{_bindir}/%{name}

%files
%license LICENSE
%{_bindir}/%{name}

%changelog
* Tue May 31 2016 Adam Miller <maxamillion@fedoraproject.org> - 0.1-1
- First bello package
- Example second item in the changelog for version-release 0.1-1

  • BuildRequires 指令指定软件包的 build-time 依赖项已被删除,因为没有可用于 bello 的构建步骤。Bash 是原始解释编程语言,文件仅安装到其系统上的位置。
  • Requires 指令,其指定软件包的运行时依赖项,仅包含 bash,因为 bello 脚本只需要 bash shell 环境即可执行。
  • 指定如何构建软件的 %build 部分为空,因为不需要构建 bash 脚本。
注意

要安装 bello,您必须创建目标目录,并在其中安装可执行的 bash 脚本文件。因此,您可以在 %install 部分中使用 install 命令。您可以使用 RPM 宏来执行此操作,而无需硬编码路径。

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部