Commit 5f27ca20 authored by Alexandre Julliard's avatar Alexandre Julliard

Added options to update an existing WINEPREFIX directory and to run

from inside a Wine source tree.
parent 0a19a07e
...@@ -21,30 +21,83 @@ ...@@ -21,30 +21,83 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# #
dlldir=@dlldir@ usage()
datadir=@datadir@ {
echo "Usage: $0 [options]"
echo ""
echo "Options:"
echo " --help Display this message"
echo " --prefix <dir> Prefix directory to create (defaults to \$WINEPREFIX or ~/.wine)"
echo " --update Update the prefix directory if it already exists"
echo " --use-wine-tree <dir> Run from the Wine source tree <dir>"
echo ""
}
set -e
dlldir="@dlldir@"
datadir="@datadir@/wine"
do_update=0
while [ $# -gt 0 ]
do
case "$1" in
--help)
usage
exit 0
;;
--prefix)
WINEPREFIX="$2"
shift 2
;;
--update)
do_update=1
shift
;;
--use-wine-tree)
topdir=`cd "$2" && pwd`
if [ -x "$topdir/server/wineserver" ]
then
WINELOADER="$topdir/wine"
dlldir="$topdir/programs"
datadir="$topdir/tools"
else
echo "$2 is not a valid Wine source tree"
exit 1
fi
shift 2
;;
*)
usage
exit 1
;;
esac
done
WINEPREFIX="${1:-$WINEPREFIX}"
WINEPREFIX="${WINEPREFIX:-$HOME/.wine}" WINEPREFIX="${WINEPREFIX:-$HOME/.wine}"
if [ -d "$WINEPREFIX" ] if [ -d "$WINEPREFIX" ]
then then
echo "The $WINEPREFIX directory already exists, aborting" if [ $do_update = 0 ]
exit 1 then
fi echo "The $WINEPREFIX directory already exists, aborting"
exit 1
if mkdir "$WINEPREFIX"; then : fi
else else
echo "Could not create $WINEPREFIX, aborting" if mkdir "$WINEPREFIX"; then :
exit 1 else
echo "Could not create $WINEPREFIX, aborting"
exit 1
fi
fi fi
WINEPREFIX=`cd "$WINEPREFIX" && pwd`
CROOT="$WINEPREFIX/drive_c" CROOT="$WINEPREFIX/drive_c"
# Create the directory tree # Create the directory tree
for i in \ for i in \
"$WINEPREFIX/dosdevices" \
"$CROOT" \ "$CROOT" \
"$CROOT/windows" \ "$CROOT/windows" \
"$CROOT/windows/command" \ "$CROOT/windows/command" \
...@@ -60,19 +113,23 @@ for i in \ ...@@ -60,19 +113,23 @@ for i in \
"$CROOT/windows/system" \ "$CROOT/windows/system" \
"$CROOT/windows/temp" "$CROOT/windows/temp"
do do
mkdir "$i" [ -d "$i" ] || mkdir "$i"
done done
# Create the drive symlinks # Create the drive symlinks
ln -s "../drive_c" "$WINEPREFIX/dosdevices/c:" if [ ! -d "$WINEPREFIX/dosdevices" ]
ln -s "/" "$WINEPREFIX/dosdevices/z:" then
mkdir "$WINEPREFIX/dosdevices"
ln -s "../drive_c" "$WINEPREFIX/dosdevices/c:"
ln -s "/" "$WINEPREFIX/dosdevices/z:"
fi
# Create the application symlinks # Create the application symlinks
link_app() link_app()
{ {
ln -s "$dlldir/$1.exe.so" "$2" || echo "Warning: failed to create $2" rm -f "$2" && ln -s "$dlldir/$1.exe.so" "$2" || echo "Warning: failed to create $2"
} }
link_app start "$CROOT/windows/command/start.exe" link_app start "$CROOT/windows/command/start.exe"
...@@ -94,12 +151,16 @@ link_app winebrowser "$CROOT/windows/winebrowser.exe" ...@@ -94,12 +151,16 @@ link_app winebrowser "$CROOT/windows/winebrowser.exe"
# Copy the .inf script and run it # Copy the .inf script and run it
cp "$datadir/wine/wine.inf" "$CROOT/windows/inf/wine.inf" cp "$datadir/wine.inf" "$CROOT/windows/inf/wine.inf"
export WINEPREFIX export WINEPREFIX
${WINELOADER:-wine} rundll32.exe setupapi.dll,InstallHinfSection DefaultInstall 128 wine.inf ${WINELOADER:-wine} rundll32.exe setupapi.dll,InstallHinfSection DefaultInstall 128 wine.inf
# Wait for the wineserver to finish # Wait for the wineserver to finish
${WINESERVER:-wineserver} -w if [ $do_update = 0 ]
then
echo "$WINEPREFIX created successfully." ${WINESERVER:-wineserver} -w
echo "$WINEPREFIX created successfully."
else
echo "$WINEPREFIX updated successfully."
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment