使用dispatch-conf更新config文件
>>> 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.
象这样的信息相信大家都见过了吧。要update这些config文件,可以用etc-update,不过我这儿想介绍一个类似的工具,dispatch-conf。这是我的配置档/etc/dispatch-conf.conf:
#
# 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
如果要使用rcs,首先要:
# emerge rcs
当然还要:
# mkdir /etc/config-archive
用dispatch-conf来更新config文件很简单,运行:
# dispatch-conf
首先dispatch-conf会将要update的config文件在/etc/config-archive里做个备份,然后会一个个显示需要处理 的 文件。你会看到文件里(look-merge)有些行前面有+或-的符号(diff的显示),这代表automerge会将这些行加入或删减 (按空 格键翻页,如果文件太长,按‘q’退出),你会看到类似这样的信息:
>> (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:
如果按m进行merge,你会看到/etc/DIR_COLORS和/etc/._cfg0000_DIR_COLORS并列出现,旧的在左边,新的在右边。
然后可以按以下的命令进行merge:
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.
完成后,会显示新的将会变更的内容;按’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雷同,至于用哪个工具,使用者自己决定吧。