Home‎ > ‎Wine‎ > ‎

Installing Mods under Wine

(The following instructions apply to Oblivion as well as Morrowind, or to any situation where you need to install files into an existing location under Wine for that matter, but in many of the examples Morrowind is used for illustration. In Morrowind, you install mods to Morrowind/Data Files, while in Oblivion, you install to Oblivion/Data).

The most important thing to remember about installing a new mod for your game is that the Linux filesystem is case-sensitive and Windows is not. This means that if you use a Linux tool to unpack an archive of a new mod into your data directory, you run the risk of creating pathnames that will shadow each other, and your game will misbehave badly. For example, one archive might contain the directory "Meshes/" and another might contain "meshes/", same directory, but different capitalization. Individual files can shadow each other too, if they only differ by capitalization. So when both of these archives are unpacked in your data directory, you'll end up with both meshes/ and Meshes/ under Data Files, but Windows programs will only be able to access one of them, the other will be shadowed and inaccessible. Fixing this situation by hand is time-consuming and error-prone.

So to avoid problems with case sensitivity do not use Linux commands on files under your Wine directory, only use Windows commands.

Here are 2 basic strategies for adding mods: use Wine's version of the Windows xcopy command to merge new files into your data directory in a case-insensitive fashion, OR use a Windows version of an archiving tool to unpack the archive into your data directory. Since either option uses Windows filesystem functionality, the operations are case-insensitive and you do not run into case problems.


Using xcopy

Since Wine supports the "xcopy" command, you can extract the archive to a temporary directory, then use the command:

wine xcopy source target /s /y

where "source" is the source directory you want to copy from and "target" is the directory you want to copy to. The "/s" means do a recursive copy, and "/y" means assume "yes", instead of asking you if you want to overwrite the destination files. This copy operation will be safe as it is not sensitive to case.


Using a Windows program to unpack archives of your mods

Download any Windows archive extraction program. I use 7-zip (http://www.7-zip.org/), or peazip (http://peazip.sourceforge.net/) which are both freeware, install it as you would any normal Wine program under the same WINEPREFIX as your game: e.g. something like:

wine 7z458.exe

Now you can use your Windows archive tool, NOT any archive unpacking tool that runs natively under Linux, and all case-sensitive issues go away as these tools run under Wine and perform their duties without respect to case sensitivity.

Some tips for how to unpack the archive directly into your data directory:

1) Write a wrapper script for the Windows version of 7-zip:

#!/bin/bash
# run Windows 7z.exe from where it is installed, the following shows the default
wine ${WINEPREFIX:-~/.wine}/drive_c/Program\ Files/7-Zip/7z.exe "$@"

Put that in a file, call it "win7z", make it executable with "chmod +x win7z", put win7z in your $PATH, and now you can run the Windows version of 7-zip from the command line, very easy.

2) Before unpacking, look in the archive first:

win7z l arc.7z

If the mod has some top level directory like "MyMod 1.0/Data Files/Meshes/...", then you have 2 options, use symlinks, or repack the archive, after which you can just unpack directly in the Morrowind/Data Files directory.

To use symlinks in this case, cd to Morrowind/Data Files and type these 2 commands:

ln -s . "MyMod 1.0"
ln -s . "Data Files"

Now if you unpack the archive in Morrowind/Data Files, the files will go in the right place. If that isn't to your liking, then unpack the archive in a temporary directory, cd into its Data Files directory, create a new archive of the files there, and your newly repacked archive will unpack into Morrowind/Data Files flawlessly.

Cleaning up if you have previously used Linux commands on your data directory

If you have used Linux based commands to install files into Morrowind/Data Files, you may very well have introduced problems, as Linux filesystem is case-sensitive while Windows is not. (Thus Meshes/ and meshes/ could both exist under Linux, and this would definitely cause problems. You'll most likely see the big yellow exclamation points in-game where Morrowind can't find the meshes it's looking for). To find out if you have any files that would shadow each other under Windows, use the following shell script:

#!/bin/bash
# Execute this script in the Data Files directory.
echo "checking for directory conflicts in Data ..."
find . -type d | tr A-Z a-z | sort | uniq -c | sort -nr | grep -v '^ *1 '
echo "checking for filename conflicts in Data ..."
find . -type f | tr A-Z a-z | sort | uniq -c | sort -nr | grep -v '^ *1 '
echo "Done"

This will list any files that will conflict due to having more that one instance (e.g. Meshes/ and meshes/), and you can fix each problem by hand.


Email your Comments or Suggestions to: john . moonsugar @ gmail . com