ボトルフックを使ったボトルのカスタマイズ

Bottle hooks are a mechanism that lets you automatically customize the bottles created by CrossOver. Because it relies on scripts, it is very flexible. For instance it can modify drive letter assignments but also registry settings, the contents of the C: drive, etc. This mechanism is especially useful when you want to customize a bottle which you distribute to a range of machines, or to customize a published bottle for each specific user.

ボトルフックで作成される3つのレベル:

それぞれのフックは所定のディレクトリに置かれるシェルスクリプトとしての実行可能ファイルです。フックの名前は nn.name の形式でなければいけません。nn は2桁の十進数でフックが動作する順番を決定します。name はドットとチルダを含まないフックの目的に沿った名前を付けなければいけません。

フックがコールされるイベントの解説:

全てのケースでフックはWineに関係して呼び出されます。それは以下の環境変数にセットされます:

CX_ROOT

CrossOverがインストールされるディレクトリへの絶対パス。

CX_BOTTLE

現在のボトル名。

WINEPREFIX

ボトルへの絶対パス。

Bottle hooks can also use the wine script to call WineLib or Windows applications to modify registry settings or other aspects of the bottle.

このボトルフックのサンプルはドライブレターがY:にならないように修正しています。そしてユーザーの$HOMEディレクトリをH:にしています。

#!/bin/sh
rm "$WINEPREFIX/dosdevices/y:"
if [ ! -d "$WINEPREFIX/dosdevices/h:" ]
then
    ln -s -f "$HOME" "$WINEPREFIX/dosdevices/h:"
fi