QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 869|回复: 0

用dispatch-conf更新你的配置文件!

[复制链接]
发表于 2004-5-16 17:41:51 | 显示全部楼层 |阅读模式
[code:1]>>> No outdated packages were found on your system.


* GNU info directory index is up-to-date.
* IMPORTANT: 37 config files in /etc need updating.
* IMPORTANT: 5 config files in /usr/kde/3.2/share/config need updating.
* Type emerge --help config to learn how to update config files.
[/code:1]
象这样的信息相信大家都见过了吧。要update这些config文件,可以用etc-update,不过我这儿想介绍一个类似的工具,dispatch-conf。这是我的配置档/etc/dispatch-conf.conf:
[code:1]
#
# dispatch-conf.conf
#

# Directory to archive replaced configs
archive-dir=/etc/config-archive

# Use rcs for storing files in the archive directory?
# (yes or no)
use-rcs=yes

# Diff for display
diff="diff -Nau %s %s"

# Pager for diff display
pager="less --no-init --QUIT-AT-EOF"

# Automerge files comprising only CVS interpolations (e.g. Header or Id)
# (yes or no)
replace-cvs=yes

# Automerge files comprising only whitespace and/or comments
# (yes or no)
replace-wscomments=yes

# Automerge files that the user hasn't modified
# (yes or no)
replace-unmodified=yes
[/code:1]
如果要使用rcs,首先要:
# emerge rcs
当然还要:
# mkdir /etc/config-archive
用dispatch-conf来更新config文件很简单,运行:
# dispatch-conf
首先dispatch-conf会将要update的config文件在/etc/config-archive里做个备份,然后会一个个显示需要处理的文件。你会看到文件里(look-merge)有些行前面有+或-的符号(diff的显示),这代表automerge会将这些行加入或删减 (按空格键翻页,如果文件太长,按‘q’退出),你会看到类似这样的信息:
[code:1]
>> (1 of 33) -- /etc/DIR_COLORS
>> q quit, h help, n next, e edit-new, z zap-new, u use-new
   m merge, t toggle-merge, l look-merge:
[/code:1]
如果按m进行merge,你会看到/etc/DIR_COLORS和/etc/._cfg0000_DIR_COLORS并列出现,旧的在左边,新的在右边。
然后可以按以下的命令进行merge:
[code:1]
ed:     Edit then use both versions, each decorated with a header.
eb:     Edit then use both versions.
el:     Edit then use the left version.
er:     Edit then use the right version.
e:      Edit a new version.
l:      Use the left version.
r:      Use the right version.
s:      Silently include common lines.
v:      Verbosely include common lines.
q:      Quit.
[/code:1]
完成后,会显示新的将会变更的内容;按’q‘退出,然后按e(edit-new)做最后的编辑。接着就可以按’u‘启用新的文件了(/etc/._cfg0000_DIR_COLORS当然会给删掉了)。
以上是人手作merge的一个例子,实际上很多文件都可以直接按’u‘采用新版,尤其是/etc/init.d/里的那些脚本及一些你从不会去改的文件(以上的/etc/DIR_COLORS便是一例)。Gentoo特有的东西,象make.conf这样的,最好是人手merge一下;象fstab这样的标准linux配置文件则可以直接zap-new,即删了._cfg0000_fstab然后继续。

PS 以上有些步骤与etc-update雷同,至于用哪个工具,使用者自己决定吧。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-10-5 10:31 , Processed in 0.094100 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表