Code: Select all
>>> 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:
Code: Select all
#
# 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會將這些行加入或删減 (按space鍵翻頁,如果檔案太長,按‘q’退出),你會看到类似這樣的訊息:
Code: Select all
>> (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:
然後可以按以下的指令進行merge:
Code: Select all
ed: 編輯兩個版本,並且使用一個 header。
eb: 編輯然後使用兩個版本。
el: 編輯然後使用左邊的版本。
er: 編輯然後使用右邊的版本。
e: 編輯新的版本。
l: 使用左邊的版本。
r: 使用右邊的版本
s: 安靜的]含常使用的行數。
v: 詳細的顯示]含長使用的行數。
q: 離}。
以上是互動式的融入更新的一個例子,實際上很多檔案都可以直接按’u‘採用新版,尤其是/etc/init.d/裡的那些scripts及一些你從不會去改的檔案(以上的/etc/DIR_COLORS便是一例:))。Gentoo特有的東西,象make.conf這樣的,最好是互動地merge一下;象fstab這樣的標准linux設定檔則可以直接zap-new,即删了._cfg0000_fstab然後繼續。
PS 以上有些步驟與etc-update雷同,至於用哪個工具,使用者自己決定吧。