Commit c85f0992 authored by Adam Sacarny's avatar Adam Sacarny Committed by Alexandre Julliard

Much nicer way to select wine's location.

Option to disable creation of debugging output. Debugging output is now created in directory script was started in.
parent ee719954
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
##hunt you down and kill you like the savage animal I am. ##hunt you down and kill you like the savage animal I am.
##Released under the WINE licence ##Released under the WINE licence
##Changelog: ##Changelog:
##April 19, 1999 - Much nicer way to select wine's location
## - Option to disable creation of a debugging output
## - Now places debugging output where it was started
##April 4, 1999 - Sanity check for file locations/wine strippedness ##April 4, 1999 - Sanity check for file locations/wine strippedness
## - Various code cleanups/fixes ## - Various code cleanups/fixes
##March 21, 1999 - Bash 2.0 STDERR workaround (Thanks Ryan Cumming!) ##March 21, 1999 - Bash 2.0 STDERR workaround (Thanks Ryan Cumming!)
...@@ -43,7 +46,7 @@ $var0 = qq{ ...@@ -43,7 +46,7 @@ $var0 = qq{
print do_var($var0); print do_var($var0);
$debuglevel=<STDIN>; $debuglevel=<STDIN>;
chomp $debuglevel; chomp $debuglevel;
until ($debuglevel < 4) { until ($debuglevel == 1 or $debuglevel == 2 or $debuglevel == 3) {
print "Enter a number from 1-3!\n"; print "Enter a number from 1-3!\n";
$debuglevel=<STDIN>; $debuglevel=<STDIN>;
chomp $debuglevel; chomp $debuglevel;
...@@ -56,9 +59,11 @@ if ($debuglevel < 3) { ...@@ -56,9 +59,11 @@ if ($debuglevel < 3) {
thousands of lines). To (hopefully) get the bug fixed, attach the first thousands of lines). To (hopefully) get the bug fixed, attach the first
file to a messsage sent to the comp.emulators.ms-windows.wine newsgroup. file to a messsage sent to the comp.emulators.ms-windows.wine newsgroup.
The developers might ask you for "the last XX number of lines from the The developers might ask you for "the last XX number of lines from the
report". If so, post the second file (It will be compressed with gzip report". If so, run the command:
later, so leave off the .gz). If you feel like it, post both files at the gzip -d (output file)|tail -n (number of lines) > outfile
same time. I don't care. And post outfile.
If you do not want to create one of the files, just type in "no file"
and hit enter.
}; };
print do_var($var1); print do_var($var1);
} elsif ($debuglevel =~ 3) { } elsif ($debuglevel =~ 3) {
...@@ -67,10 +72,12 @@ if ($debuglevel < 3) { ...@@ -67,10 +72,12 @@ if ($debuglevel < 3) {
1. Formatted debug report you might want to post to the newsgroup 1. Formatted debug report you might want to post to the newsgroup
2. File with ALL the debug output (It will later be compressed with 2. File with ALL the debug output (It will later be compressed with
gzip, so leave off the trailing .gz) gzip, so leave off the trailing .gz)
If you do not want to create one of the files, just type in "no file"
and I'll skip it.
}; };
print do_var($var2); print do_var($var2);
} }
print "Enter the filename for this debug report (The first file):\n"; print "Enter the formatted debug output (The first file):\n";
$outfile=<STDIN>; $outfile=<STDIN>;
chomp $outfile; chomp $outfile;
$var23 = qq{ $var23 = qq{
...@@ -81,7 +88,7 @@ while ($outfile =~ /^(\s)*$/) { ...@@ -81,7 +88,7 @@ while ($outfile =~ /^(\s)*$/) {
$outfile=<STDIN>; $outfile=<STDIN>;
chomp $outfile; chomp $outfile;
} }
print "Enter the file for the debug output (The second file):\n"; print "Enter the file for the full debug output (The second file):\n";
$dbgoutfile=<STDIN>; $dbgoutfile=<STDIN>;
chomp $dbgoutfile; chomp $dbgoutfile;
while ($dbgoutfile =~ /^(\s)*$/) { while ($dbgoutfile =~ /^(\s)*$/) {
...@@ -89,43 +96,66 @@ while ($dbgoutfile =~ /^(\s)*$/) { ...@@ -89,43 +96,66 @@ while ($dbgoutfile =~ /^(\s)*$/) {
$dbgoutfile=<STDIN>; $dbgoutfile=<STDIN>;
chomp $dbgoutfile; chomp $dbgoutfile;
} }
if ($debuglevel =~ 1) { print "Looking for wine...\n";
print "Looking for wine...\n"; $whereis=`whereis wine`;
$wineloc=`which wine`; chomp $whereis;
print "Choose one of the following options:\n";
$whereis =~ s/^wine\: //;
@locations = split(/\s/,$whereis);
print "1. Unlisted (I'll prompt you for a new location\n";
print "2. Unsure (I'll use #3, that's probably it)\n";
$i=2;
foreach $location (@locations) {
$i++;
print "$i. $location\n";
}
sub select_wineloc {
print "Enter the number that corresponds to wine's location:";
$wineloc=<STDIN>;
chomp $wineloc; chomp $wineloc;
if ($wineloc =~ "") { $yes = 1 if $wineloc == 1 or $wineloc == 2;
print "Couldn't find wine...\n"; $i=3;
$var3 = qq{ foreach $location (@locations) {
Enter the full path to wine. The path should look like $yes = 1 if $wineloc eq $i++;
/path/to/wine/wine. Get it? It's the directories leading up to the }
wine file, and then the actual wine file (Example: /home/wine/wine): while ($yes ne "1") {
print "Enter the number the corresponds to wine's location:";
$wineloc=<STDIN>;
chomp $wineloc;
$i=1;
foreach $location (@locations) {
$yes = 1 if $wineloc eq $i++;
}
}
if ($wineloc == 1) {
$var25 = qq{
Enter the full path to wine (Example: /usr/bin/wine):
}; };
print do_var($var3); $var26 = qq{
$wineloc=<STDIN>; Please enter the full path to wine. A full path is the
chomp $wineloc; directories leading up to a program's location, and then the
} else { program. For example, if you had the program "wine" in the
print "Found wine: $wineloc\n" directory "/usr/bin", you would type in "/usr/bin/wine". Now
} try:
}
if ($debuglevel > 1) {
if ($debuglevel =~ 2) {
$var4 = qq{
Enter the full path to wine. The path should look like
/path/to/wine/wine. Get it? It's the directories leading up to the
wine file, and then the actual wine file (Example: /home/wine/wine):
}; };
print do_var($var4); print do_var($var25) if $debuglevel == 3;
} elsif ($debuglevel =~ 3) { print do_var($var26) if $debuglevel < 3;
print "Enter the full path to wine (Example: /home/wine/wine):\n"; $wineloc=<STDIN>;
chomp $wineloc;
while ($wineloc =~ /^(\s)*$/) {
print do_var($var23);
$wineloc=<STDIN>;
chomp $wineloc;
}
}
elsif ($wineloc == 2) {
$wineloc=$locations[0];
}
else {
$wineloc=$locations[$wineloc-3];
} }
$wineloc=<STDIN>;
chomp $wineloc;
}
while ($wineloc =~ /^(\s)*$/) {
print do_var($var23);
$wineloc=<STDIN>;
chomp $wineloc;
} }
&select_wineloc;
print "Checking if $wineloc is stripped...\n"; print "Checking if $wineloc is stripped...\n";
$ifstrip = `nm $wineloc 2>&1`; $ifstrip = `nm $wineloc 2>&1`;
while ($ifstrip =~ /no symbols/) { while ($ifstrip =~ /no symbols/) {
...@@ -136,14 +166,17 @@ while ($ifstrip =~ /no symbols/) { ...@@ -136,14 +166,17 @@ while ($ifstrip =~ /no symbols/) {
this script. Note: stripped versions make useless debug reports this script. Note: stripped versions make useless debug reports
}; };
print do_var($var24); print do_var($var24);
print "Enter the full path to wine:\n"; &select_wineloc;
$wineloc=<STDIN>; $ifstrip = `nm $wineloc 2>&1`;
chomp $wineloc; }
while ($wineloc =~ /^(\s)*$/) { while ($ifstrip =~ /not recognized/) {
print do_var($var23); $var26 = qq{
$wineloc=<STDIN>; Looks like you gave me something that isn't a wine binary (It could be a
chomp $wineloc; text file). Try again.
} };
print do_var($var26);
&select_wineloc;
print "Checking if $wineloc is stripped...\n";
$ifstrip = `nm $wineloc 2>&1`; $ifstrip = `nm $wineloc 2>&1`;
} }
$var5 = qq{ $var5 = qq{
...@@ -153,7 +186,7 @@ What version of windows are you using with wine? 0-None, 1-Win3.x, ...@@ -153,7 +186,7 @@ What version of windows are you using with wine? 0-None, 1-Win3.x,
}; };
print do_var($var5); print do_var($var5);
$winver=<STDIN>; $winver=<STDIN>;
until ($winver < 7) { until ($winver == 0 or $winver == 1 or $winver == 2 or $winver == 3 or $winver == 4 or $winver == 5 or $winver == 6 or $winver == 7) {
$var6 = qq{ $var6 = qq{
No! Enter a number from 0 to 7 that corresponds to your windows version! No! Enter a number from 0 to 7 that corresponds to your windows version!
}; };
...@@ -218,7 +251,7 @@ bit (Windows 9x, NT3.x and up), or 2 if you are unsure: ...@@ -218,7 +251,7 @@ bit (Windows 9x, NT3.x and up), or 2 if you are unsure:
print do_var($var10); print do_var($var10);
$progbits=<STDIN>; $progbits=<STDIN>;
chomp $progbits; chomp $progbits;
until ($progbits < 3) { until ($progbits == 0 or $progbits == 1 or $progbits == 2) {
print "You must enter 0, 1 or 2!\n"; print "You must enter 0, 1 or 2!\n";
$progbits=<STDIN>; $progbits=<STDIN>;
chomp $progbits chomp $progbits
...@@ -378,17 +411,42 @@ if ($debuglevel < 3) { ...@@ -378,17 +411,42 @@ if ($debuglevel < 3) {
} }
$bashver=qw("/bin/bash -version"); $bashver=qw("/bin/bash -version");
if ($bashver =~ /2\./) { $outflags = "2>" } if ($bashver =~ /2\./) { $outflags = "2>" }
else { $outflags = ">&" } else { $outflags = ">\&" }
print "Hit enter to start wine!\n"; print "Hit enter to start wine!\n";
$blank=<STDIN>; $blank=<STDIN>;
$dir=$program; $dir=$program;
$dir=~m#(.*)/#; $dir=~m#(.*)/#;
$dir=$1; $dir=$1;
use Cwd;
$nowdir=getcwd;
chdir($dir); chdir($dir);
system("echo quit|$wineloc -debugmsg $debugopts $extraops \"$program\" $outflags $dbgoutfile"); if ($outfile eq "no file" and $dbgoutfile ne "no file") {
$lastlines=`tail -n $lastnlines $dbgoutfile`; system("echo quit|$wineloc -debugmsg $debugopts $extraops \"$program\" $outflags $nowdir/$dbgoutfile");
system("gzip $dbgoutfile"); system("gzip $nowdir/$dbgoutfile");
open(OUTFILE,">$outfile"); }
elsif ($outfile ne "no file" and $dbgoutfile ne "no file") {
system("echo quit|$wineloc -debugmsg $debugopts $extraops \"$program\" $outflags $nowdir/$dbgoutfile");
$lastlines=`tail -n $lastnlines $nowdir/$dbgoutfile`;
system("gzip $nowdir/$dbgoutfile");
&generate_outfile;
}
elsif ($outfile ne "no file" and $dbgoutfile eq "no file"){
$lastlines=`echo quit|$wineloc -debugmsg $debugopts $extraops "$program" 2>&1 | tail -n $lastnlines`;
&generate_outfile;
}
else {
$var27 = qq{
I guess you don't want me to make any debugging output. I'll send
it to your terminal. This will be a *lot* of output -- hit enter to
continue, control-c to quit.
Repeat: this will be a lot of output!
};
print do_var($var27);
$blah=<STDIN>;
system("$wineloc -debugmsg $debugmsg $extraops \"$program\"");
}
sub generate_outfile {
open(OUTFILE,">$nowdir"."\/"."$outfile");
print OUTFILE <<EOM; print OUTFILE <<EOM;
Auto-generated debug report by Wine Quick Debug Report Maker Thingy: Auto-generated debug report by Wine Quick Debug Report Maker Thingy:
WINE Version: $winever WINE Version: $winever
...@@ -410,17 +468,25 @@ $lastlines ...@@ -410,17 +468,25 @@ $lastlines
I have a copy of the full debug report, if it is needed. I have a copy of the full debug report, if it is needed.
Thank you! Thank you!
EOM EOM
}
$var22 = qq{ $var22 = qq{
Great! We're finished making the debug report. Do whatever with it. The Great! We're finished making the debug report. Do whatever with it.
filename for it is: };
$var28 = qq{
The filename for the formatted report is:
$outfile $outfile
};
$var29 = qq{
The filename for the compressed full debug is: The filename for the compressed full debug is:
$dbgoutfile.gz $dbgoutfile.gz
Note that it is $dbgoutfile.gz, since I compressed it with gzip for you. Note that it is $dbgoutfile.gz, since I compressed it with gzip for you.
};
$var30 = qq{
Having problems with the script? Tell the wine newsgroup Having problems with the script? Tell the wine newsgroup
(comp.emulators.ms-windows.wine). (comp.emulators.ms-windows.wine).
}; };
print do_var($var22); print do_var($var22);
print do_var($var28) if $outfile ne "no file";
print do_var($var29) if $dbgoutfile ne "no file";
print do_var($var30);
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