rpm中config,config(noreplace)区别
问题描述
最近才知道公司安装新版本,不是rpm -e卸载再rpm -ivh安装,而是rpm -Uvh直接升级,导致了安装包里有些文件没有覆盖原有文件。
解决方法
找config,config(noreplace)的原理说明,http://people.ds.cam.ac.uk/jw35/docs/rpm_config.html 中有这样的总结:
In summary: if a file is not marked as a config file, or if a file has not been altered since installation, then it will be sliently replaced by the version from an update RPM. If a config file has been edited on disk, but is not actually different from one RPM to another then the edited version will be silently left in place. It is only when a config file has been edited and is different from one RPM to the next that what happens depens on the (noreplace) option. If absent, the new file will be installed, and the the old edited version will be renamed with a .rpmsave suffix. If present, the edited version will be left in place, and the new version will be installed with a .rpmnew suffix.
翻译总结如下:
总之,如果
- 一个文件没被标记,或者没被更改,会被新rpm包里的文件覆盖。
- 标记文件有被修改,但新旧rpm包的该文件是一样的,那么该文件不会被覆盖,保留修改后的文件。
- 新旧rpm包的该文件不同,则根据这文件的标记行事。
- 文件被标记为%config,文件被覆盖为新版本文件,原修改后的文件保存为*.rpmsave。
- 文件被标记为%config(noreplace),文件不会被覆盖,新rpm包里的文件被保存为 *.rpmnew.
之前我在rpm包里把文件标记为%config(noreplace),所以文件没替换掉原有的文件,将标记改为%config即可。