rpm U选项要使用?

时间:2012-04-20 04:56:52

标签: rpm rpmbuild

我想以这样的方式升级我的安装组件,即只更换指定的文件并且结构不会改变

rpm -qlp CDA-4.2.1-201203020211.i386.rpm 
/opt/CDA/agent/bin/agent_client
/opt/CDA/agent/bin/Agent
/opt/CDA/agent/bin/cda_agent
/opt/CDA/agent/conf/agent.conf
/opt/CDA/agent/conf/agent.ini


 rpm -qlp CDA-4.2.1.1-201203020211.i386.rpm 
 /opt/CDA/agent/bin/Agent




   installed component CDA-4.2.1-201203020211.i386.rpm   
       when i do rpm -U  CDA-4.2.1.1-201203020211.i386.rpm 
          all the files get remvoved excpet /opt/CDA/agent/bin/Agent, 
        i'm struggling with the right rpm -U addional options,
         i want only /opt/CDA/agent/bin/Agent to be replaced

我需要阻止删除所有旧版本的软件包,只需替换存在的新文件

1 个答案:

答案 0 :(得分:1)

新rpm必须包含所有文件,而不仅仅是要更新的文件。如果将文件列为%config(noreplace),则在更新期间不会替换它们,而是如果安装的文件已更改,则在安装更新的rpm后将创建X.rpmnew文件。换句话说,你的CDA.spec应该有:

...
%files
...
%config(noreplace) /opt/CDA/agent/conf/agent.ini # similar for other config files
...