>>> 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雷同,至於用哪個工具,使用者自己決定吧。
http://ted.is-programmer.com/posts/4464.html