summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Install/Util.pm
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2007-10-24 02:33:30 +0200
committermkanat%bugzilla.org <>2007-10-24 02:33:30 +0200
commit212433f27ac422f79924d03b5d047236f6cdd308 (patch)
tree75f2acf6063b8fcc8b6739a0201a1447de778f6d /Bugzilla/Install/Util.pm
parent9f8e0ce687bfc85339fc6c9ae3728e03527963b3 (diff)
downloadbugzilla-212433f27ac422f79924d03b5d047236f6cdd308.tar.gz
bugzilla-212433f27ac422f79924d03b5d047236f6cdd308.tar.xz
Bug 262269: A tool to auto-install missing perl packages on non-Windows systems
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> (module owner)
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