3 # Script to create the initial WINEPREFIX directory
5 # Copyright 1999 Ove Kåven
6 # Copyright 2004 Chris Morgan
7 # Copyright 2004 Alexandre Julliard
9 # This library is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public
11 # License as published by the Free Software Foundation; either
12 # version 2.1 of the License, or (at your option) any later version.
14 # This library is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # Lesser General Public License for more details.
19 # You should have received a copy of the GNU Lesser General Public
20 # License along with this library; if not, write to the Free Software
21 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 echo "Usage: $0 [options]"
29 echo " -h, --help Display this message"
30 echo " --prefix <dir> Directory to create (default: \$WINEPREFIX or ~/.wine)"
31 echo " -q, --quiet Don't print status messages"
32 echo " -w, --wait Wait for the wineserver to exit before returning"
41 # $0 contains a path, use it
45 # no directory in $0, search in PATH
60 bindir=`cd "$bindir" && pwd`
61 dlldir="$bindir/@bintodlldir@"
62 datadir="$bindir/@bintodatadir@"
67 if [ ! -f "$dlldir/ntdll.dll.so" -a \
68 -x "$bindir/../server/wineserver" -a \
69 -f "$bindir/../dlls/ntdll/ntdll.dll.so" ]
71 # running from the wine source tree
72 topdir=`cd "$bindir/.." && pwd`
73 WINELOADER="$topdir/wine"
74 WINESERVER="$topdir/server/wineserver"
75 if [ -n "$LD_LIBRARY_PATH" ]
77 LD_LIBRARY_PATH="$topdir/libs:$LD_LIBRARY_PATH"
79 LD_LIBRARY_PATH="$topdir/libs"
81 export LD_LIBRARY_PATH
83 # find the source directory
84 link=`readlink "$WINELOADER"`
89 link=`dirname "$link"`
91 /*) topsrcdir=`cd "$link/.." && pwd` ;;
92 *) topsrcdir=`cd "$topdir/$link/.." && pwd` ;;
95 dlldir="$topdir/programs"
96 datadir="$topsrcdir/tools"
119 # ignored, autodetected now
123 echo "Unknown option $1"
130 WINEPREFIX="${WINEPREFIX:-$HOME/.wine}"
132 if [ -d "$WINEPREFIX" ] || mkdir "$WINEPREFIX"; then :
134 echo "Could not create $WINEPREFIX, aborting"
138 WINEPREFIX=`cd "$WINEPREFIX" && pwd`
140 # Create the drive symlinks
142 if [ ! -d "$WINEPREFIX/dosdevices" ]
144 mkdir "$WINEPREFIX/dosdevices"
145 [ -d "$WINEPREFIX/drive_c" ] || mkdir "$WINEPREFIX/drive_c"
146 ln -s "../drive_c" "$WINEPREFIX/dosdevices/c:"
147 ln -s "/" "$WINEPREFIX/dosdevices/z:"
150 CROOT="$WINEPREFIX/dosdevices/c:"
152 # Create the directory tree
156 "$CROOT/windows/command" \
157 "$CROOT/windows/fonts" \
158 "$CROOT/windows/inf" \
159 "$CROOT/windows/system" \
160 "$CROOT/windows/system32" \
161 "$CROOT/windows/system32/drivers" \
162 "$CROOT/windows/temp"
164 [ -d "$i" ] || mkdir "$i"
167 # Copy the .inf script and run it
169 cp "$datadir/wine.inf" "$CROOT/windows/inf/wine.inf"
171 "${WINELOADER:-wine}" rundll32.exe setupapi.dll,InstallHinfSection DefaultInstall 128 wine.inf
173 # Wait for the wineserver to finish
177 "${WINESERVER:-wineserver}" -w
182 echo "$WINEPREFIX updated successfully."