rpmbuild sysconfdir 的不同路径

rpmbuild sysconfdir 的不同路径

我正在构建 rpm,opensips并且我想在/opt/opensips路径而不是默认系统路径中安装这个包

SPEC我在我的文件中定义了以下内容

    %define _prefix /opt/opensips
    %define _sysconfdir /opt/opensips/etc
    %define _libdir /opt/opensips/lib64
    %define _datadir /opt/opensips/share
    %define _sbindir /opt/opensips/sbin
    %define _bindir /opt/opensips/bin
    %define _mandir /opt/opensips/share/man
    ...
    ...
    ...

    %build
    LOCALBASE=/usr NICER=0 CFLAGS="%{optflags}" %{?_with_oracle:ORAHOME="$ORACLE_HOME"} %{__make} all %{?_smp_mflags} TLS=1 \
      exclude_modules="%EXCLUDE_MODULES" \
      cfg-target=%{_sysconfdir}/opensips/ \
      modules-prefix=%{buildroot}%{_prefix} \
      modules-dir=%{_lib}/%{name}/modules

    %install
    rm -rf $RPM_BUILD_ROOT
    %{__make} install TLS=1 LIBDIR=%{_lib} \
      exclude_modules="%EXCLUDE_MODULES" \
      basedir=%{buildroot} prefix=%{_prefix} sysconfdir=%{buildroot}/opt/opensips/etc \
      cfg-prefix=%{buildroot} \
      modules-prefix=%{buildroot}/%{_prefix} \
      modules-dir=%{_lib}/%{name}/modules \
      DBTEXTON=yes # fixed dbtext documentation installation

当我构建 RPM 时,出现以下错误

rpmbuild -ba opensips.spec

错误:

RPM build errors:
    File not found: /root/rpmbuild/BUILDROOT/opensips-1.11.1-1.el6.x86_64/opt/opensips/etc/rc.d/init.d/opensips
    File not found: /root/rpmbuild/BUILDROOT/opensips-1.11.1-1.el6.x86_64/opt/opensips/etc/opensips/dictionary.opensips
    File not found: /root/rpmbuild/BUILDROOT/opensips-1.11.1-1.el6.x86_64/opt/opensips/etc/sysconfig/opensips
    File not found: /root/rpmbuild/BUILDROOT/opensips-1.11.1-1.el6.x86_64/opt/opensips/etc/opensips/opensips.cfg
    File not found: /root/rpmbuild/BUILDROOT/opensips-1.11.1-1.el6.x86_64/opt/opensips/etc/opensips/opensipsctlrc
    File not found: /root/rpmbuild/BUILDROOT/opensips-1.11.1-1.el6.x86_64/opt/opensips/etc/opensips/osipsconsolerc

如果我检查我的 BUILDROOT,我可以看到它将所有这些文件放在/etc默认位置

ls -l /root/rpmbuild/BUILDROOT/opensips-1.11.1-1.el6.x86_64/etc/opensips/

我如何告诉 RPM 将这些文件放入/opt/opensips/etc/目录中?

答案1

在“make install”命令之后将文件从 /etc/opensips 移动到 /opt/opensips 。

相关内容