aboutsummaryrefslogtreecommitdiffstats
path: root/Bugzilla/Install/Util.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Bugzilla/Install/Util.pm')
-rw-r--r--Bugzilla/Install/Util.pm21
1 files changed, 21 insertions, 0 deletions
diff --git a/Bugzilla/Install/Util.pm b/Bugzilla/Install/Util.pm
index cb6b27786..3942aa82a 100644
--- a/Bugzilla/Install/Util.pm
+++ b/Bugzilla/Install/Util.pm
@@ -34,6 +34,7 @@ use Safe;
use base qw(Exporter);
our @EXPORT_OK = qw(
+ bin_loc
get_version_and_os
indicate_progress
install_string
@@ -41,6 +42,21 @@ our @EXPORT_OK = qw(
vers_cmp
);
+sub bin_loc {
+ my ($bin) = @_;
+ return '' if ON_WINDOWS;
+ # Don't print any errors from "which"
+ open(my $saveerr, ">&STDERR");
+ open(STDERR, '>/dev/null');
+ my $loc = `which $bin`;
+ close(STDERR);
+ open(STDERR, ">&", $saveerr);
+ my $exit_code = $? >> 8; # See the perlvar manpage.
+ return '' if $exit_code > 0;
+ chomp($loc);
+ return $loc;
+}
+
sub get_version_and_os {
# Display version information
my @os_details = POSIX::uname;
@@ -340,6 +356,11 @@ export them.
=over
+=item C<bin_loc>
+
+On *nix systems, given the name of a binary, returns the path to that
+binary, if the binary is in the C<PATH>.
+
=item C<get_version_and_os>
Returns a hash containing information about what version of Bugzilla we're