Commit 393dfb83 authored by jkeiser%netscape.com's avatar jkeiser%netscape.com

Don't spew "which: program not found" errors all the time (bug 214558), r=justdave

parent 2a3c2708
...@@ -379,11 +379,18 @@ checksetup.pl, and re-enter your answers. ...@@ -379,11 +379,18 @@ checksetup.pl, and re-enter your answers.
EOT EOT
die "Syntax error in localconfig"; die "Syntax error in localconfig";
} }
sub LocalVarExists ($)
{
my ($name) = @_;
return $main::{$name}; # if localconfig declared it, we're done.
}
my $newstuff = ""; my $newstuff = "";
sub LocalVar ($$) sub LocalVar ($$)
{ {
my ($name, $definition) = @_; my ($name, $definition) = @_;
return if ($main::{$name}); # if localconfig declared it, we're done. return if LocalVarExists($name); # if localconfig declared it, we're done.
$newstuff .= " " . $name; $newstuff .= " " . $name;
open FILE, '>>localconfig'; open FILE, '>>localconfig';
print FILE ($answer{$name} or $definition), "\n\n"; print FILE ($answer{$name} or $definition), "\n\n";
...@@ -391,7 +398,6 @@ sub LocalVar ($$) ...@@ -391,7 +398,6 @@ sub LocalVar ($$)
} }
# #
# Set up the defaults for the --LOCAL-- variables below: # Set up the defaults for the --LOCAL-- variables below:
# #
...@@ -411,15 +417,16 @@ LocalVar('index_html', <<'END'); ...@@ -411,15 +417,16 @@ LocalVar('index_html', <<'END');
$index_html = 0; $index_html = 0;
END END
my $mysql_binaries = `which mysql`; if (!LocalVarExists('mysqlpath')) {
if ($mysql_binaries =~ /no mysql/) { my $mysql_binaries = `which mysql`;
# If which didn't find it, just provide a reasonable default if ($mysql_binaries =~ /no mysql/ || $mysql_binaries eq '') {
$mysql_binaries = "/usr/bin"; # If which didn't find it, just provide a reasonable default
} else { $mysql_binaries = "/usr/bin";
$mysql_binaries =~ s:/mysql\n$::; } else {
} $mysql_binaries =~ s:/mysql\n$::;
}
LocalVar('mysqlpath', <<"END"); LocalVar('mysqlpath', <<"END");
# #
# In order to do certain functions in Bugzilla (such as sync the shadow # In order to do certain functions in Bugzilla (such as sync the shadow
# database), we require the MySQL Binaries (mysql, mysqldump, and mysqladmin). # database), we require the MySQL Binaries (mysql, mysqldump, and mysqladmin).
...@@ -428,17 +435,19 @@ LocalVar('mysqlpath', <<"END"); ...@@ -428,17 +435,19 @@ LocalVar('mysqlpath', <<"END");
# Please specify only the directory name, with no trailing slash. # Please specify only the directory name, with no trailing slash.
\$mysqlpath = "$mysql_binaries"; \$mysqlpath = "$mysql_binaries";
END END
}
my $cvs_executable = `which cvs`; if (!LocalVarExists('cvsbin')) {
if ($cvs_executable =~ /no cvs/) { my $cvs_executable = `which cvs`;
# If which didn't find it, just set to blank if ($cvs_executable =~ /no cvs/ || $cvs_executable eq '') {
$cvs_executable = ""; # If which didn't find it, just set to blank
} else { $cvs_executable = "";
chomp $cvs_executable; } else {
} chomp $cvs_executable;
}
LocalVar('cvsbin', <<"END"); LocalVar('cvsbin', <<"END");
# #
# For some optional functions of Bugzilla (such as the pretty-print patch # For some optional functions of Bugzilla (such as the pretty-print patch
# viewer), we need the cvs binary to access files and revisions. # viewer), we need the cvs binary to access files and revisions.
...@@ -446,17 +455,19 @@ LocalVar('cvsbin', <<"END"); ...@@ -446,17 +455,19 @@ LocalVar('cvsbin', <<"END");
# its location here. Please specify the full path to the executable. # its location here. Please specify the full path to the executable.
\$cvsbin = "$cvs_executable"; \$cvsbin = "$cvs_executable";
END END
}
my $interdiff_executable = `which interdiff`; if (!LocalVarExists('interdiffbin')) {
if ($interdiff_executable =~ /no interdiff/) { my $interdiff_executable = `which interdiff`;
# If which didn't find it, set to blank if ($interdiff_executable =~ /no interdiff/ || $interdiff_executable eq '') {
$interdiff_executable = ""; # If which didn't find it, set to blank
} else { $interdiff_executable = "";
chomp $interdiff_executable; } else {
} chomp $interdiff_executable;
}
LocalVar('interdiffbin', <<"END"); LocalVar('interdiffbin', <<"END");
# #
# For some optional functions of Bugzilla (such as the pretty-print patch # For some optional functions of Bugzilla (such as the pretty-print patch
...@@ -465,23 +476,26 @@ LocalVar('interdiffbin', <<"END"); ...@@ -465,23 +476,26 @@ LocalVar('interdiffbin', <<"END");
# its location here. Please specify the full path to the executable. # its location here. Please specify the full path to the executable.
\$interdiffbin = "$interdiff_executable"; \$interdiffbin = "$interdiff_executable";
END END
}
my $diff_binaries = `which diff`; if (!LocalVarExists('diffpath')) {
if ($diff_binaries =~ /no diff/) { my $diff_binaries = `which diff`;
# If which didn't find it, set to blank if ($diff_binaries =~ /no diff/ || $diff_binaries eq '') {
$diff_binaries = ""; # If which didn't find it, set to blank
} else { $diff_binaries = "";
$diff_binaries =~ s:/diff\n$::; } else {
} $diff_binaries =~ s:/diff\n$::;
}
LocalVar('diffpath', <<"END"); LocalVar('diffpath', <<"END");
# #
# The interdiff feature needs diff, so we have to have that path. # The interdiff feature needs diff, so we have to have that path.
# Please specify only the directory name, with no trailing slash. # Please specify only the directory name, with no trailing slash.
\$diffpath = "$diff_binaries"; \$diffpath = "$diff_binaries";
END END
}
LocalVar('create_htaccess', <<'END'); LocalVar('create_htaccess', <<'END');
......
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