Re: Script to run Wine and save log

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 25, 2009 at 00:10, Austin English<austinenglish@xxxxxxxxx> wrote:
>
> Personally, I'd just do:
> if [ -x `which compiz` ]
> then
>    echo "You've got comipz installed. This is bad, and conflicts with
> Wine. Remove it."
> fi

The problem is that compiz might be installed and not running, or that
a recent kwin / metacity / <insert name of xfce4 windows manager here>
with compositing enabled might be used.

See: http://en.wikipedia.org/wiki/Compositing_window_manager#List_of_compositing_window_managers
for a list

The only really effective method would be a way to query the current
Windows manager to see if it supports compositing. If anyone know of a
scriptable way to do this please let me know.

> What's wrong with $USER? What exactly do you need this for, anyway?

I don't trust environment variables that can be set by the user. (I
know that $USER is not always defined, based on a script (bash of a
.bashrc on Solaris rather) I have that sets the terminal title to
$USER@`hostname` - ip (It works fine 90% of the time, but break with
certain methods of changing user ('su -' IIRC)))

Mainly to see whether the user is running as root.
>
>> I thought the group info might be useful for troubleshooting...
>
> Not particularly. The only time that I can think of is for distro's
> that make the video/audio devices owned by a video/audio group, and
> don't automatically add regular users to that group.
>
True. And that would be detectable by "Does your audio work in other
program? / Does glxgears run?"

Anyone with suggestion for detecting a running pulseaudio / esd? (ps
is not a nice option due to some versions accepting only BSD / Sys-V
style arguments)

A new version is attached, mainly adding some graphics card info,
fixing $WINE behaviour. Uploaded to http://www.mohag.net/wine_with_log

Gert

New version:
#!/bin/sh
# wine_with_log: Script for running wine while showing and logging output
# Gert van den Berg, June 2009
# This script is released into the public domain
#
# The script prefers a wine specified in WINE, wine-git in the home directory
# with the system's default wine version being tried if the other versions
# can not be found

logpath="$HOME/wine-logs"

# try WINE env var
if [ -x "`which \"$WINE\"`" ] > /dev/null # suppress printing of path
then
	wine="`which \"$WINE\"`"
# try wine-git in $HOME
elif [ -x "$HOME/wine-git/wine" ]
then
	wine="$HOME/wine-git/wine"
# Try default Wine
else
	wine="`which wine`"
fi

# Get Wine version number and check for wine's existance
if ! winever="`\"$wine\" --version`" 2> /dev/null; then
	echo "Fatal error: Cannot run wine with command '$wine'!" 1>&2
	exit 1
fi

# We don't export WINPREFIX, in case the dault change, but assume a
default of ~/.wine
WINEPREFIX="${WINEPREFIX:-$HOME/.wine}"
date="`date +%Y%m%d-%H:%M:%S`"

if [ -d "$WINEPREFIX" ]
then
	wineprefixstatus="Pre-existing"
else
	wineprefixstatus="Clean"
fi

if ! ( [ -d "$logpath" ] || mkdir "$logpath" 2> /dev/null )
then
	echo "Fatal Error: Cannot create / find log path '$logpath'" 1>&2
	exit 2
fi

BasicInfo="----------------------------------------------------------
Wine version: $winever
WINEPREFIX: '$WINEPREFIX'
WINEPREFIX state: $wineprefixstatus
Working directory: '`pwd`'
Date: `date`
OS info (uname -a): '`uname -a`'
Current user: `id -un`"

# Quote wine parameters
WineParams=""
for param in "$@"
do
	WineParams="$WineParams '$param'"
done

WineCmdInfo="----------------------------------------------------------
Command: \"$wine$WineParams\"
----------------------------------------------------------"

logname="$logpath/$1.$date.$winever.log"

(
	echo "$BasicInfo"
	# Commands with potential multi-line output
	if [ -x "`which glxinfo`" ] # Run only if glxinfo is in the path
	then
		echo '---------'
		echo "Glxinfo strings matching '^OpenGL.*string|^direct rendering:':'"
		"`which glxinfo`" |egrep '^OpenGL.*string|^direct rendering:'
	fi
	echo "$WineCmdInfo"
	"$wine" "$@" 2>&1
	echo "----------------------------------------------------------"
) |tee  "$logname"

################################ End

Sample output:
mohag@mohagpc:~/bin$ WINE=wine wine_with_log winecfg
----------------------------------------------------------
Wine version: wine-1.1.24
WINEPREFIX: '/home/mohag/.wine'
WINEPREFIX state: Pre-existing
Working directory: '/home/mohag/bin'
Date: Sat Jun 27 10:45:56 SAST 2009
OS info (uname -a): 'Linux mohagpc 2.6.28-13-generic #44-Ubuntu SMP
Tue Jun 2 07:55:09 UTC 2009 x86_64 GNU/Linux'
Current user: mohag
---------
Glxinfo strings starting with 'OpenGL.*string'; 'direct rendering:'
direct rendering: Yes
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GTS 250/PCI/SSE2
OpenGL version string: 3.0.0 NVIDIA 180.44
OpenGL shading language version string: 1.30 NVIDIA via Cg compiler
----------------------------------------------------------
Command: "/usr/bin/wine 'winecfg'"
----------------------------------------------------------
fixme:mixer:ALSA_MixerInit No master control found on USB Device
0x46d:0x89d, disabling mixer
----------------------------------------------------------



[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux