Saturday, May 23, 2009

Managing wine bottles

Wine has a nice feature that lets you keep your virtual Windows installations in separate directories, commonly known as wine prefixes. If you install a lot of software or even just a few games, you'll soon discover that some wine settings or tweaks may work for one program but break the other. While some settings may be set on per-executable basis (via winecfg), there are more which have global impact (e.g. virtual desktop resolution settings, registry tweaks etc.). Wine prefixes provide a comfortable way for keeping software installed in isolated environments which are easy to backup or remove. A common use scenario looks like this:

$ WINEPREFIX=/my/windows/software/foo wine setup.exe
$ WINEPREFIX=/my/windows/software/foo regedit

But this is not very convenient. There are some helper utilities that let you create and maintain wine bottles and provide some additonal functionality for better wine experience - examples are: PlayOnLinux, Wine-Doors and q4wine. You may also create your own wrapper scripts for this purpose - or use the ones I've created for myself. The script is loosely based on a script published by, but adds some more features. It creates wine bottles in ~/Wine directory by default. Sample usage:

Installing game in a new bottle (MyGame):
$ wine-bottle MyGame /media/cdrom/setup.exe

Running winecfg, regedit and wineboot for specific bottle:
$ winecfg-bottle MyGame
$ regedit-bottle MyGame
$ wineboot-bottle MyGame

Running the game in the bottle:
$ cd ~/Wine/MyGame/drive_c/mygame
$ wine-bottle MyGame game.exe

Creating a shell script for quick startup:
$ cd ~/Wine/MyGame/drive_c/mygame
$ bottle-makescript ~/ MyGame game.exe

bottle-makescript will create a shell script that runs the specific executable in given bottle with no need to resort to command-line anymore.

Any ideas for improvements are welcome. Enjoy.

No comments: