Added a winelauncher shell script which makes the process of running

Wine a little nicer for an end user.  The intent of winelauncher is to
be used inside of a distribution package.
This commit is contained in:
Jeremy White 2000-11-05 20:06:56 +00:00 committed by Alexandre Julliard
parent 755bb92e15
commit f9f030b87a
6 changed files with 193 additions and 2 deletions

View File

@ -134,7 +134,7 @@ clean::
$(RM) wine
distclean: clean
$(RM) config.* TAGS Make.rules dlls/Makedll.rules include/config.h documentation/wine.man documentation/wine.conf.man
$(RM) config.* TAGS Make.rules dlls/Makedll.rules include/config.h documentation/wine.man documentation/wine.conf.man tools/winelauncher
$(RM) `find . \( -name Makefile -o -size 0 \) -print`
# We depend on configure above for checks, so we better don't use this rule.

2
configure vendored
View File

@ -6582,6 +6582,7 @@ server/Makefile
tools/Makefile
tools/cvdump/Makefile
tools/winebuild/Makefile
tools/winelauncher
tools/wmc/Makefile
tools/wrc/Makefile
tsx11/Makefile
@ -6815,6 +6816,7 @@ server/Makefile
tools/Makefile
tools/cvdump/Makefile
tools/winebuild/Makefile
tools/winelauncher
tools/wmc/Makefile
tools/wrc/Makefile
tsx11/Makefile

View File

@ -1152,6 +1152,7 @@ server/Makefile
tools/Makefile
tools/cvdump/Makefile
tools/winebuild/Makefile
tools/winelauncher
tools/wmc/Makefile
tools/wrc/Makefile
tsx11/Makefile

View File

@ -2,3 +2,4 @@ Makefile
bin2res
fnt2bdf
makedep
winelauncher

View File

@ -42,10 +42,11 @@ bin2res: bin2res.o
install:: $(PROGRAMS) $(INSTALLSUBDIRS:%=%/__install__)
[ -d $(bindir) ] || $(MKDIR) $(bindir)
$(INSTALL_PROGRAM) fnt2bdf $(bindir)/fnt2bdf
$(INSTALL_PROGRAM) winelauncher $(bindir)/winelauncher
$(INSTALL_PROGRAM) $(SRCDIR)/winemaker $(bindir)/winemaker
$(INSTALL_PROGRAM) $(SRCDIR)/wineshelllink $(bindir)/wineshelllink
uninstall:: $(INSTALLSUBDIRS:%=%/__uninstall__)
$(RM) $(bindir)/fnt2bdf $(bindir)/winemaker $(bindir)/wineshelllink
$(RM) $(bindir)/fnt2bdf $(bindir)/winelauncher $(bindir)/winemaker $(bindir)/wineshelllink
### Dependencies:

186
tools/winelauncher.in Executable file
View File

