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脚本只需要bashshell 环境即可执行。 -
指定如何构建软件的
%build部分为空,因为不需要构建bash脚本。
注意
要安装 bello,您必须创建目标目录,并在其中安装可执行的 bash 脚本文件。因此,您可以在 %install 部分中使用 install 命令。您可以使用 RPM 宏来执行此操作,而无需硬编码路径。