Personalizzare le bottiglie usando i ganci di bottiglia

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.

I ganci di bottiglia possono essere creati a tre livelli:

Each hook is an executable file, usually a shell script, and must be placed in one of the above hook directories. The name of the hook must be of the form nn.name, where nn are two decimal digits that dictate the order in which the hooks are run, and name must not contain any dot or tilde usually indicates the hook's purpose.

I ganci vengono quindi chiamati come descritto nei seguenti eventi:

In all cases the hooks are called in the Wine context. This means they don't need to use the '--bottle' option and that they can count on the following environment variables being set:

CX_ROOT

Contiene il percorso assoluto alla directory in cui CrossOver è installato.

CX_BOTTLE

Contiene il nome della bottiglia corrente.

WINEPREFIX

Contiene il percorso assoluto alla directory della bottiglia.

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

Ecco un esempio di gancio di bottiglia che modifica l'assegnazione della lettera al drive in modo che non ci sia drive Y: e che il drive H: punti alla directory $HOME dell'utente.

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