在rpmbuild中安装服务器应用程序时自动安装jdk

时间:2016-05-18 08:08:46

标签: rhel rpmbuild rhel7

我尝试将包含已配置的服务器wildfly的rpm与应用程序一起进行。我试图让RPM包含JDK。以下文件仅表示所需元素。是否可以在安装期间执行wildfly-as-8.0.0-0.1.Beta1.el7.noarch.rpm自动安装JDK(jdk-8u92-linux-x64.rpm)。这样即使没有Internet访问,您也可以安装整体。

%global namedreltag .Beta1
%global namedversion %{version}%{?namedreltag}

# We don't need to repack jars for this package
%define __jar_repack %{nil}
# There are some arch dependent files, ignore them
%define _binaries_in_noarch_packages_terminate_build 0

Name:             wildfly-as
Version:        8.0.0
Release:        0.1%{namedreltag}%{?dist}
Summary:        WildFly Application Server

License:        LGPLv2+ and ASL 2.0 and GPLv2 with exceptions
URL:              http://wildfly.org/
Source0:        http://download.jboss.org/wildfly/%{namedversion}/wildfly-%{namedversion}.tar.gz

Requires:       jdk >= 1:1.8

BuildArch:     noarch

%description
WildFly Application Server (formerly known as JBoss Application Server) is the
latest release in a series of WildFly offerings. WildFly Application Server, is
a fast, powerful, implementation of the Java Enterprise Edition 6
specification.  The state-of-the-art architecture built on the Modular Service
Container enables services on-demand when your application requires them.

Please note that this package is not following the Fedora guidelines. This
package is created to make the OpenShift cartridge for WildFly.

%prep
%setup -q -n wildfly-%{namedversion}

%install
install -d -m 755 %{buildroot}/opt/wildfly-%{namedversion}

cp -r * %{buildroot}/opt/wildfly-%{namedversion}

%files
/opt/wildfly-%{namedversion}
%doc README.txt README.txt

%changelog
* Thu Dec 05 2013 Marek Goldmann <mgoldman@redhat.com> - 8.0.0-0.1.Beta1
- Initial packaging

1 个答案:

答案 0 :(得分:0)

由于rpmbuild只运行脚本,因此可以在构建期间执行脚本的任何过程,包括下载/安装/删除jdk。

同时,通常做的是将Buildrequires:添加到指定所需内容的包中,然后让yum / dnf之类的依赖解算器进行安装,而不是让每个包构建都尝试自定义安装先决条件