How To: Comfortably Make your own WINE Bottles

Diposkan oleh Unknown on Saturday, March 21, 2009

If you're installing a few programs in WINE, you may notice that they tend to influence each other negatively. The fix is to install them in completely different operating system environments, also known as WINE bottles. This way it's easy to completely remove applications by just deleting their "bottle". Let me show you how to make this effortless with standard WINE and a simple shell script.

The script is the key part. You tell it a directory where you want your bottles installed and then it will create a new folder each time you install a program. Of course you may also install several programs into one bottle. Let's call the script wine-bottle, which I suggest to put into your $PATH:

!/bin/bash
# wine-bottle v. 0.2
# (c) 2009 Linux-Tipps.blogspot.com, (c) 2009 Joost @ http://home.student.utwente.nl/j.vanderhof
# newest version at http://linux-tipps.blogspot.com/2009/03/how-to-make-your-own-wine-bottles.html
# published under the GPL v. 3.0 http://gplv3.fsf.org/
INSTALLDIR="$HOME/.wine/bottles"; #Set this to where you want to put your Wine bottles
[ $# -lt 1 ] && #if you gave no parameters
echo "Please give me parameters! Usage:" &&
echo "Execute a program : $0 \"BottleName\" \"Program\"" &&
echo "Configure a bottle : $0 --conf \"BottleName\"" &&
echo "List bottles : $0 --list" &&
exit 1;
[ $# -lt 2 -a $1 != "--list" ] && #if you didn't give the right parameters
echo "Please give me at least two parameters or a --list parameter! Usage:" &&
echo "Execute a program : $0 \"BottleName\" \"Program\"" &&
echo "Configure a bottle : $0 --conf \"BottleName\"" &&
echo "List bottles : $0 --list" &&
exit 1;
[ $1 == "--list" ] && #if you want to list the bottles
echo "Wine bottles in $INSTALLDIR:" &&
ls -1 $INSTALLDIR &&
exit 1;
[ -d "$INSTALLDIR" ] || ( #if installdir is not existing
echo "Root of Wine bottles not existing: $INSTALLDIR" &&
mkdir "$INSTALLDIR"
) || ( #if installdir creation failed
echo "Could not create installation Directory: \"$INSTALLDIR\"." &&
exit 1);
which wine || ( #if wine is not found
echo "Wine not found, please install it first" &&
exit 1);
[ $1 == "--conf" ] && #if you wish to configure a bottle
WINEPREFIX="$INSTALLDIR/$2/" winecfg &&
exit 1;
#finally, the only remaining possibility is you want to run an application
PREF="$1";
shift; #drop first parameter to leave the command with its parameters
WINEPREFIX="$INSTALLDIR/$PREF/" wine "${@}";

You can now use this script almost like wine. The only difference is that you first need to tell it the bottle's name. E.g. wine-bottle lingopad setup.exe installs the program inside setup.exe into the bottle lingopad. I suggest using the "create Desktop short cut" option of installers, as it lets you easily start them later, without the need to use this script.

If you want to create a backup of your bottle, simpy put the bottle directory inside $INSTALLDIR together with the related .desktop file into an archive. If you want to manually start a program, you can of course still use wine-bottle from the shell: e.g. wine-bottle lingopad "$HOME/Wine/lingopad/drive_c/Program Files/Lingopad/Lingopad.exe".

You may also want to install a current wine via the wine ubuntu repository.

Let me know if you liked this howto!

Update: Updated to Joost's version, thanks!

Update2: It seems my script has inspired "Joost". He's created a version including a simple GUI. Check out his website.

{ 0 komentar... read them below or add one }

Post a Comment

Come on share your comment, but please do not spam