Gentoo conf failide uuendamine lihtsamaks

Allikas: Pingviini viki

Enamus Gentoo kasutajaid on kindlasti kokku puutunud erinevate conf failide uuendamistega. Seda eriti peale süsteemi uuendamist. Käesolev õpetus pole etc-update-i ja dispatch-conf-i õpetus vaid õpetus, kuidas muuta need programmid endale meelepärasemaks ja lihtsamaks. Et kontroll käiks lihtsamini.

dispatch-confi seadistamine

dispatch-conf on alternatiiv etc-update-ile. Tema tööpõhimõte on sama, mis etc-update-gi. Süsteem kontrollib üle conf failid, vastavalt eelnevalt pandud seadistustele vahetab juba mõned ära või näitab failide erinevust ja ootab kasutaja reageeringut.

Esiteks võtame lahti /etc/dispatch-conf.conf faili:

nano /etc/dispatch-conf.conf

See peaks välja nägema Teil selline:

# 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
# %s old file
# %s new file
diff="diff -Nu %s %s"

# 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

Nüüd muudame seal mõned read: Kõigepealt vaadake, et use-rcs=yes oleks ka Teil yes. Sellega arhiveeritakse Teil kõik vanad conf failid.

Nüüd võtame ette rea diff. Muudame selle:

diff="colordiff -u %s %s | less"

Ehk lõpuks peaks Teil conf fail välja nägema järgmiselt:

# 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
# %s old file
# %s new file
diff="colordiff -u %s %s | less"

# 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 

salvestage tulemus.

Nüüd loome backup kataloogi ja paigaldame veel vajamineva tarkvara:

mkdir /etc/config-archive
emerge -av colordiff rcs

Nüüd võite käivitada dispatch-confi

dispatch-conf

Nüüd peaksid kõik Teie uuendamist vajavad conf failid Teile ette ilmuma värvilisena (punane ja - on vanadest failidest, mis ära võetakse ja sinise ja + on need, mis lisatakse) ja kõik vanad failid arhiveeritakse.

etc-update seadistamine

etc-update on Gentoos configuratsiooni failide uendamiseks nagu dispatch-conf. Tema conf fail asub /etc/etc-update.conf. Seega võtame tema ette:

nano /etc/etc-update.conf 

See peaks Teil välja nägema:

# mode - 0 for text, 1 for menu (support incomplete)
# note that you need dev-util/dialog installed
mode="0"

# Whether trivial/comment changes should be automerged
eu_automerge="yes"

# arguments used whenever rm is called
rm_opts="-i"

# arguments used whenever mv is called
mv_opts="-i"

# arguments used whenever cp is called
cp_opts="-i"

# pager for use with diff commands (see NOTE_2)
pager="less"
#pager=""

# vim-users: you CAN use vimdiff for diff_command. (see NOTE_1)
diff_command="diff -uN %file1 %file2"
using_editor=0
#diff_command="vim -d %file1 %file2"
#using_editor=1


# vim-users: don't use vimdiff for merging (see NOTE_1)
merge_command="sdiff -s -o %merged %orig %new"

# EXPLANATION
#
# pager:
#
# Examples of pager usage:
#       pager=""                # don't use a pager
#       pager="less -E" # less
#       pager="more"    # more
#
#
# diff_command:
#
# Arguments:
#       %file1  [REQUIRED]
#       %file2  [REQUIRED]
#
# Examples of diff_command:
#       diff_command="diff -uN %file1 %file2"   # diff
#       diff_command="vim -d %file1 %file2"             # vimdiff
#
#
# merge_command:
#
# Arguments:
#       %orig   [REQUIRED]
#   %new    [REQUIRED]
#       %merged [REQUIRED]
#
# Examples of merge_command:
#       merge_command="sdiff -s -o %merged %old %new"   # sdiff
#

# NOTE_1: Editors such as vim/vimdiff are not usable for the merge_command
# because it is not known what filenames the produced files have (the user can
# choose while using those programs)

# NOTE_2: Make sure pager is set to "" when using an editor as diff_command! 

Kontrollige, et eu_automerge="yes" oleks yes. Sellega vahetatakse automaatselt need conf failid, mis erinevad ainult päise poolest. Nüüd muudke diff_command=... rida järgnevaks:

diff_command="colordiff -u %file1 %file2"

Seega peaks Teil kogu fail välja nägema selline:

# mode - 0 for text, 1 for menu (support incomplete)
# note that you need dev-util/dialog installed
mode="0"

# Whether trivial/comment changes should be automerged
eu_automerge="yes"

# arguments used whenever rm is called
rm_opts="-i"

# arguments used whenever mv is called
mv_opts="-i"

# arguments used whenever cp is called
cp_opts="-i"

# pager for use with diff commands (see NOTE_2)
pager="less"
#pager=""

# vim-users: you CAN use vimdiff for diff_command. (see NOTE_1)
diff_command="colordiff -u %file1 %file2"
using_editor=0
#diff_command="vim -d %file1 %file2"
#using_editor=1


# vim-users: don't use vimdiff for merging (see NOTE_1)
merge_command="sdiff -s -o %merged %orig %new"

# EXPLANATION
siit tulevad edasi juba faili seletused

Nüüd paigaldame veel colordiffi:

emerge -av colordiff

ja võitegi käsureale kirjutada:

etc-update


Autor: Spott