From 66bd251608fb87bdd273967e99c3624d38b8c5fe Mon Sep 17 00:00:00 2001 From: "jocuri%softhome.net" <> Date: Mon, 8 Mar 2004 20:52:25 +0000 Subject: Patch for bug 143490: eliminate unsupported calls from checksetup.pl when running in Windows; original code by Cedric Caron ; patch by Andrei Benea ; r=vlad,justdave, a=justdave. --- checksetup.pl | 228 +++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 139 insertions(+), 89 deletions(-) (limited to 'checksetup.pl') diff --git a/checksetup.pl b/checksetup.pl index a6b673a60..2c7dc9d6a 100755 --- a/checksetup.pl +++ b/checksetup.pl @@ -452,14 +452,20 @@ $index_html = 0; END if (!LocalVarExists('mysqlpath')) { - my $mysql_binaries = `which mysql`; - if ($mysql_binaries =~ /no mysql/ || $mysql_binaries eq '') { - # If which didn't find it, just provide a reasonable default - $mysql_binaries = "/usr/bin"; + my $mysql_binaries; + if ($^O !~ /MSWin32/i) { + $mysql_binaries = `which mysql`; + if ($mysql_binaries =~ /no mysql/ || $mysql_binaries eq '') { + # If which didn't find it, just provide a reasonable default + $mysql_binaries = "/usr/bin"; + } else { + $mysql_binaries =~ s:/mysql\n$::; + } } else { - $mysql_binaries =~ s:/mysql\n$::; - } - + # provide a reasonable default for Windows + $mysql_binaries = 'c:\mysql\bin'; + } + LocalVar('mysqlpath', <<"END"); # # In order to do certain functions in Bugzilla (such as sync the shadow @@ -467,18 +473,23 @@ if (!LocalVarExists('mysqlpath')) { # Because it's possible that these files aren't in your path, you can specify # their location here. # Please specify only the directory name, with no trailing slash. -\$mysqlpath = "$mysql_binaries"; +\$mysqlpath = '$mysql_binaries'; END } if (!LocalVarExists('cvsbin')) { - my $cvs_executable = `which cvs`; - if ($cvs_executable =~ /no cvs/ || $cvs_executable eq '') { - # If which didn't find it, just set to blank - $cvs_executable = ""; + my $cvs_executable; + if ($^O !~ /MSWin32/i) { + $cvs_executable = `which cvs`; + if ($cvs_executable =~ /no cvs/ || $cvs_executable eq '') { + # If which didn't find it, just set to blank + $cvs_executable = ""; + } else { + chomp $cvs_executable; + } } else { - chomp $cvs_executable; + $cvs_executable = ""; } LocalVar('cvsbin', <<"END"); @@ -493,20 +504,25 @@ END if (!LocalVarExists('interdiffbin')) { - my $interdiff_executable = `which interdiff`; - if ($interdiff_executable =~ /no interdiff/ || $interdiff_executable eq '') { - if (!$silent) { - print "\nOPTIONAL NOTE: If you want to "; - print "be able to use the\n 'difference between two patches' "; - print "feature of Bugzilla (requires\n the PatchReader Perl module "; - print "as well), you should install\n patchutils from "; - print "http://cyberelk.net/tim/patchutils/\n\n"; - } + my $interdiff_executable; + if ($^O !~ /MSWin32/i) { + $interdiff_executable = `which interdiff`; + if ($interdiff_executable =~ /no interdiff/ || $interdiff_executable eq '') { + if (!$silent) { + print "\nOPTIONAL NOTE: If you want to "; + print "be able to use the\n 'difference between two patches' "; + print "feature of Bugzilla (requires\n the PatchReader Perl module "; + print "as well), you should install\n patchutils from "; + print "http://cyberelk.net/tim/patchutils/\n\n"; + } - # If which didn't find it, set to blank - $interdiff_executable = ""; + # If which didn't find it, set to blank + $interdiff_executable = ""; + } else { + chomp $interdiff_executable; + } } else { - chomp $interdiff_executable; + $interdiff_executable = ""; } LocalVar('interdiffbin', <<"END"); @@ -522,12 +538,17 @@ END if (!LocalVarExists('diffpath')) { - my $diff_binaries = `which diff`; - if ($diff_binaries =~ /no diff/ || $diff_binaries eq '') { - # If which didn't find it, set to blank - $diff_binaries = ""; + my $diff_binaries; + if ($^O !~ /MSWin32/i) { + $diff_binaries = `which diff`; + if ($diff_binaries =~ /no diff/ || $diff_binaries eq '') { + # If which didn't find it, set to blank + $diff_binaries = ""; + } else { + $diff_binaries =~ s:/diff\n$::; + } } else { - $diff_binaries =~ s:/diff\n$::; + $diff_binaries = ""; } LocalVar('diffpath', <<"END"); @@ -556,8 +577,14 @@ LocalVar('create_htaccess', <<'END'); $create_htaccess = 1; END - -LocalVar('webservergroup', ' +my $webservergroup_default; +if ($^O !~ /MSWin32/i) { + $webservergroup_default = 'nobody'; +} else { + $webservergroup_default = ''; +} + +LocalVar('webservergroup', <<"END"); # # This is the group your web server runs on. # If you have a windows box, ignore this setting. @@ -569,8 +596,8 @@ LocalVar('webservergroup', ' # and you cannot set this up any other way. YOU HAVE BEEN WARNED. # If you set this to anything besides "", you will need to run checksetup.pl # as root, or as a user who is a member of the specified group. -$webservergroup = "nobody"; -'); +\$webservergroup = "$webservergroup_default"; +END @@ -745,6 +772,20 @@ see below are caused by this. EOF } + + if ($^O =~ /MSWin32/i) { + print <rows == 0) { $SIG{QUIT} = \&bailout; $SIG{TERM} = \&bailout; - system("stty","-echo"); # disable input echoing + if ($^O !~ /MSWin32/i) { + system("stty","-echo"); # disable input echoing + } while( $pass1 ne $pass2 ) { while( $pass1 eq "" || $pass1 !~ /^[[:print:]]{3,16}$/ ) { @@ -4060,7 +4107,10 @@ if ($sth->rows == 0) { # Crypt the administrator's password my $cryptedpassword = Crypt($pass1); - system("stty","echo"); # re-enable input echoing + if ($^O !~ /MSWin32/i) { + system("stty","echo"); # re-enable input echoing + } + $SIG{HUP} = 'DEFAULT'; # and remove our interrupt hooks $SIG{INT} = 'DEFAULT'; $SIG{QUIT} = 'DEFAULT'; -- cgit v1.2.3-24-g4f1b