简体   繁体   English

在规范文件中获取 RPM 文件位置

[英]getting RPM file location in the spec file

I am building an RPM file, during installation of the RPM i need to get the path of the.rpm file我正在构建一个 RPM 文件,在安装 RPM 期间我需要获取 .rpm 文件的路径
echo $PWD will return - '/' echo $PWD将返回 - '/'
echo %(pwd) will return the path to the location of the RPM build echo %(pwd)将返回 RPM 构建位置的路径

to explain further进一步解释
lets assume that i am producing A.rpm file, when deploying on a remote system i want to put on the remote system to files假设我正在生成 A.rpm 文件,在远程系统上部署时,我想将远程系统放到文件中

A.rpm argument.txt A.rpm 参数.txt

in the %pre section i want to read the argument.txt file ie something of the sort在 %pre 部分中,我想阅读 argument.txt 文件,即类似的东西

if [ ! -f [what to put here]/argument.txt ]; then
 do something
fi 
  • the rpm file location is unknown during buildtime构建时 rpm 文件位置未知
  • the argument file is guaranteed to be placed alongside the rpm保证参数文件放在 rpm 旁边

How can I achieve this?我怎样才能做到这一点? is there a macro which i am unaware of?有没有我不知道的宏?

Thanks in advance for any help,提前感谢您的帮助,

%pre is executed before installing package. %pre在安装 package之前执行。 Therefore you cannot access the content of the package.因此,您无法访问 package 的内容。 You may do that in %post and then it is in normal path (its destination).您可以在%post中执行此操作,然后它位于正常路径(其目的地)中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM