【发布时间】:2018-10-02 12:45:33
【问题描述】:
我正在使用规范文件来创建 RPM 包。我只想打包系统上存在的那些文件。在我的%files 部分,我正在编写要包含在我的包中的文件。条件包和非条件包的包含方式如下。
%files
%if "%is_file1_present"
%attr (-, root, root) /location/to/file1
%attr (-, root, root) /location/to/file2
%endif
%attr (-, root, root) /location/to/file3
%attr (-, root, root) /location/to/file4
%is_file1_present 在%build 部分中定义如下。
%build
%define is_file1_present %( if [ -f /location/to/file1 ]; then echo "1" ; else echo "0"; fi )`
在尝试构建 RPM 包时,它似乎忽略了 if 条件。我做错了什么?
【问题讨论】: