2004-04-01 07:03:27 +02:00
|
|
|
|
#!/bin/sh
|
|
|
|
|
#
|
|
|
|
|
# Script to create the initial WINEPREFIX directory
|
|
|
|
|
#
|
|
|
|
|
# Copyright 1999 Ove K<>ven
|
|
|
|
|
# Copyright 2004 Chris Morgan
|
|
|
|
|
# Copyright 2004 Alexandre Julliard
|
|
|
|
|
#
|
|
|
|
|
# This library is free software; you can redistribute it and/or
|
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
|
# version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
#
|
|
|
|
|
# This library is distributed in the hope that it will be useful,
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
# Lesser General Public License for more details.
|
|
|
|
|
#
|
|
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
# License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2004-04-01 07:03:27 +02:00
|
|
|
|
#
|
|
|
|
|
|
2004-05-06 00:09:09 +02:00
|
|
|
|
usage()
|
|
|
|
|
{
|
|
|
|
|
echo "Usage: $0 [options]"
|
|
|
|
|
echo ""
|
|
|
|
|
echo "Options:"
|
2004-05-11 06:29:18 +02:00
|
|
|
|
echo " -h, --help Display this message"
|
|
|
|
|
echo " --prefix <dir> Directory to create (default: \$WINEPREFIX or ~/.wine)"
|
|
|
|
|
echo " -q, --quiet Don't print status messages"
|
2005-04-20 15:12:14 +02:00
|
|
|
|
echo " -w, --wait Wait for the wineserver to exit before returning"
|
2004-05-06 00:09:09 +02:00
|
|
|
|
echo ""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
2006-03-11 21:12:11 +01:00
|
|
|
|
bindir=""
|
|
|
|
|
case "$0" in
|
|
|
|
|
*/*)
|
|
|
|
|
# $0 contains a path, use it
|
|
|
|
|
bindir=`dirname "$0"`
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
# no directory in $0, search in PATH
|
|
|
|
|
saved_ifs=$IFS
|
|
|
|
|
IFS=:
|
|
|
|
|
for d in $PATH
|
|
|
|
|
do
|
|
|
|
|
IFS=$saved_ifs
|
|
|
|
|
if [ -x "$d/$0" ]
|
|
|
|
|
then
|
|
|
|
|
bindir="$d"
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
bindir=`cd "$bindir" && pwd`
|
|
|
|
|
dlldir="$bindir/@bintodlldir@"
|
|
|
|
|
datadir="$bindir/@bintodatadir@"
|
2004-05-06 00:09:09 +02:00
|
|
|
|
|
2005-04-20 15:12:14 +02:00
|
|
|
|
do_wait=0
|
2004-05-11 06:29:18 +02:00
|
|
|
|
quiet=0
|
2004-05-06 00:09:09 +02:00
|
|
|
|
|
2006-03-17 12:34:50 +01:00
|
|
|
|
if [ ! -f "$dlldir/ntdll.dll.so" -a \
|
|
|
|
|
-x "$bindir/../server/wineserver" -a \
|
|
|
|
|
-f "$bindir/../dlls/ntdll/ntdll.dll.so" ]
|
|
|
|
|
then
|
|
|
|
|
# running from the wine source tree
|
|
|
|
|
topdir=`cd "$bindir/.." && pwd`
|
|
|
|
|
WINELOADER="$topdir/wine"
|
|
|
|
|
WINESERVER="$topdir/server/wineserver"
|
|
|
|
|
if [ -n "$LD_LIBRARY_PATH" ]
|
|
|
|
|
then
|
2006-10-11 11:21:13 +02:00
|
|
|
|
LD_LIBRARY_PATH="$topdir/libs/wine:$LD_LIBRARY_PATH"
|
2006-03-17 12:34:50 +01:00
|
|
|
|
else
|
2006-10-11 11:21:13 +02:00
|
|
|
|
LD_LIBRARY_PATH="$topdir/libs/wine"
|
2006-03-17 12:34:50 +01:00
|
|
|
|
fi
|
|
|
|
|
export LD_LIBRARY_PATH
|
2008-04-11 20:18:10 +02:00
|
|
|
|
datadir="$topdir/tools"
|
2006-03-17 12:34:50 +01:00
|
|
|
|
fi
|
|
|
|
|
|
2004-05-06 00:09:09 +02:00
|
|
|
|
while [ $# -gt 0 ]
|
|
|
|
|
do
|
|
|
|
|
case "$1" in
|
2004-05-11 06:29:18 +02:00
|
|
|
|
-h|--help)
|
2004-05-06 00:09:09 +02:00
|
|
|
|
usage
|
|
|
|
|
exit 0
|
|
|
|
|
;;
|
|
|
|
|
--prefix)
|
|
|
|
|
WINEPREFIX="$2"
|
|
|
|
|
shift 2
|
|
|
|
|
;;
|
2004-05-11 06:29:18 +02:00
|
|
|
|
-q|--quiet)
|
|
|
|
|
quiet=1
|
|
|
|
|
shift
|
|
|
|
|
;;
|
2005-04-20 15:12:14 +02:00
|
|
|
|
-w|--wait)
|
|
|
|
|
do_wait=1
|
|
|
|
|
shift
|
|
|
|
|
;;
|
2004-05-06 00:09:09 +02:00
|
|
|
|
--use-wine-tree)
|
2006-03-17 12:34:50 +01:00
|
|
|
|
# ignored, autodetected now
|
2004-05-06 00:09:09 +02:00
|
|
|
|
shift 2
|
|
|
|
|
;;
|
|
|
|
|
*)
|
2004-05-11 06:29:18 +02:00
|
|
|
|
echo "Unknown option $1"
|
2004-05-06 00:09:09 +02:00
|
|
|
|
usage
|
|
|
|
|
exit 1
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
done
|
2004-04-01 07:03:27 +02:00
|
|
|
|
|
|
|
|
|
WINEPREFIX="${WINEPREFIX:-$HOME/.wine}"
|
|
|
|
|
|
2004-05-11 06:29:18 +02:00
|
|
|
|
if [ -d "$WINEPREFIX" ] || mkdir "$WINEPREFIX"; then :
|
2004-04-01 07:03:27 +02:00
|
|
|
|
else
|
2004-05-11 06:29:18 +02:00
|
|
|
|
echo "Could not create $WINEPREFIX, aborting"
|
|
|
|
|
exit 1
|
2004-04-01 07:03:27 +02:00
|
|
|
|
fi
|
|
|
|
|
|
2004-05-06 00:09:09 +02:00
|
|
|
|
WINEPREFIX=`cd "$WINEPREFIX" && pwd`
|
2004-05-14 02:43:50 +02:00
|
|
|
|
|
|
|
|
|
# Create the drive symlinks
|
|
|
|
|
|
|
|
|
|
if [ ! -d "$WINEPREFIX/dosdevices" ]
|
|
|
|
|
then
|
|
|
|
|
mkdir "$WINEPREFIX/dosdevices"
|
|
|
|
|
[ -d "$WINEPREFIX/drive_c" ] || mkdir "$WINEPREFIX/drive_c"
|
|
|
|
|
ln -s "../drive_c" "$WINEPREFIX/dosdevices/c:"
|
|
|
|
|
ln -s "/" "$WINEPREFIX/dosdevices/z:"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
CROOT="$WINEPREFIX/dosdevices/c:"
|
2004-04-01 07:03:27 +02:00
|
|
|
|
|
|
|
|
|
# Create the directory tree
|
|
|
|
|
|
|
|
|
|
for i in \
|
|
|
|
|
"$CROOT/windows" \
|
|
|
|
|
"$CROOT/windows/command" \
|
|
|
|
|
"$CROOT/windows/fonts" \
|
|
|
|
|
"$CROOT/windows/inf" \
|
|
|
|
|
"$CROOT/windows/system" \
|
2005-08-15 16:53:35 +02:00
|
|
|
|
"$CROOT/windows/system32" \
|
2007-08-22 21:48:51 +02:00
|
|
|
|
"$CROOT/windows/system32/spool" \
|
|
|
|
|
"$CROOT/windows/system32/spool/drivers" \
|
2008-02-23 22:55:47 +01:00
|
|
|
|
"$CROOT/windows/system32/spool/drivers/color" \
|
2004-04-01 07:03:27 +02:00
|
|
|
|
"$CROOT/windows/temp"
|
|
|
|
|
do
|
2004-05-06 00:09:09 +02:00
|
|
|
|
[ -d "$i" ] || mkdir "$i"
|
2004-04-01 07:03:27 +02:00
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
# Copy the .inf script and run it
|
|
|
|
|
|
2004-05-06 00:09:09 +02:00
|
|
|
|
cp "$datadir/wine.inf" "$CROOT/windows/inf/wine.inf"
|
2004-04-01 07:03:27 +02:00
|
|
|
|
export WINEPREFIX
|
2006-05-25 15:20:59 +02:00
|
|
|
|
"${WINELOADER:-$bindir/wine}" rundll32.exe setupapi.dll,InstallHinfSection DefaultInstall 128 wine.inf
|
2004-04-01 07:03:27 +02:00
|
|
|
|
|
|
|
|
|
# Wait for the wineserver to finish
|
|
|
|
|
|
2005-04-20 15:12:14 +02:00
|
|
|
|
if [ $do_wait = 1 ]
|
2004-05-06 00:09:09 +02:00
|
|
|
|
then
|
2006-05-25 15:20:59 +02:00
|
|
|
|
"${WINESERVER:-$bindir/wineserver}" -w
|
2005-04-20 15:12:14 +02:00
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ $quiet = 0 ]
|
|
|
|
|
then
|
|
|
|
|
echo "$WINEPREFIX updated successfully."
|
2004-05-06 00:09:09 +02:00
|
|
|
|
fi
|