搜索

此内容没有您所选择的语言版本。

2.10.7. Software Collection Shebang Support

download PDF
A shebang is a sequence of characters at the beginning of a script that is used as an interpreter directive. The shebang is processed by the automatic dependency generator and it points to a certain location, possibly in the system root file system.
When the automatic dependency generator processes the shebang, it adds dependencies according to the interpreters they point to. From the Software Collection point of view, there are two types of shebangs:
#!/usr/bin/env example
This shebang instructs the /usr/bin/env program to run the interpreter.
The automatic dependency generator will create a dependency on the /usr/bin/env program, as expected.
If the $PATH environment variable is redefined properly in the enable scriptlet, the example interpreter is found in the Software Collection file system hierarchy, as expected.
You are advised to rewrite the shebang in your Software Collection package so that the shebang specifies the full path to the interpreter located in the Software Collection file system hierarchy.
#!/usr/bin/example
This shebang specifies the direct path to the interpreter.
The automatic dependency generator will create a dependency on the /usr/bin/example interpreter located outside the Software Collection file system hierarchy. However, when building a package for your Software Collection, you often want to create a dependency on the %{?_scl_root}/usr/bin/example interpreter located in the Software Collection file system hierarchy.
Keep in mind that even when you properly redefine the $PATH environment variable, this has no effect on what interpreter is used. The system version of the interpreter located outside the Software Collection file system hierarchy is always used. In most cases, this is not desired.
If you are using this type of shebang and you want the shebang to point to the Software Collection file system hierarchy when building your Software Collection package, use a command like the following:
find %{buildroot} -type f | \
  xargs sed -i -e '1 s"^#!/usr/bin/example"#!%{?_scl_root}/usr/bin/example"'
where /usr/bin/example is the interpreter you want to use.
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.