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

This commit is contained in:
jkeiser%netscape.com 2003-07-31 18:45:30 +00:00
Родитель bc5e68ec69
Коммит 5d4be46294
1 изменённых файлов: 51 добавлений и 37 удалений

Просмотреть файл

@ -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 ($$)
} }
# #
# 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');
$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");
# 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 ($cvs_executable =~ /no cvs/) {
# If which didn't find it, just set to blank
$cvs_executable = "";
} else {
chomp $cvs_executable;
} }
LocalVar('cvsbin', <<"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 = "";
} else {
chomp $cvs_executable;
}
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");
# 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 ($interdiff_executable =~ /no interdiff/) {
# If which didn't find it, set to blank
$interdiff_executable = "";
} else {
chomp $interdiff_executable;
} }
LocalVar('interdiffbin', <<"END");
if (!LocalVarExists('interdiffbin')) {
my $interdiff_executable = `which interdiff`;
if ($interdiff_executable =~ /no interdiff/ || $interdiff_executable eq '') {
# If which didn't find it, set to blank
$interdiff_executable = "";
} else {
chomp $interdiff_executable;
}
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");
# 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 ($diff_binaries =~ /no diff/) {
# If which didn't find it, set to blank
$diff_binaries = "";
} else {
$diff_binaries =~ s:/diff\n$::;
} }
LocalVar('diffpath', <<"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 = "";
} else {
$diff_binaries =~ s:/diff\n$::;
}
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');