comctl32: Add basic custom draw support for tooltips.
[wine/multimedia.git] / tools / wineprefixcreate.in
blobd91a3f6995158ac1544dca6217e3cf27ca43f711
1 #!/bin/sh
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 usage()
26 echo "Usage: $0 [options]"
27 echo ""
28 echo "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"
33 echo ""
36 set -e
38 bindir=""
39 case "$0" in
40 */*)
41 # $0 contains a path, use it
42 bindir=`dirname "$0"`
45 # no directory in $0, search in PATH
46 saved_ifs=$IFS
47 IFS=:
48 for d in $PATH
50 IFS=$saved_ifs
51 if [ -x "$d/$0" ]
52 then
53 bindir="$d"
54 break
56 done
58 esac
60 bindir=`cd "$bindir" && pwd`
61 dlldir="$bindir/@bintodlldir@"
62 datadir="$bindir/@bintodatadir@"
64 do_wait=0
65 quiet=0
67 if [ ! -f "$dlldir/ntdll.dll.so" -a \
68 -x "$bindir/../server/wineserver" -a \
69 -f "$bindir/../dlls/ntdll/ntdll.dll.so" ]
70 then
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" ]
76 then
77 LD_LIBRARY_PATH="$topdir/libs/wine:$LD_LIBRARY_PATH"
78 else
79 LD_LIBRARY_PATH="$topdir/libs/wine"
81 export LD_LIBRARY_PATH
83 # find the source directory
84 link=`readlink "$WINELOADER"`
85 if [ -z "$link" ]
86 then
87 topsrcdir="$topdir"
88 else
89 link=`dirname "$link"`
90 case "$link" in
91 /*) topsrcdir=`cd "$link/.." && pwd` ;;
92 *) topsrcdir=`cd "$topdir/$link/.." && pwd` ;;
93 esac
95 dlldir="$topdir/programs"
96 datadir="$topsrcdir/tools"
99 while [ $# -gt 0 ]
101 case "$1" in
102 -h|--help)
103 usage
104 exit 0
106 --prefix)
107 WINEPREFIX="$2"
108 shift 2
110 -q|--quiet)
111 quiet=1
112 shift
114 -w|--wait)
115 do_wait=1
116 shift
118 --use-wine-tree)
119 # ignored, autodetected now
120 shift 2
123 echo "Unknown option $1"
124 usage
125 exit 1
127 esac
128 done
130 WINEPREFIX="${WINEPREFIX:-$HOME/.wine}"
132 if [ -d "$WINEPREFIX" ] || mkdir "$WINEPREFIX"; then :
133 else
134 echo "Could not create $WINEPREFIX, aborting"
135 exit 1
138 WINEPREFIX=`cd "$WINEPREFIX" && pwd`
140 # Create the drive symlinks
142 if [ ! -d "$WINEPREFIX/dosdevices" ]
143 then
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
154 for i in \
155 "$CROOT/windows" \
156 "$CROOT/windows/command" \
157 "$CROOT/windows/fonts" \
158 "$CROOT/windows/inf" \
159 "$CROOT/windows/system" \
160 "$CROOT/windows/system32" \
161 "$CROOT/windows/system32/spool" \
162 "$CROOT/windows/system32/spool/drivers" \
163 "$CROOT/windows/system32/spool/drivers/color" \
164 "$CROOT/windows/temp"
166 [ -d "$i" ] || mkdir "$i"
167 done
169 # Copy the .inf script and run it
171 cp "$datadir/wine.inf" "$CROOT/windows/inf/wine.inf"
172 export WINEPREFIX
173 "${WINELOADER:-$bindir/wine}" rundll32.exe setupapi.dll,InstallHinfSection DefaultInstall 128 wine.inf
175 # Wait for the wineserver to finish
177 if [ $do_wait = 1 ]
178 then
179 "${WINESERVER:-$bindir/wineserver}" -w
182 if [ $quiet = 0 ]
183 then
184 echo "$WINEPREFIX updated successfully."