用dispatch-conf更新你的系統設定檔!

Moderator: Forums Team

Post Reply
Hauser
Posts: 44
Joined: Sun May 16, 2004 7:36 pm
Location: 夢鄉

用dispatch-conf更新你的系統設定檔!

Post by Hauser »

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:
如果按m進行merge,你會看到/etc/DIR_COLORS和/etc/._cfg0000_DIR_COLORS并列出現,舊的在左邊,新的在右邊。
然後可以按以下的指令進行merge:

Code: Select all

ed:     編輯兩個版本,並且使用一個 header。
eb:     編輯然後使用兩個版本。
el:     編輯然後使用左邊的版本。
er:     編輯然後使用右邊的版本。
e:      編輯新的版本。
l:      使用左邊的版本。
r:      使用右邊的版本
s:      安靜的]含常使用的行數。
v:      詳細的顯示]含長使用的行數。
q:      離}。
完成後,會顯示新的將會變更的内容;按’q‘退出,然後按e(edit-new)做最後的編輯。接着就可以按’u‘啟用新的設定檔了 (/etc/._cfg0000_DIR_COLORS當然會給删掉了)。
以上是互動式的融入更新的一個例子,實際上很多檔案都可以直接按’u‘採用新版,尤其是/etc/init.d/裡的那些scripts及一些你從不會去改的檔案(以上的/etc/DIR_COLORS便是一例:))。Gentoo特有的東西,象make.conf這樣的,最好是互動地merge一下;象fstab這樣的標准linux設定檔則可以直接zap-new,即删了._cfg0000_fstab然後繼續。

PS 以上有些步驟與etc-update雷同,至於用哪個工具,使用者自己決定吧。
Athlon XP 2600+; 512M RAM;
nVidia FX5700LE; Hitachi 120Gb
2.6.9-nitro3+FBSplash; XOrg-6.8.0+KDE3.3.1; Reiser4;
昔 我 往 矣 . 楊 柳 依 依 . 今 我 來 思 . 雨 雪 霏 霏 .
行 道 遲 遲 . 載 渴 載 飢 . 我 心 傷 悲 . 莫 知 我 哀 .
dno
Posts: 51
Joined: Sun Nov 30, 2003 5:13 pm
Location: 台灣 / 桃園 / 龜山
Contact:

Post by dno »

介紹的真仔細,改天來試試 ^^
ww
Posts: 142
Joined: Sun Feb 15, 2004 3:37 pm
Contact:

Post by ww »

感謝提供經驗喔! :D
希望大家都可以提供一些Gentoo使用上的心得! ^^
Post Reply