RPM升级配置文件的处理 [英] Rpm upgrade handling of config files

查看:275
本文介绍了RPM升级配置文件的处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用rpm -upgrade命令,发现rpm处理修改后的配置文件的方式不同,因此升级时不会丢失。据我了解,如果修改了配置文件,并且使用rpm -U升级了软件包,则rpm会将原始属性文件重命名为{file} .rpmsave并安装具有原始文件名{file}的新配置文件。

I'm playing around with the rpm -upgrade command and noticed rpm has different ways of handling modified configuration files so it doesn't get lost during the upgrade. From what I understand, if a config file was modified and the package is upgraded with rpm -U, rpm will rename the original properties file as {file}.rpmsave and install the new configuration file with the original file name {file}.

但是,当我尝试使用已创建的程序包运行rpm -U时,实际上看到的是原始配置文件被删除而新配置文件被删除。重命名为{file} .rpmsave。这是预期的行为吗?在我的安装脚本中,我还使用 sed修改了配置文件中的一些文本。

However, when I attempt to run rpm -U with the package I've created, what I actually see is the original configuration file gets deleted and the new configuration file gets renamed to {file}.rpmsave. Is this the intended behavior? In my install script I also modify some text in the configuration file with "sed". Could this have interfered with the way rpm handles configuration file during an upgrade?

推荐答案

这是预期的行为吗?这可能会干扰rpm在升级过程中处理配置文件的方式吗?如果您希望配置文件永远不会被覆盖(并移至.rpmsave),请使用%config(noreplace)而不是%config ,该文件将不会被替换。取而代之的是,将从rpm包中的新文件创建为.rpmnew,然后将其中一个保留下来。

This is the intended behaviour. If you want the configuration file to never get overwritten (and moved to .rpmsave), use %config(noreplace) instead of %config in the rpm .spec file, and the file won't be replaced. Instead, the new file from the rpm package will get created as .rpmnew, and the one there is left alone.

这篇关于RPM升级配置文件的处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