@ -0,0 +1,186 @@
#!/bin/sh
#------------------------------------------------------------------------------
# Winelauncher
# This shell script attempts to intelligently manage the process
# of launching a program with Wine. It adds some level of
# visual feedback to an end user.
#
# Usage:
# winelauncher [options] "<windows program> [program arguments]"
#
# This script is meant to be installed to /usr/bin/wine, and
# to be used to invoke a Windows executable.
# The options are passed through directly to Wine, and are
# documented in the Wine man page.
#
# Copyright (c) 2000 by Jeremy White for CodeWeavers
#
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Primary configuration area - change this if you installed Wine to
# a location other than @prefix@
#------------------------------------------------------------------------------
prefix=@prefix@
#------------------------------------------------------------------------------
# Secondary configuration area; change these at your own risk.
#------------------------------------------------------------------------------
exec_prefix=@exec_prefix@
WINEBIN=@bindir@
WINELIB=@libdir@
export LD_LIBRARY_PATH=$WINELIB:$LD_LIBRARY_PATH
export PATH=$WINEBIN:$PATH
info_flag=~/.wine/.no_prelaunch_window_flag
debug_flag=~/.wine/.no_debug_window_flag
debug_options="-debugmsg warn+all"
if [ -f $info_flag ] ; then
use_info_message=0
else
use_info_message=1
fi
if [ -f $debug_flag ] ; then
use_debug_message=0
else
use_debug_message=1
fi
#------------------------------------------------------------------------------
# Optionally Warn the user we're going to be launching Wine...
#------------------------------------------------------------------------------
if [ $use_info_message -ne 0 ] ; then
echo "Invoking $WINEBIN/wine $* ..."
xmessage -timeout 10 -buttons Dismiss:0,"Never display this message again":3 \
"Invoking $WINEBIN/wine $* ..." &
info_message_pid=$!
fi
#------------------------------------------------------------------------------
# Generate a temporary log file name
#------------------------------------------------------------------------------
use_log_name=0
log_name=`mktemp /tmp/wine.log.XXXXXX`
if [ $? -eq 0 ] ; then
which tail >/dev/null 2>&1
if [ $? -eq 0 ]; then
use_log_name=1
fi
fi
#------------------------------------------------------------------------------
# Okay, really launch Wine...
#------------------------------------------------------------------------------
if [ $use_log_name -ne 0 ] ; then
#------------------------------------------------------------------------------
# Okay, we bend over backwards to run Wine, get that status,
# but still display its output to the screen.
# The obvious thing to do is to run wine and pipe output to tee,
# but then I can't find a way to get the return code of wine;
# I only get the return code of Wine.
#------------------------------------------------------------------------------
$WINEBIN/wine $* >$log_name 2>&1 &
wine_pid=$!
tail -f $log_name &
tail_pid=$!
wait $wine_pid
wine_return=$?
kill $tail_pid
else
$WINEBIN/wine $*
wine_return=$?
fi
#------------------------------------------------------------------------------
# Clean up the info message
#------------------------------------------------------------------------------
if [ $use_info_message -ne 0 ] ; then
#------------------------------------------------------------------------------
# Okay, make sure that the notice window is dead (and kill it if it ain't)
#------------------------------------------------------------------------------
ps $info_message_pid >/dev/null 2>&1
if [ $? -ne 0 ] ; then
wait $info_message_pid
info_return=$?
else
info_return=0
kill $info_message_pid
fi
#------------------------------------------------------------------------------
# If they didn't like the warning window, turn it off
#------------------------------------------------------------------------------
if [ $info_return -eq 3 ] ; then
echo "Disabling Wine prelaunch Window. Remove $info_flag to enable"
touch $info_flag
fi
fi
#------------------------------------------------------------------------------
# Test the return code, and see if it fails
#------------------------------------------------------------------------------
if [ $wine_return -eq 0 ] ; then
echo "Wine exited with a successful status"
if [ $use_log_name -ne 0 ] ; then
rm -f $log_name
fi
else
echo "Wine failed with return code $wine_return"
#------------------------------------------------------------------------------
# Gracefully display a debug message if they like...
#------------------------------------------------------------------------------
while [ $use_debug_message -gt 0 ] ; do
#------------------------------------------------------------------------------
# If they didn't like the warning window, turn it off
#------------------------------------------------------------------------------
if [ $use_log_name -ne 0 ] ; then
echo "Error log stored in $log_name"
xmessage -buttons Ok:0,"View Log ($log_name)":1,"Rerun with debug":2,"Never display this message again":3\
"Wine failed with return code $wine_return"
else
xmessage -buttons Ok:0,"Rerun with debug":2,"Never display this message again":3\
"Wine failed with return code $wine_return"
fi
info_return=$?
if [ $info_return -eq 1 ] ; then
xmessage -file $log_name -buttons Ok:0,"Delete $log_name":1
if [ $? -eq 1 ] ; then
echo "Deleting $log_name"
rm -f $log_name
use_log_name=0
fi
else
use_debug_message=0
fi
#------------------------------------------------------------------------------
# If they didn't like the warning window, turn it off
#------------------------------------------------------------------------------
if [ $info_return -eq 3 ] ; then
echo "Disabling Wine debug window. Remove $debug_flag to enable"
touch $debug_flag
fi
#------------------------------------------------------------------------------
# If they want to retry with debug, let 'em.
#------------------------------------------------------------------------------
if [ $info_return -eq 2 ] ; then
echo "Rerunning $0 $debug_options $*"
exec $0 $debug_options $*
fi
done
fi