[HOME] [github] [twitter] [blog] [fml4] [fml8] [北海道] Powered by NetBSD and [nuinui.net] .

新しいユーザランドをインストールする (2/2): /etc を入れ換える

Caution

ユーザランドの更新には「install=ディレクトリ」命令を使いますが、 /etc は更新されません。

なお /usr/pkg は OS 本体とは無関係なので、そこは更新されていません (当たり前)。

バイナリの更新が無事に終ったら、いよいよ /etc を更新します。

# etcupdate -s /var/tmp/build-5.1.0_PATCH/release/i386/binary/sets/etc.tgz

ただ、現実問題として、全自動での実行は難しいです。 よって、プログラムが自動判断できない場合、 「古い設定を残す?」 「新しい設定に入れ換える?」 と聞かれまくります。 それに適切に答えます :-) このへんは、 さすがに /etc 以下の設定ファイルが読めないと適切な答が出来ません。

実例を以下に示しますので、参考にしてみて下さい。

処理が始まると、 二つのファイルの diff 出力結果が表示されたあと、

What do you want to do? [Leave it for later]
で etcupdate のコマンド入力を促されます。

m (merge) を選択すると、 % プロンプトになり、どうマージするのか?処理を聞かれます。 画面が | で区切られて、左右に分かれています。 左が「今の設定」、右が「新しい設定」です。

etcupdate のプロンプトで 「今の設定を採用する(今の設定を残す)なら l 」

% l
「新しい設定を採用するなら r 」
% r
を押して下さい。 ちなみに、これは下請けに sdiff コマンドを使っているので、 使い方は sdiff マニュアルを見てください。

マージが終ると、ふたたび

What do you want to do? [Leave it for later]
のプロンプトに戻ります。

なにも考えずに新しい設定で上書きするなら i (インストール) を入れて下さい。

What do you want to do? [Leave it for later] i

etcupdate の処理が終ったら、

# diff -ubr etc.YYYYMMDD etc 
を取り、期待どおりの変更になっているか確認してください。 そして、確信を持ってから再起動してください。

etcupdate の実行例

(自動処理できない)ファイルごとに

(上側には、二つのファイルの diff 出力結果が表示される)

What do you want to do? [Leave it for later] 
と聞かれるので、マージするなら m を入力し、Enter を押します。
例:

-- /etc/group  2011-09-08 04:02:09.000000000 +0900
+++ /tmp/temproot/etc/group     2011-09-08 20:00:13.000000000 +0900
@@ -1,4 +1,4 @@
-wheel:*:0:root,ko-ichis
+wheel:*:0:root
 daemon:*:1:daemon
 kmem:*:2:root
 sys:*:3:root
@@ -27,4 +27,3 @@
 users:*:100:
 dialer:*:117:
 nogroup:*:32766:
-iij:*:2497:
-wide:*:2500:

What do you want to do? [Leave it for later] m

マージがはじまります。

File: /etc/group (modified)

Please select one of the following operations:

  d  Don't install the new file (keep your old file)
  i  Install the new file (overwrites your local modifications!)
  m  Merge the currently installed and new files
  s  Show the differences between the currently installed and new files
  su  Show differences in unified format ("diff -u")
  sc  Show differences in context format ("diff -c")
  ss  Show differences side by side ("sdiff -w80")
  scommand Show differences using the specified diff-like command
  v  Show the new file

What do you want to do? [Leave it for later] m
wheel:*:0:root,ko-ichis                | wheel:*:0:root
%
| で画面が二つに分かれています。 | の左側が現在の設定、右側がインストールしようとしている設定になります。 どちらを取るか?を指示します。 左か右、つまり l (left) か r (right) を指示して下さい。

ここでは、既存の設定を残すので l を入力します。

%l
次も聞かれます。やはり、既存の設定を残すので l を入力します。
iij:*:2497:                            <
wide:*:2500:                           <
%l
以下、このように必要なだけ続き(たいてい、二、三回しか聞かれません)、 全部終ると、最初の画面に戻ります。

File: /etc/group (modified)

Please select one of the following operations:

  d  Don't install the merged file (keep your old file)
  i  Install the merged file (overwrites your old file)
  m  Merge again (your old file against the result from the previous merge)
  s  Show the differences between the currently installed and new merged files
  su  Show differences in unified format ("diff -u")
  sc  Show differences in context format ("diff -c")
  ss  Show differences side by side ("sdiff -w80")
  scommand Show differences using the specified diff-like command
  u  Undo merge (start again with the original version of the new file)
  v  Show the merged file

What do you want to do? [Leave it for later] 

マージした結果、どうなったのか?を見たいなら v (view) を

What do you want to do? [Leave it for later] v
失敗した!やりなおす!という場合は u (undo)を、
What do you want to do? [Leave it for later] u
押し、元に戻してから、ふたたび m (merge) を。

そして、このままインストールしてよいなら i (install) を入力して下さい。

What do you want to do? [Leave it for later] i
ちなみに、 マージした結果を捨てて先に進んでよい (古い設定のまま残す) 場合は d (delete ?)です。

すべてのファイルの処理が終ると、 作業ディレクトリを消してよいか?と聞かれます。

Remove /tmp/temproot? (y/[n]) 
y (yes) を入力すると、最終的な処理が始まります。
Remove /tmp/temproot? (y/[n]) y

   ... 省略 ...

x11 check:
xkb check:
uid check:
varrwho check:
obsolete check:
postinstall checks passed: bluetooth ddbonpanic defaults dhcpcd envsys fontconfig gid hosts iscsi makedev motd mtree named nosa pam periodic pf ssh wscons x11 xkb uid varrwho obsolete
postinstall checks failed: rc
To fix, run:
    /usr/sbin/postinstall -s '/var/tmp/build.i386.netbsd-5.1.0_PATCH/release/i386/binary/sets/etc.tgz' -d / fix rc
Note that this may overwrite local changes.
*** All done
これで終了です。

念のため、 バックアップしておいた etc ディレクトリとの差分を見て、 期待どおりになっているか確認してください。

# diff -ubr etc.YYYYMMDD etc 

確認後は、念のため、リブートしておきましょう。

[HOME] [github] [twitter] [blog] [fml4] [fml8] [北海道] Powered by NetBSD and [nuinui.net] .
Copyright (C) 1993-2022 Ken'ichi Fukamachi mail:< fukachan at fml.org >